Machine Learning Engine

Classifier

Draw examples, and it labels every block of pixels

View
Definition
Some regions are easier to recognize than to describe. Stroma has a texture; necrosis has a look. The Classifier learns such regions from examples. You draw annotations over areas of each class, the engine computes features for small blocks of pixels, and a trained model assigns every block in the image to a class. It classifies blocks of pixels, not cells; per-cell classes come from other engines downstream.
Pre processing - Import - Coded Image
Video · Primary
Supporting
Guided workflow - nucl and cell measurements
Video · Supporting
Pre processing - Advanced - Phenotype Interaction
Video · Supporting
Diagrams - t-SNE UMAP SONG V2
Video · Supporting
User Interface - Raw Data
Video · Supporting
TQ to SQ workflow
Video · Supporting
Supervised, from drawn areas
Annotations are the training data
Five classifier types
Random forest is the default
Blocks, not cells
Object diameter sets the block size
Texture, per block
Haralick features among five measurement sets

How It Works

Take an H&E section with tumor nests, stroma and patches of necrosis. You can see the difference at a glance, but no single threshold on one stain separates them. The Classifier learns the difference from examples you draw, then labels the whole image.

  1. Classes. In the Classifier main window, add a class, name it and assign a color. Annotation settings (Opacity, Thickness, Close shape, Fill Shape, Fill Alpha) control how your drawings look.
  2. Annotations. Click Start drawing, draw over areas that belong to the current class, and click Apply. Start erasing removes mistakes, and double-clicking an annotation in the list centers the image on it for checking.
  3. Features. The engine treats the image as blocks of pixels (Object diameter, default 9 × 9) and computes the selected features for each block.
  4. Training. A supervised learning step finds how the annotated blocks of each class differ, and produces a trained model that can classify new data.
  5. Output. Every block is assigned to a class. Each pixel is overlaid with its class color, and the engine also generates a binary mask for each class.

The Classifier sits in the layer's Pre-Processing section (Add, Operations (Advanced), Classifier), so its output feeds the rest of the layer. It classifies regions, not cells. To give each cell a class, measure the class map under each nucleus with Standard MeasurementsLoading... (global) and its Most Frequent Intensity, or use Assign classes to objectsLoading.... To classify cells by their own appearance, the separate AI Objects Classification engine applies an object model trained in the StrataQuest AI Center.

Simplified

You draw over a few examples of each tissue type. The engine measures small squares of pixels inside your drawings and learns what makes each type different. Then it labels every square in the image and colors the map by type.

Science Behind It

What the engine works on. Each block of pixels becomes a list of numbers, its features, and classification happens on those numbers, not on the picture. Intensity, Histogram and Percentile features describe the gray levels in the block. HuMoments are, in the textbook form Hu described in 1962, combinations of image moments that stay the same when a shape is moved, scaled or rotated. Haralick features describe texture from the gray-level co-occurrence matrix: how often pairs of gray levels occur side by side.

Filtered images and sizes add context. A block's own pixels say little about the structure it belongs to. That is why features can also be computed on processed versions of the image (Morpho, Average, Gauss, Median), which tie in to morphological operationsLoading... and smoothing filters such as the Gauss filterLoading.... Selected Sizes add proximity areas around each observation, which the reference describes as contextual information. In image processing generally, a stack of filtered images at several scales is a standard way to give a pixel classifier a view of its surroundings.

More features are not always better. In machine learning generally, adding features to a small training set can lower accuracy on new data, because the model fits quirks of the examples. Use Reduced Feature Selection identifies the relevant features during training and computes only those when classifying, which also saves time. The Basic profile is a minimum selection optimized for speed, Advanced is balanced, and All selects every feature.

Annotations determine the outcome. A supervised model can only learn the variation it is shown, and the reference requires a list of classes that covers the variability in your data. In practice that means annotating each class across several regions and slides, including its awkward cases. The reference describes no accuracy score or cross-validation, so checking the map on areas you didn't annotate is your job.

Simplified

The engine turns each square of pixels into a list of numbers: brightness, how the brightness is spread, shape and texture. It learns which numbers tell your classes apart. It can only learn what your drawings show it, so annotate each class in several places, including the hard cases.

Parameters & Settings

ParameterDefaultDescription
ClassesAdd new class, Remove selected class, and Edit. Each class has a name, a color and annotation settings (Opacity, Thickness, Close shape, Fill Shape, Fill Alpha).
AnnotationsAreas drawn on the image for the current class, managed with Start drawing, Start erasing and Apply.
InputThe images used in classification: original images or images generated by other engines.
Classifier TypeRandom forestRandom forest, K-nearest, Support vector machines, Artificial neural networks or Normal Bayes.
Object diameter (pixels)9 × 9The size of each observation, the block of pixels that is classified.
Smoothing IntensitySmooths the output, to reduce the pixelated look that a large Object diameter produces.
MeasurementsIntensity, Histogram, Percentile, HuMoments (moments invariant to image transformations) and Haralick (texture) features.
ImagesThe images features are computed on: Original, Morpho, Average, Gauss, Median, and Bounding Box (the tile's bounding box, enlarged by the defined sizes, on the original image).
Selected SizesProximity areas around each observation, for contextual information.
Maximum Small SizeThe largest size allowed for some time-consuming measurements.
Use Reduced Feature SelectionIdentifies the relevant features during training; only those are computed when classifying.
ProfilesBasic, Advanced, AllSaved Parameters and Features settings. Save Profile adds your own.

A workable start is Random forest with the Advanced profile, moving to Basic if training is slow. The classifier's own map is not restricted to the ROI. To restrict results to a region of interestLoading..., measure each class in its own layer with Total AreaLoading..., whose detection drops anything outside the ROI.

Source: StrataQuest 8.1 Engines Reference, ch. 7 (Classifier, pp. 366–374), ch. 8 (pp. 374–378), ch. 3 (pp. 8–11), ch. 4 (p. 12); User Manual (pp. 58, 154).

Simplified

Name your classes and draw examples, pick a classifier type (Random forest is the default), and set the block size (9 × 9 pixels by default). Ready-made profiles choose the features for you: Basic for speed, Advanced for balance, All for everything.

Practical Example

Here is how tumor and stroma could be quantified separately in an IHC or H&E section.

  1. In a layer's Pre-Processing, add the Classifier with classes tumor, stroma and necrosis, and annotate each in several regions.
  2. Choose Random forest and the Advanced profile, then train.
  3. Check the class map against areas you didn't annotate, add annotations where it errs, and train again.
  4. For cell counts per class, use the Classifier's "Add class quantification layers" quick action. It adds nuclei detection if none is set, an Assign objects to classesLoading... engine on the class map, a histogramLoading... with a gateLoading... for each class, and a layer per class.
  5. For the area of each class, "Add class area quantification layers" imports each class mask into its own layer and measures it with Total Area and Standard Measurements.

The two routes answer different questions. The first measures how many cells, and of which kind, sit in tumor versus stroma. The second measures how much of the section each compartment occupies, which is the denominator for densities.

Simplified

Draw examples of tumor, stroma and necrosis, train, and check the map on areas you didn't draw. A quick action then sets up layers that count the cells in each tissue type, and another measures each type's area.

Share This Term
Term Connections