Counting cells in a subregion of an image

I am trying to use cell profiler to identify cells in a subregion of the retina. To do so, i am performing immunohistochemistry to stain my cells of interest that should positive for “islet1” antibody but negative for “sox2” antibody. I have written a pipeline for cell profiler but have encountered a few problems:

  1. I don’t seem to be able to preselect the retina subregion. I have found the option to select a rectangle or ellipse from the “crop” module but this doesn’t capture my area of interest which has an irregular shape that vary from one image to the next. Is there an option to draw/crop an arbitrary shape?
  2. I am trying to measure the islet1+/sox2- cells. To do so, I have used the module “relate” and then I have established a parental relationship between the two so that it counts islet1+/sox2- cells. To be able to export this in my image file on excel, I have used the module “filter by object measurement” but it doesn’t seem to count parental cells (islet1+) without children (sox2+) (nor parental cells with children). How should I fill this module to obtain automatically this cell count?
  3. using the module “identifyprimautomatic”, the cell count I get for islet1 seems quite accurate but the one I get for sox2 is not great (it seems that the background and the cells are not distinguished). It might be because there are usually very little sox2+ cells on my images. I have added a module “correct illumination” but it doesn’t seem to improve much. what do you suggest I do?
    Thank you very much for your time.

I’ve moved your post to the CellProfiler Help section since it was in the CellProfiler Analyst Help forum. You should be able to get some assistance here.

ok, great! Thanks :smile:

The IdentifyPrimManual module allows the user to draw a arbitrary shape on a image.

FilterByObjectMeasurement does not count the filtered objects, which is a bug. However, you can obtain the same measurement by using ClassifyObjects. Specify the parent object, “Children” as the category, and “1” as the measurement (which is the undocumented feature number for the child count), “Custom-defined” as the bin type, and “0.5” as the cutoff value. This will produce two per-image measurements: the number of parents with < 0.5 children (i.e., 0) and those with greater (i.e., 1 or more).

The answer to this depends on the nature of the sox2 image. If there are very few foreground objects (i.e., cells) and a lot of background, you may do better with Background or RobustBackground as the thresholding method in IdentifyPrimAutomatic.

Hope this helps!

Hi Mark,
It definitely helps!
I still need some help with regards to my first question: ultimately, I could like to crop an arbitrary shape and count cells within this shape with IdentifyPrimautomatic. Is there a way to link the shape I defined in IdentifyprimManual to the Crop module (i.e. in “into which shape would you like to crop?”)?
Many thanks :smile:

In the Crop module, for the “Select which shape…” setting, select “Other” and then type the name of the object(s) that you created in IdentifyPrimManual. This will crop the image into the shape of the object.


Everything is working very well now. Thank you very much for your help :smile:

Good to hear. Let us know if you need anything else!