StrataQuest Home › StrataQuest Glossary › Threshold & Compare
BOM Group

Threshold & Compare

Pixel-level thresholding and comparison operations

View
Definition
This group performs the basic segmentation step. Compare tests each pixel against one Threshold, the interval versions test against two limits, and Otsu chooses the threshold itself from the histogram. Each returns a maskLoading...: 255 where the test passes, 0 elsewhere. The Threshold operations don't make masks; they replace passing pixels with a Value and leave the rest. (RGB) versions test every channel.
Detection - Automatic Background Threshold params
Video · Primary
Detection - Total Area
Video · Primary
Supporting
Measurements Mask - Cellular
Video · Supporting
Pre processing - Import - Grayscale Image
Video · Supporting
H&EDSPTCH
Video · Supporting
Pre processing - Basic - Virtual Channel
Video · Supporting
Compare: one fixed cutoff
Every pixel tested against Threshold
Otsu's between-class variance
Finds the separating threshold automatically
Two limits: an interval
Inside or outside a band of values
Compare operations for mask logic
Logical operations combine the masks

Operations Reference

OperationSettingsOutput
CompareThreshold (default 0); Compare Mode (default Less)Mask: 255 where the pixel passes the compare, else 0
Compare (RGB)Threshold - Red, - Green, - Blue; Compare ModeMask: 255 only where all three channels pass
Compare - inside intervalThreshold (LL); Threshold (UL); Include interval limits (default No)Mask: 255 where the pixel lies inside the range
Compare - inside interval (RGB)Threshold (LL) and (UL) for each channel; Include interval limitsMask: 255 where all channels lie inside their ranges
Compare - outside intervalThreshold (LL); Threshold (UL); Include interval limits (default No)Mask: 255 where the pixel lies outside the range
Compare - outside interval (RGB)Threshold (LL) and (UL) for each channel; Include interval limitsMask: 255 where all channels lie outside their ranges
OtsunoneMask: 255 where the pixel is greater than the Otsu threshold
Otsu (with range)Lower limit; Upper limitMask, with the Otsu search limited to the range
ThresholdThreshold (default 0); Compare Mode (Less or Greater); ValueGrayscale: passing pixels set to Value, the rest unchanged
Threshold (RGB)Threshold and Value for each channel; Compare ModeColor: the Threshold operation applied to each channel
Threshold - LT, GTThreshold (LT); Value (LT); Threshold (GT); Value (GT)Grayscale: below Threshold (LT) becomes Value (LT), above Threshold (GT) becomes Value (GT), the rest unchanged
Threshold - LT, GT (RGB)The same four settings for each channelColor: the same double threshold per channel

Two names mislead. Threshold doesn't binarize; the reference describes it as capping values, and its output is grayscale, matching the input. And Compare tests an image against numbers, not against another image. The reference's Threshold - LT, GT example makes the capping concrete: with Threshold (LT) 80, Value (LT) 5, Threshold (GT) 100 and Value (GT) 80, pixels below 80 become 5, pixels above 100 become 80, and the rest keep their values.

For one threshold computed from all fields of view, use the Otsu Threshold (global)Loading... engine, which is added in the layer's Pre-Processing. The BOM's Otsu works on the image in front of it.

Source: StrataQuest 8.1 Engines Reference, ch. 6.11 (pp. 310–348); ch. 6.7 (pp. 206–226); ch. 33 (pp. 480–481).

Simplified

A compare is one brightness cutoff: everything that passes becomes white, everything else black. The interval versions keep a band of brightness, or everything outside it. Otsu finds the cutoff by itself. The Threshold operations don't make black-and-white images; they replace too-bright or too-dark values.

Image Processing Foundation

Thresholding is where a continuous grayscale image becomes a discrete decision: foreground or background. It is the most basic segmentation operation, and the method and value chosen shape every result downstream. See foreground and backgroundLoading....

Global Thresholding & Otsu's Method

