After completing this lesson, learners should be able to:
Understand how objects in images are represented as a label mask image.
Apply connected component labeling to a binary image to create a label mask image.
Motivation
A main task of bioimage analysis is to detect objects in images. To do so one needs to be able to label pixels that are part of the same object in a way that this can be efficiently stored and processed by the computer. A prevalent way of doing this is connected component labeling, which is discussed in this module.
Concept map
graph TD
BI("Binary image") -->|input|CC("Connected component analysis")
C("Connectivity") -->|parameter|CC
OD("Output data type") -->|parameter|CC
CC -->|output|LI("Label image")
LI -->|display with|MCL("Multi color LUT")
LI -->|content|PV("Integer pixel values")
PV --> BG("0: Background")
PV --> R1("1: Region 1")
PV --> R2("2: Region 2")
PV --> R3("...")
Figure
Connected components
A typical workflow is to first categorise an image into background and foreground regions, which can be represented as a binary image. If there are more than one object of interest, cluster of pixels which are spatially connected to each other can be assigned a same pixel value. Such clusters in the segmented image can be called as connected components. The relation between two or more pixels is described by its connectivity. The next step is a connected components labeling, where spatially connected regions of foreground pixels are assigned (labeled) as being part of one region (object).
Connectivity
In an image, pixels are ordered in a squared configuration. For performing a connected component analysis,
it is important to define which pixels are considered direct neighbors of a pixel. This is called connectivity and defines which
pixels are considered connected to each other. Unfortunately, there is not only one way to define connectivity. Depending upon the inclusion of corner pixels,
one can have a 4 or 8–connectivity in 2D and a 6 or 26-connectivity in 3D respectively. The chosen connectivity
type may affect the object size.