Automatic cell counting instead of using pointer tool

Dear qupath users, I am new to this program and I am wondering if there is a way to preform automatic cell counting instead of using the pointer tool. There are three different cell types with a different gradation in coloring. Might it be possible to use pixel classifier for this purpose?

If there were always empty space between cells, I would say you would have a good chance with the pixel classifier, and especially with the Annotation Boundaries options…
But with many of the cells touching, and in some cases the staining getting much darker, much lighter, or with no change in intensity at all, I think you will have a tough time without an actual deep learning model. I could be wrong, but I don’t think the pixel classifier can both handle the amount of fine detail you would need to find the borders and the context you would need to identify the whole cell pixels.

If you have a lot of samples, feel free to try and let me know how it goes, but you may want to reconsider your staining strategy if you want to automate in QuPath. @petebankhead might have something better, but I’m not seeing it right now.

Is the image a whole slide image, or something smaller from a microscope?

If they are not whole slide images, QuPath could still be a good choice - but you might also find other software works as well or better.

For example, it looks like a case where QuPath’s pixel classification could be a good starting point, but there might also be other ways through ImageJ/Cell Profiler (e.g. using ImageJ’s Find Maxima command, after applying some initial smoothing).

It would be good to outline a bit more about the overall aim, the kind of images involved and their variation, the outputs required (just counts or also areas or intensities?), and the numbers of images (e.g. to help identify if the solution needs to be fully-automated, or if it can use a combination of automated and manual steps).

So might others, not just me! I’m always happy to see more people make suggestions for how to use QuPath - it can really benefit from having different opinions :slight_smile:

Had a good experience with QuPath and whole slide images (.mrxs; HE stained breast cancer slides). I think this could work if you choose the right channel of color deconvolution for each cell type and use the WaterShedCellDetection Method. If that caught your interest:

You should check out:

Here you can find Groovy Scripts which allow you to run Whole slide image cell detection (WhatershedCellDetection).

You can actually export CSV files with the detections and selectablke characteristics. Works reasonably well for HE Stained whole slides (Color Deconvolution for filtering)

To run Groovy scripts you have to first write them and then (with an open project and your images in it) run them f or the whole project through one of the Drop down menus in the opening Window…

More and extended Info at:

Environment Setup with IntelliJ (Code Compeltion so you can browse through Methods) + Examples


Indeed, it is a whole slide image but only ‘good’ zones need to be analysed. There are 350 images to be analyzed in the format .czi. SDH assays were preformed on mouses of different aging testing quorum sensing peptides. So the purpose would be to count three different intensities Light colored cells, Dark colored cells and colored in between. If I were to use pixel classification how would I best initiate this?

1 Like

Are your cell types (either obviously or expected) different sizes on average?