Interactive demo · Statistical Methods for Modern Biology · Chapter 11

Segmenting nuclei: smoothing, adaptive thresholding and morphology

The DNA (DAPI) channel of a field of HCT116 colon cancer cells, 340 × 490 pixels. The pipeline of Holmes and Huber (2019), Sections 11.8 to 11.11, turns it into a list of nuclei in four steps: smooth the image by convolving it with a Gaussian, threshold it (globally, or against a local mean taken over a disc, which is the adaptive threshold), clean the binary image with a morphological operation, and label the connected components. Change any step and watch the count. Switch on the simulated uneven illumination to see why a single global threshold fails and the adaptive one does not.

Uneven illumination

Gaussian smoothing σ (pixels)

Threshold

disc diameter for the local mean (pixels)

offset: keep pixels brighter than local mean + offset

global threshold: keep pixels brighter than

Morphology (disc brush)

size

Right panel shows

Stages

Try these

Exactly as in the book's code: the 16-bit DAPI image is multiplied by 32; smoothing uses a 51 × 51 Gaussian brush and the local mean a disc brush, both normalised to sum 1 and applied with circular (wrap-around) boundaries as filter2 does; erosion ignores brush pixels that fall outside the image; objects are 4-connected. With the book's settings the page finds the 43 nuclei of Figure 11.12, with the same pixel counts as the R code.

In the lecture notes