RotationPerturbation

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

Bases: object

Rotate image content by a small fixed angle about the image centre.

Parameters:
  • angle_degrees – Rotation angle in degrees; the paper uses 0.5. Deterministic by design – pass the sign you want.

  • axis – Axis to rotate around ("x", "y" or "z"; "z" is the axial in-plane axis, the paper’s choice).

  • interpolator – Interpolator for the intensity images ("bspline" is the paper’s choice); masks use nearest neighbour only when warp_masks is True.

  • random_sign – When True, the sign of angle_degrees is drawn as ±1 per call (some MIRP configs randomize the sense of the 0.5° in-plane rotation). The paper’s default is a fixed +0.5 degrees, so this stays False.

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

__init__(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 rotated by angle_degrees.

Parameters:
  • subject – Subject providing images and masks.

  • rng – Random generator; consumed only when random_sign is True.

Returns:

The perturbed subject copy.