Counting algae cells with granulated background




I have trouble counting small algae cells on CellProfiles on a background that is quite noisy and does not contrast so well with the cells. Image attached. In my pipeline I have used, imagemath/ invert, then smooth/smooth keeping edges based on cell diameter, then IdentifyPrimaryObjects with robust background and distinguish between clumped objects and lines based on intensity.

But at the end I get just a black image that nothing is identified.

Any advice, pleeease


Hello Sofie,
I did not use cell profiler to segment this image, I used Fiji instead because it is faster. If the image suits you I will write up the whole procedure (not difficult just hard to explain) shortly and send it back

Good luck

1st Results.csv (28.3 KB)
1st Summary.csv (114 Bytes)


yes please! I dont know how to thank you for this!!!


Hello again!,
O.K. I am assuming (I shouldn’t do that) that the attached image is as you aquired it with no preprocessing yet. So, the following is what I did.
Since any analysis in the future will vary in characteristics this first part was done by hand. Obtain the Polynomial Shading Corrector and Polynomial Fit plug-ins (available from the ImageJ/Fuji plug-in site) and firstly shade correct the image to flatten out the background. You can even do this twice if there’s any doubt and it’s quick, Then create a Poly fit image. Now the following is for the image and is completly variable to any images you may have in the future.

  1. Use Process > Math > subtract(150) all pixels from here down are not providing any data so it’s useless. Then Math > Divide(16) the highest value of pixels remaining, and then Multiply >(100) this gives you an extreamly good contrast. Better then the Macro which would be v=((v-150)/16*100)

  2. This you can do and then undo if it does not improve the image, but subtract the Fit image from the Prime image.

Your done and can color threshold and analyze particles.

This I done just because it didn’t seem that you needed the Blue channel so I split the channels and then merged only the Red and Green channels.

Hope this helps now and in the future , any questions just ask.


Bob, thank you so much for getting into all this trouble! You might have saved us hundreds of hours of processing…

I will give this a try the next few days. Hopefully it will work

I will make sure I acknowledge you in our paper!


Hi Sofie1,
No need for that, but before you do anything with the image select the whole image then plot the profile and enable the LIVE button at the bottom so you can watch the changes as they happen. I get a kick out of it. Take care.


Hi Bob,

Trying to follow your steps and just have a couple of questions.
What degree of polynomial should I use for the surface fit? For subtracting the images I need to be saving themnunder different names or is there a simpler way?
Finally, I wanted to ask whether you think this procedure could be automated using eg a macro, cause I have hundreds of pictures like this one

A huge thanks for your help!



Hi Sofie,
O.K. now for the interesting stuff. All numbers used in both plug-ins should be kept between 1 and 10. The Degree in the Shading plug_in determines how much “spread” there is in the shading range and should be equal in both the x and y axis. The Regularization determines how close you want the image to the maximum intensity of the image. I very seldom use a value higher than 5. The lower this value, the closer you get to maximum.
For the Fit plug-in, the higher the value the closer the fit is to the overall intensity of the image BUT there will be more variation to the fit.
The reason for all of this is that you will be manipulating how the PHOTONs of light interact with the image. and it all has to be balanced out which will become easier with practice.
As for the automation of the process Yes it can be. IF all of the images are very consistant as to size,brightness,focus and distance. You will understand as you work with it. And it is relatively simple with Fiji/Image macro recording accessed by Plugins > Macro > Record. You simply start it at the beginning of the process and it records every move you make so you can save it for later use.

Good Luck, have fun with it- you can’t break it and I’ll always be around if any further questions.


Hi again Bob,

Ok I managed to follow all steps up until the color threshold. After I merge the red and yellow channels I get a new tiff but when I try to do color threshold on it, all options are disactivated. What am I doing wrong? I feel I’m very close…

Thank you!


When you merge the images you need to use three images to color threshold, so while the channels are separated highlight the Green and Edit > selection > select all then Edit > clear image and then merge with all three channels.

I’m proud for you guys. Keep up the spirits and drive on.




Sorry Sophie!
I misunderstood the question. You need to convert the tiff image to a rgb image in Image > type >RGB to get all three channels. I’m so very sorry–Just old age I guess


(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


i did it Bob! I managed to count them accuratelly with your method! you are a star