Skip to content

Commit

Permalink
enh: removed straneous comments, update nonlinear
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Marabotto authored and Julien Marabotto committed Apr 26, 2024
1 parent 748e1d3 commit ab28efc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion nitransforms/nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def map(self, x, inverse=False):
indexes = np.round(ijk).astype("int")

if np.all(np.abs(ijk - indexes) < 1e-3):
indexes = tuple(tuple(i) for i in indexes.T)
indexes = tuple(tuple(i) for i in indexes)
return self._field[indexes]

return np.vstack(tuple(
Expand Down
2 changes: 0 additions & 2 deletions nitransforms/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ def test_ImageGrid(get_testdata, image_orientation):
# Test ras2vox and vox2ras conversions
ijk = [[10, 10, 10], [40, 4, 20], [0, 0, 0], [s - 1 for s in im.shape[:3]]]
xyz = [img._affine.dot(idx + [1])[:-1] for idx in ijk]
# xyz = np.array([np.tensordot(img._affine, idx + [1], axes=1)[:-1] for idx in ijk])

# import pdb; pdb.set_trace()
assert np.allclose(np.squeeze(img.ras(ijk[0])), xyz[0])
assert np.allclose(np.round(img.index(xyz[0])), ijk[0])
assert np.allclose(img.ras(ijk).T, xyz)
Expand Down

0 comments on commit ab28efc

Please sign in to comment.