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

Discussion #489: add CopyAffine transform #584

Merged
merged 15 commits into from
Jul 5, 2021
Merged

Conversation

albansteff
Copy link
Contributor

@albansteff albansteff commented Jun 23, 2021

Fixes #489 .

Description
Add a CopyAffine transform with a target_key parameter to copy the affine from this key to all LabelMap objects of a given torchio subject.

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

@romainVala
Copy link
Contributor

merci alban

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.

Thanks for your PR! I added a comment. Could you please update the corresponding rst file in the documentation?

torchio/transforms/preprocessing/spatial/copy_affine.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 29, 2021

Codecov Report

Merging #584 (73cc955) into master (213fff3) will decrease coverage by 0.04%.
The diff coverage is 82.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #584      +/-   ##
==========================================
- Coverage   96.83%   96.79%   -0.05%     
==========================================
  Files         122      124       +2     
  Lines        6358     6401      +43     
==========================================
+ Hits         6157     6196      +39     
- Misses        201      205       +4     
Impacted Files Coverage Δ
print_system.py 0.00% <0.00%> (ø)
tests/transforms/test_transforms.py 100.00% <ø> (ø)
torchio/data/image.py 89.93% <ø> (ø)
torchio/transforms/data_parser.py 92.92% <ø> (ø)
tests/transforms/preprocessing/test_copy_affine.py 100.00% <100.00%> (ø)
torchio/__init__.py 100.00% <100.00%> (ø)
torchio/reference.py 100.00% <100.00%> (ø)
torchio/transforms/__init__.py 100.00% <100.00%> (ø)
torchio/transforms/preprocessing/__init__.py 100.00% <100.00%> (ø)
...io/transforms/preprocessing/spatial/copy_affine.py 100.00% <100.00%> (ø)
... and 2 more

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 3bccf13...73cc955. Read the comment docs.

@fepegar fepegar mentioned this pull request Jul 1, 2021
9 tasks
@romainVala
Copy link
Contributor

Hi, I am not sure to understand what the error is,
should we change things ... ?

@fepegar
Copy link
Owner

fepegar commented Jul 5, 2021

Hi, I am not sure to understand what the error is,
should we change things ... ?

I think the error is happening because of a Sphinx problem that was fixed in 6e61447, before this branch was created. Don't worry about it. I'll take a look at this PR tonight or tomorrow.

@fepegar fepegar merged commit 6c7a188 into fepegar:master Jul 5, 2021
@fepegar
Copy link
Owner

fepegar commented Jul 5, 2021

Thanks for your contribution, @Albans98!

@all-contributors please add @Albans98 for code

@allcontributors
Copy link
Contributor

@fepegar

I've put up a pull request to add @Albans98! 🎉

@albansteff
Copy link
Contributor Author

Thanks for your time and your reviews !

@romainVala
Copy link
Contributor

@Albans98 just find out, there is one line missing at the end of the init

        self.args_names = ['target']

@fepegar
Copy link
Owner

fepegar commented Jul 8, 2021

That's my fault, I removed it thinking it wasn't necessary. It's needed to reproduce the transform, right?

@romainVala
Copy link
Contributor

may be @Albans98 can confirm, I don't know what the exact problem was,
In our use case, we do save the transform history (to be able to reproduce later)

but anyway It make sens to have it for all the transform (preprocessing and augmentation)
(I quickly check, and there may be some other missing like OneHot)

@albansteff
Copy link
Contributor Author

Hello, yes the problem is when we try to save the history of all applied transforms, we get an error 'TypeError: init() missing 1 required positional argument: 'target''.

Adding the target in the list of args makes it possible to trace back to the 'target' value.

@fepegar
Copy link
Owner

fepegar commented Jul 9, 2021

Ok, let me fix that.

fepegar added a commit that referenced this pull request Jul 9, 2021
@fepegar
Copy link
Owner

fepegar commented Jul 9, 2021

Done. Thanks for pointing that out!

@albansteff
Copy link
Contributor Author

Thank you for fixing this !

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.

3 participants