Discard primary objects when secondary objects not detected


Here I have two fluorescence images of cancer cells: a red channel detecting RFP in the nucleus, a green channel detecting GFP in the cytoplasm. GFP expression levels vary greatly among cells.

I constructed a pipeline that detects nuclei as primary objects and cells as secondary objects. However, in some cases the pipeline fails to detect secondary objects, in which case the secondary object seems to become equal to the primary object. (In the attached example: cell number 12, 29, 36 and others.)

I would like to discard such primary and secondary objects, but have no idea how to do it using FilterObjects etc. In other words, what I would like to do is to discard objects such that the area of the secondary object is equal to that of the primary object. (Using tertiary objects did not work, because the area of the tertiary object is not equal to the difference between that of the secondary object and of the primary object.)

Is it possible to implement this inside CellProfiler? Or are there any good ways to decrease such detection failures?

Thank you.


cell_nucleus_identification.cp (19.3 KB)

Hi louispasteur,

One approach to take is the following:

  • Detect the Nuclei/Cells using IdentifyPrimary/IdentifySecondary as you do now.

  • Re-identify the cells of interest using the IdentifyPrimary modules (call the new objects NewCells, for instance). It’s important to use the same threshold method/correction factor as you did in the IdentifySecondary module so that the object boundaries match and that the cells that did not grow in IdentifySecondary are not

  • Use RelateObjects to establish a parent-child relationship between the NewCells as children and the original Cells are parents.

  • Use FIlterObjects to filter the Cells using Measurements > Children > NewCell_Count as the feature to filter by and using a minimum measurement value of 1 (remember to uncheck the maximum measurement filtering box). What this does is eliminate all Cells which do not have a child object (i.e, the per-Cell child count is 1 or more).

  • Also in the FilterObjects module, press “Relabel additional objects to match the filtered object?” and select the Nuclei and the filtered nuclei a new name.

By the end of this procedure, you should have a new collection of filtered nuclei/cells which exclude the ones that did not grow during the IdentifySecondary step.

Lastly, if you are using ExportTpoSpreadsheet and you want the per-object measurements, you should specify only these filtered objects to be exported. The total number of each object may not match and CP will fill the extra rows with zeros, which can be problematic.


1 Like

Thanks mbray, it’s working!
RelateObjects is really useful.