CellProfiler 3D colocalization error

Hi all,

Running MeasureColocalization in CellProfiler (4.0.4).

Due to background noise I have binarized my images to only select for structure of interest. If I put this binzarized image as a maximum projection, the CellProfiler pipeline works. However, if I put the Zstack of the binarized image, the pipeline returns the error:

“Error while processing MeasureColocalization: local variable 'Thr_fi_c” referenced before assignment"

I thought it was an issue with the Zstack, but if I analyze the original grayscale (non-binarized) images, the pipeline works. I desire the Zstack because a maximum project results in seeming co-localization but there is clear separation in Z between the objects.

Has anyone encountered a similar issue or know why this occurs.


Hi @AFenix ,

MeasureColocalization is generally intended to work with greyscale images, not binary. Making a max projection is probably converting it into a greyscale-like image which is why that didn’t trigger the error.

The particular segment that’s causing the error here is the Costes automated threshold. Attempting to run this technique is nonsensical on a binary image (since there are only 2 possible values), which is why it fails to run. There’s an option to disable these features in the module settings, but if you’re working with binary images you may be better off using the MeasureImageOverlap module instead.

To make a more useful error message for future versions, it’d be helpful if you could post a copy of the pipeline and a test image so that we can replicate this?

Hope that helps!

1 Like