Contents

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..)

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/370d1ebda1f10a65ad968263264efb94.png

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.

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/fce6d9737b8b0bebccde0769afce8916.png

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.

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/f14b90fbf867f2e5664d49edda7aec0d.png

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.

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/c6fd562c8825378ef86b25b390fdf7ca.png

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.

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/843b0f1db167f45c0ff43edbfe9d599a.png

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.

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/3b525bde2f160326207a03f8d7d884e8.png

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:

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/1f24689e4fe86ca85aab79a296cf16db.png

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.

/mic-photon/image-analysis-hub/post_images/qupath_classification_tutorial/d677cb1a441f8d943a376fbae0e4392e.png

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.