Qupath Classification Tutorial

Use QuPath to classify detections with different types of classifiers.

Qupath classification

Optional: you have more than one channel to classify objects on
If you have more than one channel to use, meaning that you want to classify objects (same or different) based on features on different channels, then it is a good idea to create a copy of the image you are analyzing (classifyin objects on multiple channels gets very confusing very fast). We can classify on multiple channels later on when we pool together the classifiers.

Create classes for the objects

Create classes for each class you want to classify (for example Fiber type 1, Dying cell, GFP-positive etc..)


Single measurement classifier up to 2 classes

If you want to classify objects based on a single measurements (for example mean intensity or area size per object) you can simple use the Classify -> Object classification -> Create single measurement classifier Menu.


Within this window I am using the Mean EGFP intensity to define GFP-positive and GFP-negative objects. Using the Live preview tickbox you can see the objects updating live into the 2 categories.

If it’s too hard to distinguish the classes because of their colors, you can change their appearance by double-clicking in the color box of the class you want to change!

Single measurement up to 3 classes

Using Classify -> Object classification -> Cell Intensity Classification you can classify objects using 3 threshold for any measurement.


This doesn’t create classes directly, but you can have the number of objects per class clicking in the large annotation that contains the detections.


Checkout Qupath own tutorial to find more info.

Train a classifier using several features

Through the Classify -> Object classification -> Train object classifier Menu, you can train Qupath to detect any class using any number of features based on any number of channels.


Here, for example, I selected only the features relative to the DAPI channel in the Select button of the Features. Random Trees is a type of machine learning classifier similar to what Labkit or Ilastik use as well, for more info on these methods checkout out the documentation. I gave it a descriptive name at the bottom. In order to train the classifier, we need to have some objects in all classes we want to create a classifier for. For example if I just want to distinguish alive and dead cells, I need to manually select a few objects or areas in the “alive cells” class and a few in the “dead cells” class. You can do this by creating manual annotations of any shape, I reccomend the brush tool to “brush” over the objects for each class. Once you have an annotation you can press the Set Class button for the corresponding class. Once you have create a classifier, it will remain in the project and you can load it back in for any other image trough the Classify -> Object classification -> Load object classifier Menu.

Create a composite classifier

Once you have defined many classifier (probably based on few features on single channels), you can create a compositve classifier in Classify -> Object classification -> Create composite classifier Menu.


Here I have a bunch of classifier I created, I can select any number of them and add them to the Selected box on the right using the “>” button. Again give it a descriptive name and save the classifier. Now you will have objects that are classified for any number of classes contained in the composite classifier. For example you could have:

dead/alive GFP positivity
dead cells GFP-positive
dead cells GFP-negative
alive cells GFP-positive
alive cells GFP-negative

Extract information from classified objects

Once you have objects classified into classes you can now extract their information easily. First of all by clicking into the Annotation that contains your objects you can immediately see the number of objects per class:


But of course you still have all the calculated features/properties for each object from before (intensity, area etc..). To see this information better click on Measure -> Show detection measurements Menu.


A big table with all the information will pop up! Simply press the Save button to save it outside as a .txt file and further work on it in the software of your choice, or you can roughly explore the variable you want using the Show Histograms Menu.