Skip to content

Conversation

@rijobro
Copy link
Contributor

@rijobro rijobro commented Feb 24, 2021

Allow min and max for random range-based parameters (e.g., amount of rotation in RandRotate)

From the new documentation:

If element i is iterable, then uniform[-rotate_range[i][0], rotate_range[i][1]) will be used to generate the rotation parameter for the ith dimension. If not, uniform[-rotate_range[i], rotate_range[i]) will be used. This can be altered on a per-dimension basis. E.g., ((0,3), 1, ...): for dim0, rotation will be in range [0, 3], and for dim1 [-1, 1] will be used. Setting a single value will use [-x, x] for dim0 and nothing for the remaining dimensions.

Backwards compatibility is ensured because the old behaviour used to do uniform[-rotate_range[i], rotate_range[i]), and this PR just adds the possibility to do uniform[-rotate_range[i][0], rotate_range[i][1]).

If element `i` is iterable, then `uniform[-rotate_range[i][0], rotate_range[i][1])` will be used to generate the rotation parameter for the ith dimension. If not, `uniform[-rotate_range[i], rotate_range[i])` will be used. This can be altered on a per-dimension basis. E.g., `((0,3), 1, ...)`: for dim0, rotation will be in range `[0, 3]`, and for dim1 `[-1, 1]` will be used. Setting a single value will use `[-x, x]` for dim0 and nothing for the remaining dimensions.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
…_params

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro enabled auto-merge (squash) February 25, 2021 10:21
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@rijobro rijobro merged commit b2f1cf4 into Project-MONAI:master Feb 25, 2021
@rijobro rijobro deleted the enhance_random_range_params branch February 25, 2021 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants