StrataQuest Home › StrataQuest Glossary › Assign Classes to Objects
Measurement Engine

Assign Classes to Objects

Labeling detected events by their classifier or proximity zone

View
Definition
Suppose you've detected nuclei, and a class map marks every pixel of the section with a class id: tumor 1, stroma 2, say. Assign classes to objects finds the class each nucleus sits in. For each event detected in the layer, it records the id of the class or proximity area under the event, as a measurement. Its one parameter is the Class map.
A lookup, not a rule
Each event takes the id beneath it
One parameter: Class map
A grayscale image of class ids
Two kinds of map
Classifier classes or proximity bands
Counting by histogram
Gate each class value

How It Works

Suppose a colon section in which you've detected nuclei, and separately detected glands or trained a ClassifierLoading... to mark tumor and stroma. Each gives you a picture of regions. What you want is a number on each nucleus saying which region it belongs to. Assign classes to objects supplies that number.

You set one parameter, Class map: a grayscale image in which every pixel holds the id of its class. The engine is a measurements engine, so the events it labels are the ones detected in the current layerLoading...'s Detection section. Each event receives the class id of the place where it is located. You'll find it under the layer's Measurements, Add Measurements (Advanced), Assign classes to objects.

The reference names two sources for the class map. The Classifier's Measurements Gray Map gives the first class the value 1, the second the value 2, and so on. Proximity AreasLoading... can output its distance bands as a Gray image, the form meant for measurements. In the reference example, a brightfield colon image with detected nuclei and glands, View Event Data shows each nucleus carrying the id of the gland it lies in.

The output is a number per event, not a named label or an overlay color. A histogramLoading... of that number counts objects per class or area, and a gateLoading... on one value selects them. The reference doesn't say which id an event receives when it straddles two classes.

Source: StrataQuest 8.1 Engines Reference, ch. 4 (pp. 12–14), ch. 8 (p. 375), ch. 36 (pp. 500–501), ch. 20 (p. 428); User Manual (pp. 154, 199, 209).

Simplified

Take a map in which every pixel carries a region number: tumor 1, stroma 2. The engine reads the number under each detected cell and records it. Afterward every cell carries the number of the region it sits in, and you can count cells per region.

Science Behind It

Context as a measurement. In image analysis generally, a cell's location is information in its own right. A lymphocyte in stroma and one inside a tumor nest are different observations, even with identical marker intensities. Handing a region's label to the objects inside it is the image-analysis cousin of the "point in polygon" join used in mapping software. Once the region id is a measurement like any other, every tool that works on measurements can use it.

Two levels of classification. Tissue-level and cell-level questions are often answered by different methods. The ClassifierLoading... classifies blocks of pixels, which suits textured regions such as stroma and necrosis. Cell types are decided per object, by gates on measurements or by the separate AI Objects Classification engine. Assign classes to objects is the bridge: it lets a cell population be split by tissue context.

Neighbors that answer related questions. Standard MeasurementsLoading... (global) can do a similar job: with the class gray map as Shades, its Most Frequent Intensity gives each nucleus the class covering most of it. Events Count Inside Master Events runs the other way, giving each large structure a count of the events inside it. Relations between two cells, such as Phenotype InteractionsLoading..., are a separate engine; this one relates cells to regions.

A caution. The id is only as good as the map. In general, region borders drawn by a block classifier are approximate, so the cells near a border are the ones most likely to land on the wrong side.

Simplified

Where a cell sits is part of its description: a T cell in a tumor and one in the stroma are different observations. This engine turns "where" into a number on each cell, so cells can be sorted by tissue region as easily as by brightness.

Practical Example

Here is how cells could be counted per tissue compartment in a stained section.

  1. Train a ClassifierLoading... in the layer's Pre-Processing with classes such as tumor, stroma and necrosis.
  2. Detect nuclei in the same layer with NucleiLoading... detection.
  3. Add Assign classes to objects and set Class map to the classifier's Measurements Gray Map.
  4. Add a histogram of the class measurement and draw a gate on each class value.
  5. For each class, add a layer that imports the nuclei through that gate and sets detection to Existing Coded, then measure markers there.

The Classifier's "Add class quantification layers" quick action builds steps 2 to 5 for you; it adds nuclei detection only if none is set. Proximity Areas has a matching "Add Proximity areas quantification layers" action that does the same with distance bands, such as the 20 µm bands of the reference's lymph node example.

Simplified

Train a classifier to color tumor and stroma, find the nuclei, then let this engine stamp each nucleus with its region number. A histogram of that number tells you how many nuclei sit in each region. A quick action can set the whole chain up.

Connected Terms

Share This Term
Term Connections