torchio icon indicating copy to clipboard operation
torchio copied to clipboard

Add random crop or pad

Open jxchen01 opened this issue 2 years ago • 2 comments

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 are pre-commitand pytest)
  • [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 the docs/ 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

jxchen01 avatar Mar 29 '22 08:03 jxchen01

WIP, will add unit test shortly

jxchen01 avatar Mar 29 '22 08:03 jxchen01

Codecov Report

Merging #847 (fc75672) into main (0b40d22) will increase coverage by 0.10%. The diff coverage is 100.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

codecov[bot] avatar Apr 01 '22 20:04 codecov[bot]

Thanks, @jxchen01. Are you planning to work on this?

fepegar avatar Mar 04 '23 18:03 fepegar

Closing this and #570 for inactivity. Feel free to reopen if you'd like to keep working on it!

fepegar avatar Jun 04 '23 19:06 fepegar