Counting within a ROI

Hi all,

New to Qupath. I looked into other topics but I cant seem to figure out how to get it working.

Im working with H&E stains. I would like to count different types of cells manually within a pre-defined area size. I made an annotation of the preferred size and duplicated it 10 times. With the counter I counted the different kind of cells. However, I can’t get the count per annotation. I read that I need to convert my counter annotations to get it working but I cant seem to get it working. Also, there is a script available Cell summary measurements to annotation.groovy . However, it gives me an error so I cant run it.

all help is appreciated,



Measure -> Export measurements then change the export type to annotations. This will export counts per annotation. It is useful to rename your annotations in the image by right clicking annotation -> properties and changing the name so you are able to distinguish in the analysis.

I am assuming you used the Points objects to manually annotate the cells within each annotation? Those need to be split in order to generate counts per annotation. I recommend this thread:

I will also point out that the script you linked is for v0.1.2, so unless you are using that version, you should expect errors. It also counts cells, so will not do you much good if you created Points annotations.

In the end I just had them as annotations with the same class and for each kind of cell I named them according to their parent annotation ROI and set the hierarchy. It’s quite messy in my annotation window because Im looking at 4 different kind of cells in 10 ROI and because of that I have 50 annotations. I read the thread you recommended and that’s exactly what i’m looking for. However, the script gives an error when I run it.

Sounds good. As stated, the script worked for 0.1.2 so if you were not using that version of QuPath, you should expect errors or to need to modify the script.

I have just updated the post in case anyone else finds it useful.