GradientWeightedPerturbation
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 GradientWeightedPerturbation(modality: str | None = None, roi: str | None = None, max_radius_voxels: int = 2, probability: float = 0.5)[source]
Bases:
objectLocally grow/shrink ROI boundaries where image gradient is low.
Inter-rater disagreement concentrates where contrast is poor: sharp (high-gradient) edges are drawn consistently, fuzzy (low-gradient) edges vary. This operator flips boundary voxels with a probability that scales with
1 - normalised_gradientof a reference image, so the fuzzy parts of the contour move more than the sharp parts. Only masks change.- Parameters:
modality – Image modality supplying the gradient-magnitude map;
Noneuses the subject’s first image. The map is normalised to[0, 1]over the ROI bounding region.roi – Restrict the perturbation to one mask key;
Noneperturbs all masks.max_radius_voxels – Neighbourhood radius bounding each local flip.
probability – Base flip probability at zero gradient; effective probability is
probability * (1 - gradient).