Connected component labeling (CCL): The fundamental algorithm behind coded images comes from image topology. Two foreground pixels belong to the same object if and only if a path of foreground pixels connects them. The classic two-pass algorithm scans the image once to assign provisional labels and record equivalences, then scans again to replace provisional labels with their final equivalents. For an M×N image, this runs in O(M×N) time — linear in the number of pixels.
The connectivity dilemma: Consider two foreground pixels touching only at a diagonal corner. Are they the same object? In 4-connectivity, no — only orthogonal neighbors (up, down, left, right) count. In 8-connectivity, yes — diagonal neighbors also count. Neither answer is universally correct. For nuclear detection, 8-connectivity is typical because nuclei are roughly circular and diagonal adjacency usually indicates the same nucleus. For detecting thin structures like membranes, 4-connectivity may be more appropriate to avoid merging parallel structures.
Why integer labels, not colors? A coded image stores identity, not appearance. Using 32-bit integers allows up to ~4 billion unique labels per image — far more than enough for any tissue section. The integer representation enables direct lookup: "give me all measurements for object #47" is a simple equality test on the coded image. Colors would require collision-free color assignment and lossy matching.
From topology to biology: The coded image bridges the gap between "what does the tissue look like" (the fluorescence image) and "what does the tissue contain" (individual cells with measurements). This is conceptually similar to the difference between a photograph of a crowd and a census — both describe the same scene, but the census identifies each individual and tracks their attributes.
Connected component labeling scans the detection result and groups touching pixels together. Each group gets a unique number. The key decision is connectivity: should diagonally-touching pixels count as the same object? For round objects like nuclei, including diagonals (8-connectivity) usually makes sense. The integer labeling system lets the software track up to billions of individual objects per image.