RigidPerturbation

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 RigidPerturbation(shift_voxels: Sequence[float] | None = None, shift_fraction: float = 0.5, random_signs: bool = True, angle_degrees: float = 0.5, axis: str = 'z', interpolator: str = 'bspline', random_sign: bool = False, warp_masks: bool = True)[source]

Bases: object

Sub-voxel translation and small-angle rotation in ONE resample.

MIRP ≥ 2 composes the geometric pair into a single affine so the image is not B-spline interpolated twice. Prior et al. 2024 used MIRP 1.2.0 (two resamples); use prior2024_retest_perturbation() with single_resample=False (default) to match that paper, or single_resample=True for this component.

Parameters:
  • shift_voxels – Fixed voxel shift; None uses shift_fraction.

  • shift_fraction – MIRP perturbation_translation_fraction in [0, 1] (paper-style default 0.5).

  • random_signs – Randomize the sign of each translation axis.

  • angle_degrees – In-plane rotation in degrees (paper: 0.5).

  • axis – Rotation axis (paper: "z").

  • interpolator – Intensity interpolator (paper: "bspline").

  • random_sign – Randomize the rotation sense.

  • warp_masks – When True, apply the same rigid move to every ROI. Prior 2024 extraction keeps the original mask (False).

__init__(shift_voxels: Sequence[float] | None = None, shift_fraction: float = 0.5, random_signs: bool = True, angle_degrees: float = 0.5, axis: str = 'z', interpolator: str = 'bspline', random_sign: bool = False, warp_masks: bool = True) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

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

Return a copy of subject after one rigid resample.

Parameters:
  • subject – Subject providing images and masks.

  • rng – Random generator for optional sign draws.

Returns:

The perturbed subject copy.