Help with filtering strategy


I am hoping that someone can help me devise a filtering strategy for this problem: How to exclude Secondary Objects that DO NOT fully (or mostly) encapsulate the Primary Object.

I have attached an example image to try and demonstrate the problem I am running into.

In the attached image there is Object A and Object B.

It is apparent from the input image that Object B is actually a projection of Cell A that is being associated with a different primary object (Primary Object B).

In the bottom left panel, it is clear how for Object B the primary object (green) and the secondary object (magenta) extensively share a perimeter border, while for Object A the secondary object near fully encapsulates the primary object with distinguishable space between the green and magenta borders.

I am trying to devise a way to flag objects like B where the border of the primary object is extensively shared with the border of the associated secondary object.

Other strategies I have used to address this problem have included: trying different methods of identifying the secondary objects (Propagation, Distance-B, etc.), as well as trying to filter on the ratio of the area of the primary and secondary objects, but neither of these have solved the problem.

Any suggestions will be greatly appreciated!

2015-08-05 CP Example Image.pdf (112 KB)

Hmm, maybe this is a tougher problem than I anticipated?

Since these types of objects are not uncommon in my images, is this the type of problem that could be addressed with a teach-set in Cell Profiler Analyst? Would CPA be able to build a rule to identify objects where the perimeter of primary object is touching the perimeter of the secondary object?

I have not been able to try this in CPA, since I am completely in the dark on how to set up a MySQL database to run CPA.


Hi Joe,
Sorry for the slow response! Yes, it would seem that you need to filter the Primary objects/nuclei before growing out the projections. This can be accomplished as such:
(1) ID the primary nuclei
(2) Measure intensity of the marker as shown in your example.
(3) Filter out the other nuclei with a FilterObjects module, based on the fact that they at least tend to have less of the neurite/projection marker than your “A” nucleus. You can help find a threshold for this using a DisplayDataOnImage to show the mean (or another?) intensity of the projection marker in the nucleus. Then use this threshold in FilterObjects. In subsequent modules in your pipeline, you’ll need to measure whatever metrics you want again on your new filtered object.

This threshold may be not quite robust enough, though. So to get a more complex set of rules that define what is a “good” primary object, I have done exactly what you suggest, i.e. use CPA, to find a more complex set of rules to define the nuclei that have projections from those that don’t (e.g. glia in a neuronal culture).

You can do this fairly simply using the SQLite option (not MySQL) in ExportToDatabase. Set up the same pipeline as described above, but also measure lots of other object properties, like SizeShape, neighbors, possibly even Texture, which all help the machine learning classifier. Then ExportToDatabase -> sqlite. Set ExportToDatabase to output a properties file. Then in CPA, train the classifier and when you are satisfied, go to the Rules menu and save the rules as a clear text file (no MSWord cruft). Then go back to CP and use FilterObjects module to load the Rules file you saved to apply this more complex filter to your primary objects.

Whew! That’s a lot of steps, but I have had it work. Let me know (via whatever means) if you need more help.