A global threshold applies a single value T to the whole image. It works when the histogramLoading... is bimodal, with foreground and background pixels forming two separable peaks. Otsu's method formalizes that: in the textbook form it picks the threshold that maximizes the between-class variance σ2B = ω0ω1(μ0 − μ1)2, where ω0 and ω1 are the class probabilities and μ0 and μ1 the class means. The reference states the same criterion as minimizing intra-class variance or maximizing inter-class variance.

The reference states the limits. Otsu works well when the histogram has two peaks and a deep valley. It degrades when the object area is small compared with the background, when the class variances are large compared with the difference of the means, or when noise or shading fills the valley. Its remedy is to restrict the range of values the algorithm uses, which is exactly what Otsu (with range) does.

Adaptive Thresholding

In image processing generally, adaptive thresholding sets a different cutoff at each pixel from its neighborhood, typically the local mean plus an offset, so the cutoff follows uneven illumination. StrataQuest has no adaptive threshold operation. The idea can be assembled from documented operations: an Average filterLoading... with a large Kernel radius (px) estimates the local mean, Subtract images takes it away from the original, and Compare with Greater tests the difference against an offset. The window size is the trade-off: too small and the cutoff follows individual nuclei, too large and it stops adapting.

Multi-Level & Hysteresis Thresholding

Multi-level Otsu, in general, extends the method to more than two classes by choosing several thresholds; the BOM's Otsu returns one. Hysteresis thresholding uses a low and a high threshold: pixels above the high one are foreground, and pixels between the two count only if they connect to a definite foreground pixel. StrataQuest uses hysteresis inside its Canny edge detectorLoading.... There is no general hysteresis operation, and per-pixel compares can't supply the connectivity step.

Compare Operations as Boolean Algebra

Binary masks are sets of pixels, so combining them is set algebra. StrataQuest's And, Or and Xor work bitwise on pixel values, and on 0-and-255 masks bitwise AND gives the intersection, OR the union and XOR the symmetric difference. Simple compare results build into complex regions this way: (channel A Greater T1) And (channel B Less T2) selects pixels bright in one marker and dim in another, a common step in multiplex immunofluorescenceLoading... analysis. See bitwise logical operationsLoading....

Simplified

Thresholding is the simplest segmentation: pick a brightness cutoff, and everything past it becomes object. Otsu's method finds the cutoff automatically from the shape of the histogram. StrataQuest has no cutoff that adjusts across the image by itself, but you can build one from a blur, a subtraction and a compare. Logical operations combine masks with AND, OR and XOR.

When to Use Which

Compare

Use it when staining and illumination are even across the image and you know the cutoff. Check the histogram: two well-separated peaks with a clear valley mean a cutoff in the valley works. The reference's example passes every pixel Greater than 45 in a combined Hematoxylin and Ki67 image from Color SeparationLoading.... For color images, Compare (RGB) applies one test per channel and passes a pixel only if all three pass.

Otsu and Otsu (with range)

Use Otsu when the histogram is bimodal and you want the cutoff chosen for you, image by image. Use Otsu (with range) when noise, shading or a small object fraction would pull the cutoff off; set Lower limit and Upper limit around the region where the valley belongs. Use the Otsu Threshold (global) engine instead when every field of view should share one cutoff.

Interval compares

Use Compare - inside interval for a band of intensities, for example moderately stained pixels, and Compare - outside interval for both tails at once. Set Include interval limits to Yes when a pixel exactly at a limit should pass.

Threshold, Threshold - LT, GT

Use these to cap values before further processing, not to make a mask: for example, pull saturated pixels down to a ceiling so they don't dominate a later average. The result is still a grayscale image.

Comparing two images

No compare takes two images. To mark where channel A is brighter than channel B, take the difference with Subtract images, which subtracts Image 1 from Image 2, then Compare the difference with Greater against a positive value. To mark where either of two masks is set, use Or; where both are, And.

Simplified

Use Compare when lighting is even and you know the cutoff. Use Otsu when the histogram shows two clear peaks, and Otsu (with range) when noise gets in the way. Use the interval compares for a band of brightness, and the Threshold operations to cap values without making a mask.

Connected Terms

Share This Term
Term Connections