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 1/2] 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) From 3c5827780fa4ca404fad8f1732bd3b7e6c623d96 Mon Sep 17 00:00:00 2001 From: neuronflow <7048826+neuronflow@users.noreply.github.com> Date: Sat, 25 Apr 2026 00:39:58 +0200 Subject: [PATCH 2/2] Update brainles_preprocessing/registration/ANTs/ANTs.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- brainles_preprocessing/registration/ANTs/ANTs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brainles_preprocessing/registration/ANTs/ANTs.py b/brainles_preprocessing/registration/ANTs/ANTs.py index 3c55738..f3e45d7 100644 --- a/brainles_preprocessing/registration/ANTs/ANTs.py +++ b/brainles_preprocessing/registration/ANTs/ANTs.py @@ -172,7 +172,7 @@ def transform( # 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) + interpolator = transform_kwargs.pop("interpolator", interpolator) assert interpolator in VALID_INTERPOLATORS, ( f"Invalid interpolator: {interpolator}. "