Help on non stain, bad background cell count


I am at the begining of using cellprofiler.

I attached the sample image D3.tif file.

I want count the cell number.
How can I deal with the backgound?
What kind threshold method should be used in the IdentifyPrimAutomatic?

Thanks a lot.

Wenhuo Hu

Hi Wenhuo,

We have some tips on dealing with brightfield/non-fluorescence images here which you might find useful.
In your case, I would probably do the following:

  • ImageMath to invert the image

  • Smooth module on the inverted image with Enhance speckles (top-hat filtering) with the filter size set to your average cell radius.

  • IdentifyPrimAutomatic on the result of the above step, probably using RobustBackground Global as your method, since so much of your image is background with little foreground. The other methods may overestimate the threshold, but you can always test different methods and check the result. You probably would want Intensity as the declumping method and intensity to draw diving lines.

Hope this gets you started!

Hi Mark,

Thank for your help.

I am sorry it does not work. It seems I am not using the FindEdges the right way. Would you help me revise my pipeline atached with the D3.tif?

Thank you.


countCellPIPE.mat (965 Bytes)

Try the following:

  • I would not use the FindEdges module in your case, so I would recommend removing that module.

  • Your threshold correction factor in the IdentitfyPrimAuotmatic module is too low; I would set it to roughly in the range of 3.

  • Set the declumping/dividing line methods to “Intensity” and “Intensity” rather than “Shape” and “Distance”

  • Set the smoothing filter size to roughly 13, and the maxima separation to roughly 13 as well.



I present here the way I used to find the cell numbers in my picture. Just in case someone doing the similar job. And be happy to see if anyone help to improve this program.

My program is based on … hange/9168).

my findCircle.m:

imgOrig = imread(‘WTALLE1.jpg’);
img = imcrop(imgOrig);
red=img(:,:,2); %col2gray also works
[accum, circen, cirrad] = CircularHough_Grd(red, [5 25], 11, 12, 1);
%image, big-small, background, shape, overlap
if any(cirrad <= 0)
inds = find(cirrad>0);
cirrad = cirrad(inds);
circen = circen(inds,:);
hold on;
plot(circen(:,1), circen(:,2), ‘r+’);
for ii = 1 : size(circen, 1)
rectangle(‘Position’,[circen(ii,1) - cirrad(ii), circen(ii,2) - cirrad(ii), 2cirrad(ii), 2cirrad(ii)],…
‘Curvature’, [1,1], ‘edgecolor’, ‘b’, ‘linewidth’, 1.5);
hold off;

Thanks for contributing this code! Hopefully, it will be useful to others.