Unmixing Colors


I have recently started using CellProfiler so I am having some trouble creating a pipeline that works for my project. I have been trying to create a pipeline that will differentiate between different colored cells using the “UnmixColors” module. It is not a histologically stained image; rather, it contains red, blue, green, yellow, cyan, and magenta stains. I need to be able to track each group of cells individually later on in the pipeline. When I used the custom absorbance values for the stains, it will still identify some of the other colors. For example, the red image will contain some yellow and magenta as well. If there is a way to input a range instead of an absolute value, I think this could help. Also, I was wondering if there is any way of using an .m file to write this code and then incorporating that into the pipeline.

Thank you in advance,

P.S. I have uploaded a sample image.

Hi Andrea,

I have a question about what you are trying to do: It’s not clear to me that the cells are really separable by the RGB and CMY channels that you mention.

For example, in the image attached, in the middle of the image, I see a cluster of (what to me looks like) 3 cells: green, blue and red. Where they overlap, the green and red yield yellow, red and blue yield magenta, and green and blue yield cyan.

When you say that you want to track, say, the magenta-stained cells, are you saying that you want to track either:
(1) A cell that has both red and blue stains, or
(2) A cell that is actually magenta in color?
The reason I ask is that if you say you want (2), I’m not sure how you distinguish this case from (1) if a portion of a red cell happens to overlap a blue cell.

If you want (1), then you could use ColorToGray to split the RGB channels, identify the cells in each channel and then measure the intensity in the additional channels of interest. For example, if you want to identify magenta cells, you could identify the cells in the red channel (IdentifyPrimaryObjects), measure the intensity of the red cells against the blue image (MeasureObjectIntensity), and then identify the magenta cells by filtering the red cells to retain those which have high mean blue intensity (FilterObjects), and identify the red-only cells as those which have a low mean blue intensity (FilterObjects).

Unfortunately, no there is not. However, if you are familiar with ImageJ and know of a plugin which is capable of the unmixing that you want, you could try using the RunImageJ plugin to run it within CellProfiler.


Hi Mark,

Thank you for replying. Ideally, I would like to separate red, blue, green, cyan, yellow, and magenta (so #2). These cells were stained with GFP, Cy3, and Cy5 to get the red, blue, and green. To get the yellow, cyan, and magenta these cells were tagged with two of the stains. I was able to separate all six of the colors using ImageMath by adding, for example, red and green channels and then subtracting them from the blue to give me only the blue cells. Then, I used ImageMath and multiplied the blue and green channels to give my only the cyan cells. This worked well in identifying the colors, but like you said it also identified the parts where there was overlap. Is there a way when using IdentifyPrimaryObjects to get rid of the slivers of overlap? Also, does the older CellProfiler 1.0 work on MATLAB? Would I be able to call a function written on MATLAB using CellProfiler?

Thank you so much,

P.S. I have attached the pipeline that I have used to differentiate the colored cells.
Testing.cp (6.73 KB)