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

Added intensity clamp transform #622

Merged
merged 6 commits into from
Aug 16, 2021
Merged

Added intensity clamp transform #622

merged 6 commits into from
Aug 16, 2021

Conversation

mattwarkentin
Copy link
Contributor

Fixes #347.

Description
Added torchio.ClampIntensity() transform according to discussions in #347 and #348. I chose to use the word "clamp" to be consistent with torch.clamp terminology (which is also the underlying implementation), but this can be changed according to your preference (e.g. clipping).

Added tests and all tests passed locally.

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 Aug 16, 2021

Codecov Report

Merging #622 (123fb3d) into master (6a91cff) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #622      +/-   ##
==========================================
+ Coverage   96.77%   96.79%   +0.02%     
==========================================
  Files         124      126       +2     
  Lines        6409     6466      +57     
==========================================
+ Hits         6202     6259      +57     
  Misses        207      207              
Impacted Files Coverage Δ
tests/transforms/preprocessing/test_clamp.py 100.00% <100.00%> (ø)
torchio/transforms/__init__.py 100.00% <100.00%> (ø)
torchio/transforms/preprocessing/__init__.py 100.00% <100.00%> (ø)
...orchio/transforms/preprocessing/intensity/clamp.py 100.00% <100.00%> (ø)

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 6a91cff...123fb3d. Read the comment docs.

Copy link
Owner

@fepegar fepegar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. I've added some comments. I think I messed up and some comments went to the commit in your fork, instead of this PR. Can you see them?

torchio/transforms/preprocessing/intensity/clamp.py Outdated Show resolved Hide resolved
torchio/transforms/preprocessing/intensity/clamp.py Outdated Show resolved Hide resolved
@mattwarkentin
Copy link
Contributor Author

Yep I can see all the comments. Will make these changes. Much of the unnecessary code is probably because I used RescaleIntensity as a template and so it needs refactoring now.

@fepegar
Copy link
Owner

fepegar commented Aug 16, 2021

Are you happy with my changes? Shall I merge?

@mattwarkentin
Copy link
Contributor Author

LGTM! That's kind of you to check with me.

@fepegar
Copy link
Owner

fepegar commented Aug 16, 2021

Kind of you to contribute to an open-source project! Thanks again!

@fepegar fepegar merged commit e81273f into fepegar:master Aug 16, 2021
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.

A new transform that would clip intensities
2 participants