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 transform to ensure shape multiple of N #401

Merged
merged 6 commits into from
Dec 29, 2020
Merged

Conversation

fepegar
Copy link
Owner

@fepegar fepegar commented Dec 28, 2020

Description
Some network architectures need the input shape to be a multiple of N. For example, a U-Net with two downsampling levels will fail if the input shape is not a multiple of 4. This transforms ensures a valid shape by either cropping or padding.

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 Dec 28, 2020

Codecov Report

Merging #401 (ec19bc3) into master (b9ac52d) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #401      +/-   ##
==========================================
+ Coverage   92.42%   92.48%   +0.06%     
==========================================
  Files         117      119       +2     
  Lines        5942     5991      +49     
==========================================
+ Hits         5492     5541      +49     
  Misses        450      450              
Impacted Files Coverage Δ
tests/transforms/test_transforms.py 100.00% <ø> (ø)
...sforms/preprocessing/test_ensure_shape_multiple.py 100.00% <100.00%> (ø)
torchio/transforms/__init__.py 100.00% <100.00%> (ø)
torchio/transforms/preprocessing/__init__.py 100.00% <100.00%> (ø)
...rms/preprocessing/spatial/ensure_shape_multiple.py 100.00% <100.00%> (ø)
torchio/transforms/transform.py 94.04% <100.00%> (+0.03%) ⬆️

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 fd8cc64...527d23e. Read the comment docs.

@fepegar fepegar marked this pull request as ready for review December 29, 2020 14:52
@fepegar fepegar merged commit 623b5ba into master Dec 29, 2020
@fepegar fepegar deleted the add-ensure-shape branch December 29, 2020 14:55
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.

None yet

1 participant