From daa3fe696a77c4998d72fabb8d90fb24c2c3b6f8 Mon Sep 17 00:00:00 2001 From: Eloi Navet Date: Thu, 15 May 2025 16:53:23 +0000 Subject: [PATCH] Fix shear transformation for multiple axes (#8450) Signed-off-by: Eloi Navet --- monai/transforms/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/transforms/utils.py b/monai/transforms/utils.py index e7e1616e13..88f3b5791d 100644 --- a/monai/transforms/utils.py +++ b/monai/transforms/utils.py @@ -985,7 +985,7 @@ def _create_shear(spatial_dims: int, coefs: Sequence[float] | float, eye_func=np if spatial_dims == 2: coefs = ensure_tuple_size(coefs, dim=2, pad_val=0.0) out = eye_func(3) - out[0, 1], out[1, 0] = coefs[0], coefs[1] + out[0, 1], out[1, 0], out[1, 1] = coefs[0], coefs[1], 1 + coefs[0] * coefs[1] return out # type: ignore if spatial_dims == 3: coefs = ensure_tuple_size(coefs, dim=6, pad_val=0.0)