From e68c81bb301e5eb1f7c61761a91d2e6e860fbd5f Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Fri, 17 May 2024 16:32:35 -0400 Subject: [PATCH] fix: do not transpose (see scipy.ndimage.map_coordinates docs) --- nitransforms/nonlinear.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nitransforms/nonlinear.py b/nitransforms/nonlinear.py index 4e0d0580..17befc8a 100644 --- a/nitransforms/nonlinear.py +++ b/nitransforms/nonlinear.py @@ -160,7 +160,6 @@ def map(self, x, inverse=False): if inverse is True: raise NotImplementedError - x = np.array(x) ijk = self.reference.index(x) indexes = np.round(ijk).astype("int") @@ -172,7 +171,7 @@ def map(self, x, inverse=False): tuple( map_coordinates( self._field[..., i], - ijk.T, + ijk, order=3, mode="constant", cval=np.nan, @@ -183,7 +182,7 @@ def map(self, x, inverse=False): ).T # Set NaN values back to the original coordinates value = no displacement - new_map[np.isnan(new_map)] = x[np.isnan(new_map)] + new_map[np.isnan(new_map)] = np.array(x)[np.isnan(new_map)] return new_map def __matmul__(self, b):