The image pyramid: Whole-slide images can be enormous — 40,000 × 30,000 pixels or more. Processing this at full resolution for tissue detection would be wasteful since we only need to find the coarse boundary between tissue and glass. Image pyramids solve this by storing the same image at multiple resolutions. The lowest level might be 1/64th the original dimensions, reducing a billion-pixel image to a few hundred thousand pixels — fast enough for instant analysis.
Why Otsu works here: Tissue detection is a near-ideal use case for Otsu's method. The histogram is strongly bimodal — glass background forms one sharp peak (bright), tissue forms another (darker). The valley between them is deep and clean. Otsu's algorithm tries every possible threshold, picks the one that makes the two groups internally most uniform, and this reliably falls in the valley between the peaks. This is one of the few situations where global thresholding works almost perfectly.
Connected components: After thresholding, the binary mask may contain multiple disconnected tissue regions (tissue sections, TMA cores, fragments). Connected component labeling identifies each separate region — the algorithm iteratively grows from a seed pixel within each region, constrained to stay within the thresholded area, until all pixels in that region are labeled. Each connected component becomes a potential analysis region.
The inflation step matters: Cells at the tissue edge often have only partial nuclear staining or sit right at the tissue-glass boundary. Without inflation, these edge cells may fall outside the detected tissue region and be excluded from analysis. The inflation parameter (typically 5-20 pixels at preview resolution) adds a buffer zone. This is related to Howard's brick rule in stereology — partial objects at boundaries need systematic inclusion or exclusion rules to avoid counting bias.
Whole-slide images are huge, so tissue detection works on a small preview image (like looking at a thumbnail). The intensity histogram has two clear peaks — bright glass and darker tissue — making it easy for Otsu's method to find the dividing line. The detected boundary is expanded slightly outward so cells at the tissue edge aren't accidentally excluded from analysis.