Fix #8340: Remove incorrect minus sign in rotate_range documentation#8773
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughDocstrings were corrected to fix the rotation parameter range description across spatial transforms. The updated docs remove an incorrect negation so rotation values are documented as sampled from uniform[rotate_range[i][0], rotate_range[i][1]) instead of uniform[-rotate_range[i][0], rotate_range[i][1]). Changes touch array-based transforms (RandAffineGrid, RandAffine, Rand2DElastic) and dictionary-based transforms (RandAffined, Rand2DElasticd, Rand3DElasticd). No code logic, signatures, or behavior were modified. Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ocumentation 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>
f87d2b5 to
2ab5653
Compare
|
Hi @yunhaoli24 thanks for the update. Please check that the line below many of your changes should be updated too, eg. |
|
Hi @ericspod, thanks for the review! I've checked the second line and the negative sign there is actually correct. Looking at the implementation in elif f is not None:
out_param.append(self.R.uniform(-f, f)) # single value caseWhen The first line's negative sign was wrong because it describes the pair case: if issequenceiterable(f):
out_param.append(self.R.uniform(f[0], f[1])) # pair case - no negationMy fix only removed the incorrect negative sign from the first line (pair case), while keeping the correct negative sign in the second line (single value case). |
…ocumentation (Project-MONAI#8773) ## Summary - Fixed incorrect minus sign in `rotate_range` parameter documentation - The documentation incorrectly showed `uniform[-rotate_range[i][0], rotate_range[i][1])` - The actual implementation uses `uniform(f[0], f[1])` without negation on the first parameter - Fixed across 7 locations in both array and dictionary transforms ## Changes - Updated documentation in `monai/transforms/spatial/array.py`: - RandAffineGrid (line 1851) - RandAffine (line 2389) - Rand2DElastic (line 2659) - Rand3DElastic (line 2827) - Updated documentation in `monai/transforms/spatial/dictionary.py`: - RandAffined (line 1064) - Rand2DElasticd (line 1249) - Rand3DElasticd (line 1399) ## Types of changes - [x] Documentation update Fixes Project-MONAI#8340 Signed-off-by: li.yunhao <li.yunhao@foxmail.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
Summary
rotate_rangeparameter documentationuniform[-rotate_range[i][0], rotate_range[i][1])uniform(f[0], f[1])without negation on the first parameterChanges
monai/transforms/spatial/array.py:monai/transforms/spatial/dictionary.py:Types of changes
Fixes #8340