Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` prob: probability of rotating. (Default 0.1, with 10% probability it returns a rotated array.) max_k
(
self,
keys: KeysCollection,
prob: float = 0.1,
max_k: int = 3,
spatial_axes: tuple[int, int] = (0, 1),
allow_missing_keys: bool = False,
lazy: bool = False,
)
| 710 | backend = Rotate90.backend |
| 711 | |
| 712 | def __init__( |
| 713 | self, |
| 714 | keys: KeysCollection, |
| 715 | prob: float = 0.1, |
| 716 | max_k: int = 3, |
| 717 | spatial_axes: tuple[int, int] = (0, 1), |
| 718 | allow_missing_keys: bool = False, |
| 719 | lazy: bool = False, |
| 720 | ) -> None: |
| 721 | """ |
| 722 | Args: |
| 723 | keys: keys of the corresponding items to be transformed. |
| 724 | See also: :py:class:`monai.transforms.compose.MapTransform` |
| 725 | prob: probability of rotating. |
| 726 | (Default 0.1, with 10% probability it returns a rotated array.) |
| 727 | max_k: number of rotations will be sampled from `np.random.randint(max_k) + 1`. |
| 728 | (Default 3) |
| 729 | spatial_axes: 2 int numbers, defines the plane to rotate with 2 spatial axes. |
| 730 | Default: (0, 1), this is the first two axis in spatial dimensions. |
| 731 | allow_missing_keys: don't raise exception if key is missing. |
| 732 | lazy: a flag to indicate whether this transform should execute lazily or not. |
| 733 | Defaults to False |
| 734 | """ |
| 735 | MapTransform.__init__(self, keys, allow_missing_keys) |
| 736 | RandomizableTransform.__init__(self, prob) |
| 737 | LazyTransform.__init__(self, lazy=lazy) |
| 738 | |
| 739 | self.max_k = max_k |
| 740 | self.spatial_axes = spatial_axes |
| 741 | |
| 742 | self._rand_k = 0 |
| 743 | |
| 744 | def randomize(self, data: Any | None = None) -> None: |
| 745 | self._rand_k = self.R.randint(self.max_k) + 1 |