CD3 and CD8 T cells count pipelin e



I need help to construct a pipeline that enable me to count the positive CD8 and CD3 stained cells. i very new here so not sure how to construct a pipeline.

Hope anybody can help here.


Be a histology hero with CellProfiler

Hello there,
Can you please tell us a bit more which cells are in which colors?
I guess both CD8+ and CD3+ cells are stained brown here, am I correct?
Would you like to count them in relative to total number of cells per image
or you only need the absolute count of CD8+ & CD3+ in this image?


Hello thanks for your reply

Yes those brown colour stained cells are the cells I want to count

I need absolute number of brown colour stained only

Thanks again



Those cells stained with brown is the one I want to count
I only want absolute number of brown colour cells
Is that possible to do ?


Yes it’s theoretically possible.

You first need to convert the image from color to gray

Then invert the result from “dark cells on bright background” to “bright cells on dark background”

Then you may try to identify the objects of interest.

Here I only demonstrate the proof of concept,

You may try to fine-tune the parameters in “IdentifyPrimaryObjects” to get better result.

The crowded area in the center is very difficult to distinguish single cells even by eyes though.


Dear Minh :slight_smile:

I’m a rookie here.

I tried to analysis the figure which stained CD3+ cells following the pipeline.

As figures show you ,highly CD3+ cells expressed region the pipeline cannot distinguish single cells.

How can I do it better.

The second question is how to count CD3+ cells density (cells/mm2)?
This Figure pixels (4032 x 3024)

Kindly for your help.

Thank you.



Hello there,
Nice try though.
Can you please upload your pipeline and a few example images (original images), so that we can try to tune it?



While we’re waiting for you to post a pipeline, as for your second question-

The second question is how to count CD3+ cells density (cells/mm2)?
This Figure pixels (4032 x 3024)

You’ll need to figure out the pixel size of your camera + objective combo- you can usually find camera specs online, or to be safe you can measure it on your microscope with a calibration tool. Once you know how many mm^2 are in one of your images, you could use the CalculateMath module to divide the object count (which will be something like Image->Count->Cells) by the number of mm^2 in the image to get your cell density.


Thanks for your prompt reply.

Here are pipeline and 3 original image.

pipeline.cpproj (407.2 KB)

Resolution: 4032 x 3024
Objective: 20X/0.22mm

Sincerely, HungJu123


We can’t determine the resolution just from that, sorry- there are specifics to how your microscope is set up and to the make/model of your camera that you’ll need to know. Talk to whoever runs/maintains your microscope to get that information.


And I highly suggest that you use the UnmixColors module as a first step for the decent color deconvolution (instead of ColorToGray) for almost any classically stained histology images! That’s what it was designed for :wink:


Hello there,

I followed David’s advice to unmix the color and identify cells accordingly. However please note that many cells are overlapped on the top of each other, it’s difficult to make precise segmentation. So here in my demo pipeline, it’s only a rough estimation.

Regarding cell density, we can try a quick trick that: divide your image 4032 x 3024 into 32x24 grid, each tile of the grid sized 126 x 126 pixel.
Then you do relate object between the cells and the tile (tile is parent, cells are children), then count how many cells per (126 x 126) square.

As Beth already pointed out, if you want precise cell/mm2, you need to know how big is 1 pixel in mm, then simply convert 126 x 126 pixels into mm.
pipeline_2.cpproj (641.8 KB)

Hope that helps


According to the pipeline you suggested, and followed the link.

I modified the pipeline as below.

pipeline_3.cpproj (93.9 KB)

Thanks for your help and suggestions. :grinning: