Difficulty obtaining consitancy

Hello. I’m doing a project where I need to quantify cells in an image. The cells appear as black dots. What I’ve been doing is adjusting the threshold on the “Red, Green, Blue” color space. I then adjust the threshold for the green and blue until their covered by red dots. I then analyze the image, adjusting the threshold for size and roundness. I’m having trouble getting consistant counts and counts that are close to my hand counts. I’ve had some success by raising the threshold for size. Any other suggestions?

Hi @mike345stein,

could you provide an example image for us to be able to follow your stratagy explanation and potentially being able to give some suggestions on possible solutions to increase consistancy.

From only a quick few, my first suggestion would be…

1.) try to avoid saving the images as .jpg, (if your originals are in a different format e.g. tiff, forget about that point)
The lossy-compression makes you loose already a lot in detection quality on those small features.

2.) is there any possibility to tweak the staining procedure (meaning less grayish background and the “positive” nuclei stronger stained. I guess this is done using DAB (?). Also in histological cases it is worth to try improving signal-to-background “ratio” to improve the possibility of color separation.

Besides sample preparation and imaging improvement the following might help in the detection process

3.) I would also try to apply an edge preserving filter, such as the “Mean Shift” filter available as a plugin. This might suppress some smaller noise while making the nuclei which are not so homogeniously stained potentially detectable more reliable.

4.) you can have a look at the trainable segmentation tools such as Trainable Weka Segmentation or SIOX

Once the extraction works a bit more specific you could still improve the binary image with

5.) >Process >Binary >Watershed or functions like >Open and >Close under the same menu.

6.) Finally, your approach on limiting to a certain circularity in the >Analyze > Analyze Particles… might further help
Or you can have a look at the Extended Particle Analyzer


Thanks for the suggestions. I’ll look into all of these options.

I’ve downloaded Mean Shift onto my computer but I can’t get it as a plugin for ImageJ. Also, I’m not sure how to use it. Any suggestions?

Hi @mike345stein,

have you followed the instructions on the ImageJ homepage?

Download Mean_Shift.class to the plugins folder, or subfolder, restart ImageJ, and there will be a new “Mean Shift” command in the Plugins menu, or submenu.

For the parameters someone might correct me if I am not completely correct…

As explained on the IJ homepage the spatial radius as for other filters considers the area around one pixel which should be considered for each filtering step.

The parameter of the color distance (or for grayscale images the gray value distance) considers how much the pixel values (color in the implemented color space or pixel intensities for grayscale images) are allowed to differ from one to the consecutive filter kernel position (during the shift) to be considered.

For your usage…
If you increase the spacial radius the filtering effect will be increasing as well and most likely “group” bigger spacial areas together (while this depends also on the second parameter). An increase most likely also increases the spatial grouping of pixels up to a certain point after which some areas might receive a stronger blurring than others (something which you mostly want to avoid). Since you want to rather group your relatively small DAB(?) stained nuclei together and distinguish them from the rest of the HE(?) stained tissue, I guess that you rather need a small spatial radius (potentially around 2-4 pixels) and also a not too big range for the color distance (potentially between 20-50).
This is now only a guess according to the one example you posted but I would try this first on different images to narrow it down to a useful range.

The purpose of this is to homogenize the colors and thus the image a little bit and to reduce different intensities while grouping colored pixels together. This should make it afterwards easier to detect/extract the positively stained nuclei as a whole more reliably. Otherwhise, any weaker area in a nucleus might lead to holes or missing parts after extraction. This finally will affect how well the counting/measureing with the Analyze Particles will work.

1 Like