-
Notifications
You must be signed in to change notification settings - Fork 8
Fix TypeError thrown when specifying interpolator for ANTsRegistrator #178
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,15 +169,16 @@ def transform( | |
| """ | ||
| start_time = datetime.datetime.now() | ||
|
|
||
| # TODO - self.transformation_params | ||
| # we update the transformation parameters with the provided kwargs | ||
| transform_kwargs = {**self.transformation_params, **kwargs} | ||
| interpolator = transform_kwargs.pop('interpolator', interpolator) | ||
|
|
||
|
Comment on lines
+172
to
+176
|
||
| assert interpolator in VALID_INTERPOLATORS, ( | ||
| f"Invalid interpolator: {interpolator}. " | ||
|
Comment on lines
+175
to
178
|
||
| f"Valid options are: {', '.join(VALID_INTERPOLATORS)}." | ||
| ) | ||
|
|
||
| # TODO - self.transformation_params | ||
| # we update the transformation parameters with the provided kwargs | ||
| transform_kwargs = {**self.transformation_params, **kwargs} | ||
|
|
||
| # Convert all paths to Path objects | ||
| fixed_image_path = Path(fixed_image_path) | ||
| moving_image_path = Path(moving_image_path) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transform_kwargsis built fromself.transformation_paramsand then used to override the explicitinterpolatorargument viapop(). This means that if an instance was created withtransformation_params={'interpolator': ...}, then callers cannot override it by passinginterpolator=...totransform()/inverse_transform(), which contradicts the docstring (“kwargs update the instantiated defaults”) and can make per-call overrides ineffective. Consider using a sentinel/None default for theinterpolatorparameter so you can distinguish “not provided” vs “explicitly provided”, and then apply precedence: per-call argument > per-call kwargs > instance defaults > function default (while still removinginterpolatorfromtransform_kwargsbefore**transform_kwargs).