How exactly does QuPath determine cell intensity measurements using the default process

Hi everyone!

I’ve been using QuPath for almost a year now as a research student, looking at refining/developing a purely objective IHC scoring approach using QuPath on gastro-intestinal malignancies that I have produced on TMAs.

In a lot of literature I’ve found in addition to my own learning about pixel classifications, cell detections, ROIs, the whole lot, when it comes down to establishing DAB intensity thresholds, the process seems to be heavily user influenced and established on the visual maps QuPath produces. I’m personally fine with this approach since I don’t have an extensive background or experience in scripting. However, this would make the thresholding a more subjective component, in otherwise, a largely quantitative analysis.

To explain what I mean, here is some workflow:

  • I have done my TMA dearray.

  • Performed the stain deconvolution and have the representative pixel values for each stain (I’m using brightfield DAB/Haematoxylin scans).

  • Furthermore, I have trained my pixel classifier with enough sample annotations to determine my positive tumour areas from negative stroma (includes all areas without any protein expression) and then performed my simplified cell detection step.

Now, I know I can just run the Positive cell detection command, with the Single threshold option unticked, and QuPath will calculate the standard 3 intensity scores every pathologist is familiar with.
Before this, I would need to know what measurement value is going to be the definitive threshold.

I have used DAB OD Mean because my antibody (it is supposed to be a pan-marker for 3 proteins [Tyrosine receptor kinase A,B and C] does, when pathologist and genetically confirmed, demonstrate mostly cytoplasmic and nuclear staining. There are highly defined membranous components in certain samples also. So its localisation is locked.

My main questions are: how does qupath produce this exact selection of thresholds, by itself?

Letting QuPath do this by itself, for example without visually estimating and adjusting the thresholds using the detection maps, how does it place these three threshold levels?
The difference between cut-offs are not exactly even. Are they estimated based on best fit with the histogram data, based on numbers of detections?
Is the answer in the script somewhere?

My other question is: is it more robust to perhaps be using the cell DAB OD st dev measurements instead to determine thresholding? This would be similar to an ELISA assay, a definite cutoff being 3 stdevs away from the mean in each direction…

Any information or advice would be so incredibly appreciated! The software is remarkable and a pleasure to work with for a non-experienced user, so I do want to give the program due respect that it deserves.


I would say that any kind of thresholds should be selected based on the biology/negative controls/a pathologist. There is no right answer because there are no “right” experiments. Using slightly higher antibody concentration on all of your samples would change all of the thresholds, but it would not invalidate the experiment, for example.

As for the specific QuPath question about values, that probably requires digging into the code, but until @petebankhead gets specific…
Loading up a measurement to see what I get:
Checking the values given in the Detection results window:

+1 appears to default to the mean, +2 is mean+1SD, +3 is mean +2SD.

Yes, that’s correct.

The goal was to give sensible defaults even for very different images (e.g. both brightfield and fluorescence, where values can be in totally different scales).

I realise it’s confusing, since one could naturally assume QuPath is doing something more impressive here – and also the thresholds are set only based on the current image, so the statistics of the chosen image will decide what values are chosen (although for a TMA this will at least contain many samples).

I’m quite tempted to just revert to 0.2, 0.4 and 0.6 – even though sometimes that will give quite useless values. Curious as to what others think.

1 Like

I think it would be helpful to essentially state what was quoted in the dialog. Little bit of text at the top or bottom “Default values are the mean, mean+1SD, etc. These values may not be relevant to your experiment.”

Or put it in a hover over pop-up help text thingo.

1 Like

Thank you all so so much for your help!!
The explanation of the default mean +1SD etc rules was exactly what I was hoping to confirm.
I’ve copied over the total detection measurements for all the cores so hopefully I can devise more accurate thresolding criteria applied across all samples, not just the selected image as an estimate.

Thanks again!