Skip to content

Commit f9f311c

Browse files
committed
docs: clarify backward mapping logic for RandAffine and RandAffined
Signed-off-by: ytl0623 <david89062388@gmail.com>
1 parent b106a4c commit f9f311c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

monai/transforms/spatial/array.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,13 @@ def __init__(
24362436
- :py:class:`RandAffineGrid` for the random affine parameters configurations.
24372437
- :py:class:`Affine` for the affine transformation parameters configurations.
24382438
2439+
Note:
2440+
The affine transformations in MONAI use a 'backward mapping' (image-to-grid) logic.
2441+
This can be counter-intuitive:
2442+
- Translation: A positive value shifts the image in the negative direction.
2443+
- Scaling: Positive scale_range values decrease the image size; values in [-1, 0) increase it.
2444+
- Rotation: The direction (CW/CCW) may vary depending on the axis.
2445+
24392446
"""
24402447
RandomizableTransform.__init__(self, prob)
24412448
LazyTransform.__init__(self, lazy=lazy)

monai/transforms/spatial/dictionary.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,13 @@ def __init__(
11001100
- :py:class:`monai.transforms.compose.MapTransform`
11011101
- :py:class:`RandAffineGrid` for the random affine parameters configurations.
11021102
1103+
Note:
1104+
The affine transformations in MONAI use a 'backward mapping' (image-to-grid) logic.
1105+
This can be counter-intuitive:
1106+
- Translation: A positive value shifts the image in the negative direction.
1107+
- Scaling: Positive scale_range values decrease the image size; values in [-1, 0) increase it.
1108+
- Rotation: The direction (CW/CCW) may vary depending on the axis.
1109+
11031110
"""
11041111
MapTransform.__init__(self, keys, allow_missing_keys)
11051112
RandomizableTransform.__init__(self, prob)

0 commit comments

Comments
 (0)