From f1c56757efce4303a3d9ab4ea9cede52afe166c8 Mon Sep 17 00:00:00 2001 From: raph-rc <70120121+raph-rc@users.noreply.github.com> Date: Wed, 25 Mar 2026 15:10:41 -0400 Subject: [PATCH] Fix TypeError thrown when specifying interpolator for ANTsRegistrator `interpolator` was passed twice to `ants.transform` when it was specified as an additional argument in `ANTsRegistrator(transformation_params={'interpolator': 'value'})`. This change makes sure to pass it only once, and that the specified value takes precedence over the default. --- brainles_preprocessing/registration/ANTs/ANTs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/brainles_preprocessing/registration/ANTs/ANTs.py b/brainles_preprocessing/registration/ANTs/ANTs.py index fa0808e..3c55738 100644 --- a/brainles_preprocessing/registration/ANTs/ANTs.py +++ b/brainles_preprocessing/registration/ANTs/ANTs.py @@ -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) + assert interpolator in VALID_INTERPOLATORS, ( f"Invalid interpolator: {interpolator}. " 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)