Identifying Objects from Imported Outlines

I have a program that exports an image of multiple cell nuclei with each nuclei enclosed by a red outline. I would like to import this image into Cell Profiler and then identify each of these nuclei as an object according to the red outlines.

Currently, I use EnhanceEdges to amplify the red outlines, ApplyThreshold to extract rough white outlines from that, EnhanceEdges again to make the outlines clearer, and then ApplyThreshold to create a binary image where the outlines of the nuclei are white and everything else is black. My question is, is there any way to make the regions enclosed by these outlines all white (fill them in), so that image may then be used as a binary mask in IdentifyPrimaryObjects?

Or, is there any better way to use the original red outlines to define objects? Any help is appreciated.

If it helps, here is what the threshold image looks like (obtained from ApplyThreshold). I want to use this to identify objects in the original image.


As a binary, this example tif you provided will be very hard to segment. Many of the boundaries are not complete, and you can try and use the module Morph > Close with them. This will help, but the opposite is true as well – some boundaries that appear to be distinct to my eye, at a large spatial scale at least, actually touch in the binary, complicating the matter immensely.

A better way to do it is to keep the object identities intact by keeping away from binaries, otherwise known as a label matrix. (e.g. … d-regions/). Better still, just do all the processing in CellProfiler and you won’t need to think about ‘label matrices’ and ‘connected components’, etc, since the processing will all be done under-the-hood! (Only somewhat kidding, as you may have good reason to use another program).

If you like, let us know what your raw input is and maybe CellProfiler can provide a more complete solution for you.


Thanks for the reply David. This binary method did appear to be heading towards a dead end, so I appreciate the input. This is the original image I put into CellProfiler:

The objects I am interested in have very thin red outlines. Is there an “easy” way for CellProfiler to identify these objects based on the outlines? Or, based on what you said about the outlines being incomplete, would I be better off omitting the outlines altogether?

Is there something special about the red lines? Or are you simply trying to identify the purplish cells beneath them? I guess what I’m asking is, is there some other set of information that defines the red lines that you have not provided here?

If not, how does this pipeline look? It does this:
(1) Reads in the red.png file (with the red lines unfortunately, but better if they were raw images)
(2) UnmixColors deconvolves color histological images. ** I chose a particular “Stain” but you should choose whatever stain this is, or works!
(3) IdentifyPrimaryObjects identifies objects that appear similar to your red line boundaries. I tweaked it a little, but you should do more.

Does that work for you, i.e. the same info that your red lines are intended for? I’m not trying to force feed CellProfiler down your throat, but it is simply a lot easier to deal with a single image processing software.

DLproj.cppipe (5.5 KB)

Your pipeline works very well for what I need to do. I will experiment with some of the module parameters and use some other pictures, and see how it does. This will require some more thinking on my part. I appreciate all of your help.