Skip to main content

Module mask

Module mask 

Source
Expand description

Brain-mask thresholding and morphology.

Mask generation (otsu_threshold) plus morphological operations (erode/dilate/close/fill-holes, signal-gated erosion) and sphere masks.

Structs§

ScannerMaskedPhase
Where a scanner wrote a fill value instead of a measured phase: scanner_masked_phase.
SignalErosionParams
Signal-gated erosion parameters. The default is the QSM-CI harmonization setting.

Constants§

SCANNER_FILL_MIN_FRACTION
Smallest share of the volume a single exact phase value must cover to count as a scanner’s fill value in scanner_masked_phase: 5 %.

Functions§

apply_mask_zero
Zero out elements where mask is 0.
create_sphere_mask
Create a binary sphere mask on a 3D volume
dilate_mask
Dilate a binary mask by expanding into neighboring voxels (6-connectivity).
erode_mask
Erode a binary mask by removing boundary voxels (6-connectivity).
fill_holes
Fill holes in a binary mask
morphological_close
Morphological closing (dilation followed by erosion) with a spherical structuring element of radius voxels.
otsu_threshold
Otsu’s method for automatic threshold selection
scanner_masked_phase
Find the voxels where the scanner wrote no phase: a constant fill value, the same in every echo, covering a large part of the volume.
signal_gated_erosion
Erode mask only where the signal is low (see the module docs).