Quiz: splitting touching objects with the distance transform

Short questions to test your understanding. Try each on paper first, then open the answer. \mathrm{DT} = distance to the nearest background pixel; the watershed floods -\mathrm{DT} inside the mask from the h-maxima of \mathrm{DT}.


Q1. Why does the distance transform split two touching nuclei when the gradient cannot?

What does each landscape look at: intensity or shape?

The gradient looks at intensity changes, and between two touching nuclei of equal brightness there are none. The distance transform looks at the shape of the mask: the union of two round objects is widest at their centres and narrow at the neck, so the DT has two peaks with a saddle between them, and the watershed cuts at the saddle.


Q2. Two discs of radius 10 have centres 12 apart. What is the neck depth? Are they split with h = 1.5? With h = 2.5?

Neck \sqrt{r^2 - d^2/4}.

Neck \sqrt{100 - 36} = 8, depth 10 - 8 = 2. Split with h = 1.5 (2 > 1.5), merged with h = 2.5.


Q3. Why does an elongated cell get cut into several pieces when h = 0?

Look at the ridge of its DT.

Its DT has a long, almost flat ridge along the major axis; the pixel grid (or a slightly rough outline) puts small bumps on it, and each bump is a regional maximum, hence a marker. A small h (a fraction of a pixel to about one pixel) removes the bumps but keeps real necks.


Q4. Your thresholded nuclei have small holes. What happens, and what is the fix?

What is the DT next to a hole?

The DT is 0 in the hole and small around it, so the nucleus’ single peak breaks up into several peaks around the hole: false splits. Fill holes in the mask before the distance transform.


Q5. Why is the chessboard metric a bad choice for splitting round objects?

How far is the outline of a disc from its centre in chessboard distance?

Chessboard distance reaches the outline fastest along the diagonals, so the peak of a disc is only about r/\sqrt2, while the neck between two discs (measured straight across) can be as high. The neck is then not lower than the peaks and the discs are not split (for r = 30, not before d \approx 42). Use chamfer 3-4 or Euclidean, which are nearly the same in all directions.


Q6. In a marker-controlled watershed for nuclei, which image would you use for the markers and which for the flooding?

Shape for “how many”, intensity for “where”.

Markers from the h-maxima of the distance transform of the mask (one per round object, independent of brightness). Flooding on the gradient of the smoothed intensity, restricted to the mask, so that the boundaries between touching nuclei follow faint edges where there are any. Without useful edges, flood -\mathrm{DT}.


Q7. Labelling a thresholded image gives 9 objects; the watershed of -\mathrm{DT} gives 15 with h = 2 and 18 with h = 0. What do the differences mean?

9 is the number of connected components.

9 components: touching nuclei are merged. 15 at h = 2: the touching pairs are split, one object per nucleus (in the demo’s synthetic image, exactly the 15 nuclei). 18 at h = 0: three nuclei are oversplit by small bumps in their DT. Checking which objects are right needs ground truth and object matching (the evaluation day).


Q8. (math) Show that two discs of radius r are split by h-maxima markers iff d > 2\sqrt{2rh - h^2}.

Depth r - \sqrt{r^2 - d^2/4} > h; isolate d.

r - \sqrt{r^2 - d^2/4} > h \iff \sqrt{r^2 - d^2/4} < r - h \iff r^2 - d^2/4 < (r - h)^2 \iff d^2 > 4(2rh - h^2) (for 0 \le h < r, both sides of the square root step are non-negative). For r = 10, h = 1: d > 8.72.