torchio
torchio copied to clipboard
Add random crop or pad
Fixes #570.
Description adapt CropOrPad function into a new RandomCropOrPad function, so that the source subject can be randomly cropped or padded into the target shape.
Checklist
- [x] I have read the
CONTRIBUTING
docs and have a developer setup (especially important arepre-commit
andpytest
) - [x] Non-breaking change (would not break existing functionality)
- [ ] Breaking change (would cause existing functionality to change)
- [x] Tests added or modified to cover the changes
- [x] Integration tests passed locally by running
pytest
- [x] In-line docstrings updated
- [x] Documentation updated, tested running
make html
inside thedocs/
folder - [x] This pull request is ready to be reviewed
- [x] If the PR is ready and there are multiple commits, I have squashed them and force-pushed
WIP, will add unit test shortly
Codecov Report
Merging #847 (fc75672) into main (0b40d22) will increase coverage by
0.10%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #847 +/- ##
==========================================
+ Coverage 93.87% 93.97% +0.10%
==========================================
Files 72 73 +1
Lines 4523 4568 +45
==========================================
+ Hits 4246 4293 +47
+ Misses 277 275 -2
Impacted Files | Coverage Δ | |
---|---|---|
torchio/transforms/__init__.py | 100.00% <100.00%> (ø) |
|
...orchio/transforms/augmentation/spatial/__init__.py | 100.00% <100.00%> (ø) |
|
...nsforms/augmentation/spatial/random_crop_or_pad.py | 100.00% <100.00%> (ø) |
|
torchio/transforms/preprocessing/spatial/pad.py | 94.87% <0.00%> (+5.12%) |
:arrow_up: |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
Thanks, @jxchen01. Are you planning to work on this?
Closing this and #570 for inactivity. Feel free to reopen if you'd like to keep working on it!