-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RandomCrop3D and CenterCrop3D #2198
Conversation
Reviewer's Guide by SourceryThis PR adds two new 3D transformation classes - CenterCrop3D and RandomCrop3D - to handle cropping operations on 3D volumes. The implementation includes support for padding if needed, handling different input shapes, and maintaining consistency with existing transform interfaces. Class diagram for new 3D transformation classesclassDiagram
class BaseCropAndPad3D {
+bool pad_if_needed
+ColorType fill
+ColorType fill_mask
+Literal pad_position
+apply_to_images(np.ndarray images, tuple crop_coords, dict pad_params)
+apply_to_masks(np.ndarray masks, tuple crop_coords, dict pad_params)
}
class CenterCrop3D {
+tuple size
+get_params_dependent_on_data(dict params, dict data)
}
class RandomCrop3D {
+tuple size
+get_params_dependent_on_data(dict params, dict data)
}
BaseCropAndPad3D <|-- CenterCrop3D
BaseCropAndPad3D <|-- RandomCrop3D
note for BaseCropAndPad3D "Base class for 3D transforms that need both cropping and padding"
Class diagram for updated Pad3D classclassDiagram
class Pad3D {
+validate_padding(int|tuple padding)
}
class BasePad3D {
}
BasePad3D <|-- Pad3D
note for Pad3D "Updated to include padding validation"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ternaus - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Add CenterCrop3D and RandomCrop3D transforms for 3D image volumes, including validation for padding values and comprehensive tests.
New Features:
Enhancements:
Documentation:
Tests: