docs: clarify RandWeightedCrop(d) does not crop the weight map (#7851)#8962
Conversation
…7851) The w_key/weight_map is used only to compute patch sample locations and is left unchanged at its original spatial size. When the weight map is loaded as a separate key and the source images have different shapes, the uncropped maps have mismatched shapes and DataLoader collation fails. Document that the weight map is not cropped, and that w_key should be added to keys to obtain a cropped weight map aligned with the image patches. Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
|
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 (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughTwo docstring-only updates: Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@monai/transforms/croppad/dictionary.py`:
- Line 946: The docstring text in the cropping/padding dictionary transform uses
the incorrect phrase “in size” for the single-channel array description. Update
the wording in the relevant docstring near the transform documentation to say
“with shape” instead, matching the terminology used in the corresponding
array-based docs and keeping the phrasing consistent across the API.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b9f33917-1905-418f-a08d-a22874667456
📒 Files selected for processing (2)
monai/transforms/croppad/array.pymonai/transforms/croppad/dictionary.py
Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
Addresses #7851 .
Description
RandWeightedCrop(d)usesw_key/weight_maponly to pick patch locations; the map itself is passed through uncropped at its original size. Per #7851, this breaksDataLoadercollation when the weight map is a separate key and images differ in shape. This documents the behavior on both the array and dict transforms, and notes thatw_keyshould be added tokeysto get a cropped weight map.Types of changes