MorphologicalPerturbation

Note

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

class MorphologicalPerturbation(grow_mm: float | None = None, max_grow_mm: float = 1.0, roi: str | None = None, connectivity: int = 1)[source]

Bases: object

Uniformly grow or shrink every ROI (MIRP perturbation_roi_adapt_size).

This is the systematic component of inter-rater contour variability: one observer consistently traces slightly larger or smaller than another. It complements the Prior 2024 simulated-retest chain (which perturbs the image, not the contour). Only masks change; image intensities are untouched. Applied per foreground label so multi-label ROIs grow each region instead of merging them.

Parameters:
  • grow_mm – Fixed physical radius in millimetres; positive dilates, negative erodes, zero is a no-op. None samples a signed radius from Uniform(-max_grow_mm, +max_grow_mm) per call.

  • max_grow_mm – Sampling bound when grow_mm is unset.

  • roi – Restrict the perturbation to one mask key; None perturbs all masks.

  • connectivity – Structuring-element connectivity in {1, 2, 3}; 1 (6-connected) is the MIRP-like default.

__init__(grow_mm: float | None = None, max_grow_mm: float = 1.0, roi: str | None = None, connectivity: int = 1) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(subject: Subject, *, rng: Generator) → Subject[source]

Return a copy of subject with each ROI grown or shrunk.

Parameters:
  • subject – Subject providing the masks.

  • rng – Random generator sampling the radius when grow_mm is unset.

Returns:

The perturbed subject copy.

Examples using habit.precision.MorphologicalPerturbation

/auto_examples/03_precision/plot_01_precise_features

Precise voxel features