Skip to content

Commit 2ab5653

Browse files
committed
Fix #8340: Remove incorrect minus sign in rotate_range documentation
Remove the extra minus sign in rotate_range[i][0] that was incorrectly documented across multiple transform classes. The actual implementation uses uniform(f[0], f[1]) without any negation on the first parameter. Affected transforms: - RandAffineGrid, RandAffine - Rand2DElastic, Rand3DElastic - RandAffined, Rand2DElasticd, Rand3DElasticd Signed-off-by: li.yunhao <li.yunhao@foxmail.com>
1 parent daaedaa commit 2ab5653

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

monai/transforms/spatial/array.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ def __init__(
18481848
"""
18491849
Args:
18501850
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
1851-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
1851+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
18521852
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
18531853
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
18541854
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`
@@ -2386,7 +2386,7 @@ def __init__(
23862386
prob: probability of returning a randomized affine grid.
23872387
defaults to 0.1, with 10% chance returns a randomized grid.
23882388
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
2389-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
2389+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
23902390
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
23912391
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
23922392
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`
@@ -2656,7 +2656,7 @@ def __init__(
26562656
defaults to 0.1, with 10% chance returns a randomized elastic transform,
26572657
otherwise returns a ``spatial_size`` centered area extracted from the input image.
26582658
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
2659-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
2659+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
26602660
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
26612661
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
26622662
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`
@@ -2824,7 +2824,7 @@ def __init__(
28242824
defaults to 0.1, with 10% chance returns a randomized elastic transform,
28252825
otherwise returns a ``spatial_size`` centered area extracted from the input image.
28262826
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
2827-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
2827+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
28282828
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
28292829
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
28302830
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`

monai/transforms/spatial/dictionary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ def __init__(
10611061
prob: probability of returning a randomized affine grid.
10621062
defaults to 0.1, with 10% chance returns a randomized grid.
10631063
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
1064-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
1064+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
10651065
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
10661066
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
10671067
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`
@@ -1246,7 +1246,7 @@ def __init__(
12461246
defaults to 0.1, with 10% chance returns a randomized grid,
12471247
otherwise returns a ``spatial_size`` centered area extracted from the input image.
12481248
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
1249-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
1249+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
12501250
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
12511251
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
12521252
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`
@@ -1396,7 +1396,7 @@ def __init__(
13961396
defaults to 0.1, with 10% chance returns a randomized grid,
13971397
otherwise returns a ``spatial_size`` centered area extracted from the input image.
13981398
rotate_range: angle range in radians. If element `i` is a pair of (min, max) values, then
1399-
`uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
1399+
`uniform[rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter
14001400
for the `i`th spatial dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used.
14011401
This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be
14021402
in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]`

0 commit comments

Comments
 (0)