Nuclear and cytoplasmic quantitation



I am a new CellProfiler user and I am very impressed with this software. I have a set of images stained with DAB. The cases show both cytoplasmic and nuclear stain. Is it possible to quantify in the same image the nuclear intensity and the percentage of positive nuclei? I am having trouble generating the pipeline.
Any help and guidance will be very much appreciated



Glad you found CellProfiler. Yes, you can do measure these, with caveats. If you could add a nuclear marker, that would help. The nuclei appear to be a little blue here (is that only DAB, or is there another marker here like Hematoxylin?). I have created a pipeline for you, assuming that:
(1) The nuclei are blue-ish in hue (and of course the cytoplasm are the typical brown DAB stain color)
(2) When you say, “percentage of positive nuclei”, I am assuming you mean “blue-ish nuclei that also stain darkly for brown/DAB”. Please clarify though, because it is not clear to me how you define “all nuclei” and “positive nuclei”.

Side-note: Avoid JPG images because they are a lossy format. Try to save in, say, TIFF or PNG and no information should be lost via compression.

Look at my attached pipeline.

  • UnmixColors is key for histological images. I added DAB, but also guessed at the blue-ish setting by adding our default Hemaoxylin. Feel free to change this to another setting but you need something to segment the nuclei with
  • IdentifyPrimaryObjects: You will need to change the Threshold Correction Factor almost certainly. I changed this from 1 (default) to 2, but this may vary with staining parameters.
  • IdentifySecondary: This seems to miss some brown regions, but that is because I am working under the model of “Define nuclei as small blue regions, and then grow out from those to the brown cytoplasm”. If there is no blue-ish nucleus defined, there will be no brown Cell object.
  • DisplayDataOnImage: This can be disabled (click the checkbox in the pipeline list) and is only to help you get a sense of the threshold applied in ClassifyObjects
  • FilterObjects: This is only useful if you want to process the positive nuclei downstream (disable otherwise)
  • ClassifyObject: This calculates the percentage positive

Hope that helps, and let us know if you need help in case I made some wrong assumptions.

DL_DAB.cppipe (11.9 KB)


Hello David; please find attached file, it is a jpeg ROI from bone marrow stained with DAB stain for nuclear protein. could you please help me as i am a beginner for CP. I have tried your suggested pipeline but either it did not work or even after modifying some parameters, I could n’t get any output results. I am looking to get brown stained nuclei over all nuclei, more additional parameters are also appreciated such as absolute cell density in each tissue section area, large sized cells vs small sized ones (cut off may be lymphocyte size ~8um). also i need out put pseudo colored to verify manually. THANKS IN ADVANCE. Reda Mahfouz, MD, PhD, Cleveland Clinic


Hello Reda,

Have you made progress on this? Sorry for the slow reply – in the interim, we have migrated to a new forum and for whatever reason, your attached image appears quite small. If you would still like help, could you re-attach another image? Thanks!


Hey guys,

I’m new to this forum but I would like to expose a similar problem I’m facing. I’m working with a few yeast mRNA export mutants and I’m trying to measure the levels of a particular transcript in the nuclear and cytoplasmic compartments. Let me start saying that I’m doing this in FIJI not Cellprofiler (I read that CP has a routine to do this analysis but I’m unable to install it in my MacOS 10.14.1 (Mojave), so I will troubleshoot that in the coming days). I have a nuclear staining using DAPI and I also have a collection of primers couple to a fluorophore to detect the transcript of interest. The steps I’m following are:
1-Threshold the contour of cells (these tend to clump so I do watershed and some manual labor to get a good definition if then). Then, I create a mask
2-Analyze particles and define ROIs
3-Use the ROI to assign the measurement of the mean gray value of the transcript channel (this will correspond to nuclear + cytoplasmic signal=total)
4-Using the DAPI channel I generate another mask to define the nucleus of the cells
5-Image calculator -> and subtract the channel where we have the signal of the transcript minus the DAPI mask (nucleus). This results in a new image with a black hole where the nucleus were before
6-Using the assigned ROIs I measure the mean value of the cytoplasmic fraction (nucleus are not present)
7-With the cytoplasmic + the total cell values I can then calculate the ratios of N/C

