Skip to content
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 support to crop/pad to the mask's bounding box #678

Merged
merged 3 commits into from
Oct 3, 2021
Merged

Conversation

fepegar
Copy link
Owner

@fepegar fepegar commented Oct 1, 2021

Resolves #675.
Related to #677.

Description
In CropOrPad, a target shape was necessary. Now, it can be omitted and it will be computed from the mask name (and labels, if passed).

Checklist

  • I have read the CONTRIBUTING docs and have a developer setup (especially important are pre-commitand pytest)
  • Non-breaking change (would not break existing functionality)
  • Breaking change (would cause existing functionality to change)
  • Tests added or modified to cover the changes
  • Integration tests passed locally by running pytest
  • In-line docstrings updated
  • Documentation updated, tested running make html inside the docs/ folder
  • This pull request is ready to be reviewed
  • If the PR is ready and there are multiple commits, I have squashed them and force-pushed

@codecov
Copy link

codecov bot commented Oct 1, 2021

Codecov Report

Merging #678 (9400224) into master (db45b77) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #678      +/-   ##
==========================================
+ Coverage   95.51%   95.52%   +0.01%     
==========================================
  Files          72       72              
  Lines        4302     4314      +12     
==========================================
+ Hits         4109     4121      +12     
  Misses        193      193              
Impacted Files Coverage Δ
...io/transforms/preprocessing/spatial/crop_or_pad.py 96.80% <100.00%> (+0.27%) ⬆️
torchio/transforms/transform.py 96.95% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db45b77...9400224. Read the comment docs.

@romainVala
Copy link
Contributor

sound good,
just to say you may emphize in the doc, that this can induce different final shape ... (depending on the mask chosen)

@fepegar
Copy link
Owner Author

fepegar commented Oct 3, 2021

Thanks, @romainVala. I've added a warning message in the docstring. I think this is ready to go.

@fepegar fepegar merged commit 6deb015 into master Oct 3, 2021
@fepegar fepegar deleted the 677-crop-to-mask branch October 3, 2021 11:33
@fepegar fepegar restored the 677-crop-to-mask branch July 4, 2022 22:00
@fepegar fepegar deleted the 677-crop-to-mask branch July 4, 2022 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transform-CropToMask: crops image to the extremes of a bounding box about a given mask
2 participants