Skip to content

Commit 8dae35f

Browse files
authored
Merge pull request #207 from nipy/fix/transpose-not-necessary
FIX: Do not transpose (see scipy.ndimage.map_coordinates docs)
2 parents 3d0ecc2 + e68c81b commit 8dae35f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

nitransforms/nonlinear.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def map(self, x, inverse=False):
160160
if inverse is True:
161161
raise NotImplementedError
162162

163-
x = np.array(x)
164163
ijk = self.reference.index(x)
165164
indexes = np.round(ijk).astype("int")
166165

@@ -172,7 +171,7 @@ def map(self, x, inverse=False):
172171
tuple(
173172
map_coordinates(
174173
self._field[..., i],
175-
ijk.T,
174+
ijk,
176175
order=3,
177176
mode="constant",
178177
cval=np.nan,
@@ -183,7 +182,7 @@ def map(self, x, inverse=False):
183182
).T
184183

185184
# Set NaN values back to the original coordinates value = no displacement
186-
new_map[np.isnan(new_map)] = x[np.isnan(new_map)]
185+
new_map[np.isnan(new_map)] = np.array(x)[np.isnan(new_map)]
187186
return new_map
188187

189188
def __matmul__(self, b):

0 commit comments

Comments
 (0)