This methodology I was following is not working. It doesn’t correspond with what I’m seeing by eye (at all). One problem that maybe I think I’m having is that, when I subtract the image with the transcript channel to the DAPI mask I ended up having black pixels where the nucleus were and this ends up skewing the value of the mean in my measurements.
To circumvent this, it will be ideal to be able to assign the same ROIs to masks generated in different channels, so I can calculate the mean of the nucleus (with the nuclear mask) and the total mean of the cell (with the mask of cells), and I don’t really know how to do this. Any help is welcomed!


Hi Pau,

Welcome to the forum.

I’m a little confused about your problem but I think it may be solved by the XOR function in the ROI manager.

Basically, if you have the ROI for your whole selected and the ROI for the nucleus of that cell selected and you select XOR in the “More…” section of your ROI manager you will be left with the difference between the ROIs (like a donut). This should correspond to your cytoplasm and then you should be able to measure. Once you’ve clicked XOR this creates a selection so if you want to add that to your ROI manager to you need to click “Add” or your “t” button.

So once you have this cytoplasm ROI you should be able to measure your transcript channel with it and the resultant value will not include the nuclear area at all (how you are doing it now this pixels will be included and bring down your mean).

Hope that helps? It might be easier to show you if you provide an example image.


Hi Laura,

Thanks for your help! I uploaded an example to help visualize what I’m talking about. In blue: DAPI and RED: the transcript I’m trying to quantify. In this particular example, I’m using a mRNA export mutant where there is an accumulation of the mRNA in the nucleus (Red signal co-localizes with Blue signal to an extent).

I follow your instructions and they are helpful. I can generate a ROI with just the cytoplasmic region using the XOR function. Although this is useful it is also very tedious for my particular problem where I need to analyze a few hundreds of cells in different mutants. Or maybe I’m missing something from your explanation. I think is tedious because once I have the ROIs of the total and the ROI of the nucleus I need to localize them in the ROI manager, generate the new ROI and quantify it. This work of looking for the matching ROIs and measure them for at the end a thousand of cells is going to be very very long and I’m trying to avoid that if possible. I’m sorry if I didn’t clarify that before that I have to measure a few hundreds of cells per mutant (and I have so far 12 different mutants). Let me know if you have any other thought I maybe missed.



Hi Pau,

I understand you have a lot of cells and thus makes this approach unfeasible by hand, this actually means I can introduce one of the best things about ImageJ - it is scriptable! I would encourage you to look into macro writing (here’s a post where @etarena has helpfully provided some links to introductory material to help - Language problem newbie).

I’ve written a little macro below to try and help you for now though. It assumes that you that you have gone through your described method and have ROIs in your manager and that the first half of them contains the cell ROIs and the second half contains nuclei ROIs and that there are an equal number of each and that they are in the same order. It renames the ROIs there accordingly and then creates cytoplasms by using the 1st cell ROI and the 1st nuclei ROI and so on.

So if you go to Plugins > New > Macro.
Copy the below code into the white window, set language to “IJ1 Macro”, and then click run you should be left with ROIs for each cell corresponding to total cell, nuclei and the difference between them (cytoplasm).

count = roiManager("Count");
ncount = (count/2);

for(i=0; i<ncount; i++){
	roiManager("Select", i);
	roiManager("Rename", "Cell_"+(i+1));
	roiManager("Set Color", "blue");

for(j=ncount, k = 1; j < count; j++, k++){
	roiManager("Select", j);

	//Rename nuclei
	roiManager("Rename", "Nuclei_"+(k));
	roiManager("Set Color", "yellow");

for (l = 0, k = ncount; l < ncount; l++, k++){
	roiManager("Select", newArray(l,k));

final = roiManager("Count");

for (m = count, n = 1; m < final; m++, n++){
	roiManager("Select", m);
	roiManager("Rename", "Cyto_"+(n));
	roiManager("Set Color", "cyan");


I hope that makes some sense? I was going to try it on your images but the two you attached seem to be in the same compartments so I wasn’t sure what you were using to segment nuclei and total cell respectively. Maybe you have a thid channel too.

Macros are definitely something worth getting into and I would encourage you to try! You will likely be able to automated your whole analysis pipeline.

It’s possible there might be a way to approach your problem that is more like what you were trying previously but the above is how I would approach it. Maybe others will weigh in if they have other ideas.

Good luck!


Hi Laura,

Thanks a lot! this is so helpful! Definitively, I have to get into scripting, a long standing ‘to do’ in my list. I will look careful at the script and try to make sense out of it.
Thanks again for your time and help!