boundary_band_mask

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

boundary_band_mask(mask: ndarray, band_mm: float, spacing_xyz: Sequence[float] = (1.0, 1.0, 1.0), connectivity: int = 1) → ndarray[source]

Return the voxels within band_mm of the foreground boundary.

The band is the union of the outer dilation shell and the inner erosion shell of the foreground, i.e. the strip a radiologist’s mouse actually traverses. Used to weight boundary perturbations.

Parameters:
  • mask – Integer / boolean label array; 0 is background.

  • band_mm – Half-width of the band in millimetres.

  • spacing_xyz – Voxel spacing in SimpleITK (x, y, z) order.

  • connectivity – Structuring-element connectivity in {1, 2, 3}.

Returns:

A boolean array, True inside the boundary band.