TranslationPerturbation
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 TranslationPerturbation(shift_voxels: Sequence[float] | None = None, max_shift_voxels: float = 1.0, interpolator: str = 'bspline', shift_fraction: float | None = None, random_signs: bool = True, warp_masks: bool = True)[source]
Bases:
objectTranslate image content by a (random) sub-voxel shift.
Matches MIRP
perturbation_translation_fractionwhenshift_fractionis set: a fraction of one voxel along x, y and z (Prior et al., Radiol Artif Intell 2024;6(2):e230118, Appendix S2).shift_voxelsis the explicit SimpleITK(x, y, z)alternative. When both are unset, each axis is drawn fromUniform(-max_shift_voxels, +max_shift_voxels).- Parameters:
shift_voxels – Fixed shift in voxel units, SimpleITK
(x, y, z)order;Nonedefers toshift_fractionor random sampling.shift_fraction – MIRP-style fraction of a voxel in
[0, 1]. When set (andshift_voxelsis unset), the shift is±fractionon each axis (signs random ifrandom_signs).max_shift_voxels – Sampling bound when neither fixed shift is set.
random_signs – When using
shift_fraction, randomize the sign of each axis (MIRP interpolates at a shifted grid; the direction of the shift is not anatomically privileged).interpolator – Interpolator for the intensity images (
"bspline"is the paper’s choice); masks use nearest neighbour only whenwarp_masksis True.warp_masks – When True, apply the same translation to every ROI. Prior 2024 extraction keeps the original mask (False).