diff --git a/monai/transforms/spatial/array.py b/monai/transforms/spatial/array.py index 40a9a878ad..26cbf89f33 100644 --- a/monai/transforms/spatial/array.py +++ b/monai/transforms/spatial/array.py @@ -577,7 +577,10 @@ def __init__(self, k: int = 1, spatial_axes: Tuple[int, int] = (0, 1)) -> None: Default: (0, 1), this is the first two axis in spatial dimensions. """ self.k = k - self.spatial_axes = spatial_axes + spatial_axes_ = ensure_tuple(spatial_axes) + if len(spatial_axes_) != 2: + raise ValueError("spatial_axes must be 2 int numbers to indicate the axes to rotate 90 degrees.") + self.spatial_axes = spatial_axes_ def __call__(self, img: np.ndarray) -> np.ndarray: """