Add missing channel_wise parameter to RandScaleIntensityFixedMean#8741
Conversation
…oject-MONAI#8363) The channel_wise option was documented in docstrings but not actually implemented in RandScaleIntensityFixedMean and its dictionary variant RandScaleIntensityFixedMeand. This adds the parameter following the existing pattern from RandScaleIntensity, generating per-channel random scale factors when channel_wise=True. Fixes Project-MONAI#8363
📝 WalkthroughWalkthroughThis PR adds Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Additional notesThe changes directly address the missing 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
Summary
channel_wiseparameter toRandScaleIntensityFixedMeanandRandScaleIntensityFixedMeand, which was documented in docstrings but never implemented.channel_wise=True, a separate random scale factor is generated per channel, andpreserve_range/fixed_meanare applied per channel — following the existing pattern fromRandScaleIntensity.channel_wisein both array and dictionary transforms.Fixes #8363
Changes
monai/transforms/intensity/array.pychannel_wiseparameter toRandScaleIntensityFixedMean.__init__randomize()to generate per-channel factors whenchannel_wise=True__call__to apply per-channel scaling with individual random factorsmonai/transforms/intensity/dictionary.pychannel_wiseparameter toRandScaleIntensityFixedMeand.__init____call__to pass image data torandomize()(needed for channel count), following the pattern fromRandScaleIntensitydTests
test_channel_wiseandtest_channel_wise_preserve_rangetotest_rand_scale_intensity_fixed_mean.pytest_channel_wisetotest_rand_scale_intensity_fixed_meand.pyTest plan
channel_wisetests pass for both array and dictionary transformsfixed_mean=Truepreserve_rangeclipping works per channel