From ab28efc20736afdda14262777a71f539f876eba8 Mon Sep 17 00:00:00 2001 From: Julien Marabotto Date: Fri, 26 Apr 2024 10:35:37 +0200 Subject: [PATCH] enh: removed straneous comments, update nonlinear --- nitransforms/nonlinear.py | 2 +- nitransforms/tests/test_base.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nitransforms/nonlinear.py b/nitransforms/nonlinear.py index 99e68012..0d3e9956 100644 --- a/nitransforms/nonlinear.py +++ b/nitransforms/nonlinear.py @@ -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( diff --git a/nitransforms/tests/test_base.py b/nitransforms/tests/test_base.py index fe08d2e9..4a345262 100644 --- a/nitransforms/tests/test_base.py +++ b/nitransforms/tests/test_base.py @@ -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)