How to measure tumour positive staining percentage in the extracellular compartment

Hi all,
First of all, I would like to thank Pete @petebankhead very much for creating QuPath, it is amazing!


I am trying to quantify IHC staining + intensity for proteins located in the extracellular compartment in whole scanned sections.

Analysis goals:

Tumour positive staining percentage, stroma positive staining percentage, tumour+stroma positive staining percentage plus stain intensity, and H-score >>> similar to to the data produced by the cell classifier, but extracellularly.


I have tried positive cell detections + cell classifier. I think, QuPath is counting positive cells in the regions of interest (whole section), not measuring the whole area where any signal is observed. This was apparent from the data generated. I have performed some checks by eye on a few random slides, I found that, by focusing on counting positive cells only, most of the staining observed in the stroma architecture, which is extracellular, was missed.

I have also tried: positive cell detections + pixel classifier, however, the results table showed: % of tumour and % of stroma within the section separately from positive %, and negative % , and did not take into account all measurement to produce the tumour positive % and stroma positive % like the data generated using the cell classifier.

I would very much appreciate ideas to achieve my analysis goal please.

Screen Shot 2021-03-18 at 09.23.28

1 Like

I am not really certain what is going wrong or what exactly you would like to improve, could you include some sample images or screenshots demonstrating the problem, and showing what you would like to accomplish?

It is good that you listed what you tried, but I am not sure what is happening for each trial and why they failed. Hard to visualize without a visual :slight_smile:

@Research_Associate Thanks for your reply. Appreciated!

I am trying to quantify the signal for proteins in the extracellular space.
Tissues are IHC stained frozen sections.

I am expecting the signal to be more in the stroma than in the tumour area. However, when I analysed these sections using positive cell detections + cell classifier, I got more positive % staining in the tumour area than in the stroma. Another reason that may be detecting positive cells was not the best way for my analysis, is that I am generally examining proteins located in the extracellular compartment. For example:
In this section, tumour % positive is higher than the stroma % positive. However, from the original scan it appears that not all the signal in the stroma was quantified.

I would like to be able to quantify the signal in tumour area % positive, stroma area % positive, tumour + straoma % positive based on the whole section, not only in positive cells within the tumour/stroma areas.

Many thanks :slight_smile:

It sounds like what you want is a pixel classifier to determine where the tumor and stroma are (or if you are manually annotating, that could be fine too), and then a simple thresholder to find the area that is positive for a particular stain.

First would probably be a thresholder or pixel classifier to generate the tissue outline.
Second, use that tissue outline to create sub-annotations that are either tumor or stroma.
Selecting the tumor and stroma annotations, use a thresholder to find areas that are positive for the DAB staining, either creating them as objects, or directly adding measurements.

@Research_Associate, Many thanks

I have tried the following:
Tissue detection > then I have created thresholder > then applied the thresholder to calculate the stained % area:

After that, I have trained a pixel classifier to identify tumour and stroma areas and to ‘ignore’ whitespace and background:

after applying the pixel classifier, the results table showed % of tumour and % of stroma within the section. it also presented positive staining %, and negative % . But, did not incorporate them to produce the tumour positive % and stroma positive % :

What I was trying to achieve was, % of positive staining in the tumour area, % of positive staining in the stroma area, and not the tumour/stroma % in the whole section.

Many thanks

Right, you need to Create Objects (possibly detections if you have that may split up areas), then select those to run the stain thresholder. You flipped the thresholding and tumor/stroma steps.

Your Hierarchy should be:
Tissue annotation
Tumor/stroma detections - which are run through the stain thresholder to generate measurements.

@Research_Associate, thank you.

I have tried all the above:
Tissue detected > pixel classifier loaded (tumour/stroma detected), then as suggested, I have created objects (detections):

Then, run the DAB stain thresholder to generate measurements:

the results are the same as the previous ones …

I was hoping to get:

Four distinct classifications:

  • Tumor: Positive
  • Tumor: Negative
  • Stroma: Positive
  • Stroma: Negative

Many thanks

From what I can see in the images (and thanks for including them), you are not running the DAB thresholder on the detections. You are running it on the whole image, and so you only get measurements for the whole image.

@Research_Associate, thank you very much for helping me to get through this …

Please see below all options for loading the DAB thresholder:
Everywhere, Any objects, any annotations

Once applied, another box appeared to select the objects:
All detections, current selections, Full image, all annotations

I chave selected all detections

However, the results are the same …

Many thanks

You are looking at the results in the detections? In the final image you are still looking at the whole image measurements.

I am sorry, really confused.
What shall I do ? which option shall I select?
Many thanks

It looks like you selected the right options, you just aren’t looking at the data. If you have nothing selected, you see what was calculated for the whole image. If you select the annotation, you see what was run on the whole annotation. Likewise for the two detections you created.

Alternatively, look in the Measure->Show detection measurements

I looked in the Measure > Show detection measurements:
It is massive data (see below, just a little part of it !)… not only a single line for the two detections created. Is there any way to change this output to a single line presenting a summary to all this data into: Stroma Positive %, Tumour Positive %, Stroma + Tumour Positive % ?

Many thanks

Name Class Parent ROI Centroid X µm Centroid Y µm DAB+: Negative % DAB+: Negative area µm^2 DAB+: Positive % DAB+: Positive area µm^2
Stroma Stroma Image Rectangle 3721.2 3158.2 100 100.2888 0 0
Stroma Stroma Image Rectangle 3721.2 3183 100 50.1444 0 0
Stroma Stroma Image Geometry 3402.4 1645.5 100 2707.7964 0 0
Stroma Stroma Image Rectangle 3402.6 1582.7 100 50.1444 0 0
Stroma Stroma Image Polygon 3376.9 1581.8 100 401.155 0 0
Tumor Tumor Image Rectangle 2081.9 994.92 100 100.2888 0 0
Tumor Tumor Image Polygon 2148.3 1009.1 100 1554.4758 0 0
Tumor Tumor Image Rectangle 2071.3 1044.5 100 50.1444 0 0
Tumor Tumor Image Rectangle 2092.5 1009.1 100 50.1444 0 0

It looks like you did not make two detections, you made many. You should not split your detections if you want to apply a summary measurement to them. The default split value should be off, so it looks like you deliberately chose to split them? Ideally you would only have two detections, one tumor, one stroma. Three objects total, if you count the initial Tissue annotation.

On the other hand, if you want measurements for every single detection, split away. Many projects prefer individual measurements, it depends on your goals.


@Research_Associate, I cannot thank you enough … it worked!

Please see table below:

Name Class Parent ROI Centroid X µm Centroid Y µm DAB+: Negative % DAB+: Negative area µm^2 DAB+: Positive % DAB+: Positive area µm^2
Stroma Stroma Image Geometry 2075.2 4548.6 82.7415 10541953 17.2585 2198881.25
Tumor Tumor Image Geometry 2012.7 4006.5 99.8415 3253467.75 0.1585 5164.8711

I am really grateful, your help is greatly appreciated!
Many thanks,