Using a mask whilst counting foci

Tags: #<Tag:0x00007fb88277a0f0> #<Tag:0x00007fb882779dd0>


I am currently creating a macro which will count the number of foci in each channel of a GFP/RFP fluorescence image of yeast cells after dead cells have been removed from the image. In previous versions of my macro I was using a simple ‘Threshold’ function to find foci, followed by ‘Analyse particles’ to find how many there were. This was proving to be unreliable so I moved onto using the MosaicSuite’s Spot detection plugin ( to find foci in the image instead. The problem with this plugin seems to be that if I apply a mask to remove dead cells by using the ImageCalculator to multiply the mask by the image, leaving a black area on the image, like so:

The plugin gets confused by the black area and detects many false ‘foci’ around its edge:

According to the documentation for the plugin, there should be the option to add in a mask layer, however I have found no way to apply the mask as there isn’t an apply button!
I imagine there must be a way to get the plugin to only look at a certain area of the image using the ROI manager perhaps, but I have not used this enough to know how to segment an image using it.
I have binary mask files and images to work with. Could someone suggest a way to segment my images using these masks so that the foci counting plugin will work properly?

Thanks for any help,




Welcome to the Forum!

So just a few things…

What did you feel was unreliable about your previous macro? The step you were using sounded fine… as long as you were using Auto-Thresholding methods, etc to ensure reproducibility.

What was your reasoning for removing these dead cells? In general - these types of data alteration worry me - as they can lead to more inconsistencies in your analysis workflow. Can you attach an original image - one that was unaltered? That would be helpful for us to assess how to best analyze your images - which can most likely be done without this ‘deletion’ step.

I have not used this plugin myself - so perhaps others can give you more specific answers. But here are some helpful links on ImageJ and Segmentation:

I hope this helps a bit!