Counting the dots in QUpath

Hi Everyone,

I have been trying to count the inter nuclear dots inside a TMA core using QUpath as it detects Tumour cells and necrotic cells separately, compared to ImageJ. However, I couldn’t come up with a good way to do it.

Your recommendation is highly acceptable.


A picture would be helpful, but I would guess you want the Analyze->Cell analysis->Subcellular detection command. Specifically for spots I would try out split by intensity. There is an example of it’s use here in a post about cytoplasmic measurements, and some of it’s weirder uses are covered in the choose your own adventure guide.
Pete has an example of it’s use here.

That final link also contains a script that you can use to determine if the spots are in the nucleus. Though if you aren’t interested in cytoplasmic spots, one option is to make the cytoplasmic expansion 1 pixel in size. You can’t go zero expansion or the subcellular detection will not work, as the objects will no longer be cells.

Yep, that should be fine as long as that isn’t the original image. You do need accurate metadata to use the subcellular detection tool, so I can’t really do anything with a JPG. But it looks like you might be able to use OD sum (less likely hematoxylin) to find the cells. Unfortunately, you won’t be able to tell which spots are nuclear and which spots are cytoplasmic in the densely DAB stained cells, as the hematoxylin will be completely obscured. Fluorescence is better if you need that kind of accuracy.

I have used analyse- cell analysis.

detect sub cellular particle and came up with the next image

Well, that’s a start, but I’d say your color vectors probably aren’t set quite right, and your threshold is much, much too low.
It might be worth going through the tutorials:

Threshold are adjusted according to the size of the dots but i’ll try some changes. Thanks a lot.

The threshold should be the intensity of the stain, not the size of the dots. The size stuff is generally less important except if you want to threshold out very small objects.

I have set the DAB (detection threshold) as 0.1, I will try with other parameters. As we are only interested in DOTS that are within nucleus. Still have the same result.

Yes, that is very, very low. You probably want something closer to 0.3-0.5. The detection threshold has nothing to do with size, size is all at the bottom.
And I would remove 99% of the cytoplasmic expansion if you only want nuclear dots. There are other ways, but they are all more complicated and involve scripting. Easier to reduce the cytoplasm unless you need that for something else.

What is the process to remove cytoplasmic expansion- as I think, that will help.

I have used scripts

  1. To classify cells as positive or negative based upon the estimated number of spots: setCellIntensityClassifications(“Subcellular: DAB: Num spots estimated”, 2)
  2. Binning cells according the spot count:
    setCellIntensityClassifications(“Subcellular: DAB: Num spots estimated”, 1, 4, 10)


Cell expansion is covered here in the settings that generate the cells, about halfway down that post.

I am afraid you will have to generate the cells all again (and the subcellular detections after).

Hi Research_Associate

I have tried doing the cell expansion, but couldn’t find out a way to count inter-nucleus dots. Please do help me get through this.

I am not really sure what you are asking, but it would be helpful if you could post at least the exact script you are currently using, and better yet host a full sized image or full resolution sub tiff on Google drive or something similar free host. If you are allowed.

In general, if you only have a nucleus, your total spot count should be the nuclear spot count, and it should be listed near the bottom of the measurements list as the estimated spot count.

This is the original image where i’m trying to count the dots, inside the nucleus.

the way i’m doing this is: 1. analyze-> cell analysis-> cell detection 2. analyze-> cell analysis->subcellular detection with DAB threshold 0.1

then the next picture is obtained

with number of subcellular dots as 22959

to classify the positive dots I’ve used the script- setCellIntensityClassifications(“Subcellular: DAB: Num spots estimated”, 2)

Well, your cell expansion is very clearly not small enough to just include the nucleus. It should be the same as your pixel size from the Image tab. I still see a significant expansion, which you indicated you didn’t want.

Your threshold should also not be 0.1, as that is way too low. For Subcellular detections, you can select a single cell and keep hitting “Run” to find out what threshold you should be using for your image. Keep increasing it until you get what you are expecting. I figure it will be higher than 0.3. Maybe as high as 0.7, depending on your background.

Neither of those is an original image, though, so I can’t really help more than that. I can’t work with a snapshot.

Okay will try the threshold difference as well to see how it goes. Also, the background of the picture also has an effect on the quantification and more the DPI more clear the picture is.