I’m measuring pixel colocalization between a red channel image and a green channel image and I noticed a behavior that I don’t understand. In the MeasureColocalization module, I have it set to measure within object boundaries (within cells). When I change the “Set threshold as percentage of maximum intensity for the images” parameter from the default 5 to 0, I get the exact same colocalization value down to the 15th decimal. I checked using the MeasureImageIntensity module and within the same objects, the minimal pixel intensity varies between 1 and 4 percent of the maximal intensity, so it should be thresholding out some pixels at 5 percent. I find it hard to believe that the colocalization is the same to 15 decimal places. Is there something I’m misunderstanding about usage?
Just out of curiosity, what type of colocalization is it? Manders, Pearsons, or some other? Or all of them? For example, the Overlap Coefficient might be very unaffected by small values if the intensity varies by a large amount across the image.
I don’t know CellProfiler though, so just trying to clarify for someone else who might
I’m looking at the one labeled “Correlation” which I believe is Pearsons (please tell me if I’m wrong).
Ah, that probably gets into the code then, so I won’t be able to help much. It does look like it is Pearson’s or some variant of that.
The only thing that comes to mind is if you are looking at, say confocal data or thresholded data (wihch is what this sounds like after cell detection), you might have very few low, but non-zero pixels. If the minimum threshold is non-inclusive (0 means greater than 0, not greater than or equal), that means the difference between 0 and 5 could be very, very few pixels compared to your total population, even if you included whole image. A handful of pixels across an image filled with cells is likely to have negligible impact. It might be interesting to see the difference between 1 and 0% when not restricting the analysis to only within your cell objects.
Other than that, dunno!
I was thinking something similar but I experimented with setting it all the way up to 99% and I still got the same answer. I’m thinking this parameter gets ignored for Pearsons, but I’m not sure why.
I did a test by computing Pearsons for the whole image, not just on the objects. The value changed (thankfully). However, CellProfiler reported a value of .88 whereas the Fiji Coloc2 function reported “Pearson’s R Value (no threshold)” to be .82 for the same image. I’m confused where the discrepancy may be coming from.
Thanks for your suggestions!
Ah, it must be the threshold that is used for Manders then. Pearson’s doesn’t normally have one (within the math), but I was thinking they might be applying it to the input pixels.
Reading about each briefly, it looks like one of the inputs for Coloc2 (Step 6-3) is the estimated point spread function of your imaging conditions. If so, you aren’t actually analyzing the same image. Not sure if that is something you can turn on or off.
Edit: though re-reading that maybe it only applies to the Costes value and not the Pearson’s.
One last thought, if you are allowed/able to share one of the images where the Pearson’s colocalization difference occurs, we might be able to @ the appropriate people to have them check.
Thanks! I actually figured it out. When I was comparing CellProifler to ImageJ, I had one step of pre-processing that I had forgotten to strip out of my pipeline. When I actually compared the same input images between the two programs, I got the same Pearson’s coefficient from both. It looks like, as you suggested, then threshold gets ignored for the PCC (they should document that - I assumed it was an input pixel threshold as you suggested).
Glad you figured it out! The first step towards “They should” is to report the issue so the software’s team is aware of it! I’ve done that for this issue here: https://github.com/CellProfiler/CellProfiler/issues/3767