QuPath tutorial: train a pixel classifier for segmentation

Learn QuPath pixel classification with polyline annotations, multi-image training and size filters, then turn predicted tumor regions into objects.

Player not loading? Watch on YouTube

This QuPath tutorial follows pixel classification through to segmentation of tumor regions in biological images. The presenters explain how grouping pixels into objects makes it possible to measure shape, location and intensity. They compare manual outlines and thresholds with trained classification, then discuss when clustering may help explore unfamiliar phenotypes.

The practical workflow starts with polyline annotations for tumor and ignore classes. The instructor recommends small examples across varied regions, especially boundaries, rather than a large brush annotation over one patch. Training requires at least one example in each of two classes. Live Prediction helps reveal mistakes that users can correct with further annotations.

Channel selection, resolution and Gaussian, Laplacian and gradient magnitude filters affect the result. Higher resolution adds detail but can slow processing and produce unwanted outlines. The session also demonstrates loading training from multiple images and checking class balance. The presenters stress that a classifier follows its labels; biological interpretation still requires expertise.

The final steps cover saving the classifier as JSON, backing up the project with its training annotations, creating objects within a selected tissue region and removing small artifacts with size filters. A brief ChatGPT discussion cautions against relying on it for QuPath-specific scripts, while suggesting standard file operations as a more suitable use.