How to apply a mean threshold that only considers part of the image?

Hey guys,

so I have an image like this:

3_CB-17-A14R-Vm-per30-0242_PROCESSED_multiplied.tiff (4.0 MB)

And I want to apply a mean threshold. However, I want it to only consider the grey values of the particles in the image, not all the 0 values of the background. If I apply the mean threshold regularly, it gives me this:

3_CB-17-A14R-Vm-per30-0242_THRESHOLDED.tif (4.0 MB)

My idea was now, to use the binary image as a mask and thell the mean threshold to only build the mean from the white areas.

How would I do that?

Hi @cripcate,

You only have to use your mask as a ROI that you draw on your original image. The mean threshold will be computed inside the ROI.
For example, for your image, mean threshold is 39 for the whole image but 132 inside the mask.


1 Like


I managed to do it by choosing “Image to Selection”, then adding it to the ROI manager, opening the ROI in the original image and applying the threshold.

Alternatively in my case i can just choose “ignore black” in the auto threshold dialog achieving a very similar result.

By the way, my idea didn’t really help in my use case :smiley: but anyway, now I know how to do that.