MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __init__

Method __init__

monai/transforms/spatial/array.py:1193–1208  ·  view source on GitHub ↗

Args: k: number of times to rotate by 90 degrees. spatial_axes: 2 int numbers, defines the plane to rotate with 2 spatial axes. Default: (0, 1), this is the first two axis in spatial dimensions. If axis is negative it counts from the l

(self, k: int = 1, spatial_axes: tuple[int, int] = (0, 1), lazy: bool = False)

Source from the content-addressed store, hash-verified

1191 backend = [TransformBackends.TORCH]
1192
1193 def __init__(self, k: int = 1, spatial_axes: tuple[int, int] = (0, 1), lazy: bool = False) -> None:
1194 """
1195 Args:
1196 k: number of times to rotate by 90 degrees.
1197 spatial_axes: 2 int numbers, defines the plane to rotate with 2 spatial axes.
1198 Default: (0, 1), this is the first two axis in spatial dimensions.
1199 If axis is negative it counts from the last to the first axis.
1200 lazy: a flag to indicate whether this transform should execute lazily or not.
1201 Defaults to False
1202 """
1203 LazyTransform.__init__(self, lazy=lazy)
1204 self.k = (4 + (k % 4)) % 4 # 0, 1, 2, 3
1205 spatial_axes_: tuple[int, int] = ensure_tuple(spatial_axes)
1206 if len(spatial_axes_) != 2:
1207 raise ValueError(f"spatial_axes must be 2 numbers to define the plane to rotate, got {spatial_axes_}.")
1208 self.spatial_axes = spatial_axes_
1209
1210 def __call__(self, img: torch.Tensor, lazy: bool | None = None) -> torch.Tensor:
1211 """

Callers

nothing calls this directly

Calls 2

ensure_tupleFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected