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

Provide init_kwargs to every transform within another transform #1228

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

nicoloesch
Copy link
Contributor

Fixes #1223.

Description

Certain transforms utilise already implemented transforms during their apply_transform method. However, these transforms are instantiated without the original arguments passed to the outer transform. These mainly include copy but may also extend to include, exclude, p etc.

This commit appends the initial arguments to each new instantiation of a base transform to reflect the user preference.

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

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.81%. Comparing base (cfc8aaf) to head (c4737c7).

Files with missing lines Patch % Lines
src/torchio/transforms/transform.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1228      +/-   ##
==========================================
- Coverage   87.39%   84.81%   -2.59%     
==========================================
  Files          92       92              
  Lines        6023     6039      +16     
==========================================
- Hits         5264     5122     -142     
- Misses        759      917     +158     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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, @nicoloesch! Could you please just add an explanation of what get_base_args does/why it exists in Transform.get_base_args? Just so our future selves or other maintainers have some context about it. I'll approve and merge after that.

@nicoloesch
Copy link
Contributor Author

@fepegar I added a docstring description to the method. I hope it is detailed enough!

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.

Certain Transformations disregard *args and **kwargs (including copy)
2 participants