Skip to content

Commit

Permalink
enh: add test to cover new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban authored Nov 16, 2023
1 parent 3a5467f commit 4c8f043
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions nitransforms/tests/data/affine-RAS.afni-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 3dvolreg matrices (DICOM-to-DICOM, row-by-row):
0.999999 -0.000999999 -0.001 -4 0.00140494 0.621609 0.783327 -2 -0.000161717 -0.783327 0.62161 -1
0.999999 -0.000999999 -0.001 -4 0.00140494 0.621609 0.783327 -2 -0.000161717 -0.783327 0.62161 -1
8 changes: 7 additions & 1 deletion nitransforms/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def test_LT_conversions(data_path, fname):
"oblique",
],
)
@pytest.mark.parametrize("sw", ["afni", "fsl", "fs", "itk"])
@pytest.mark.parametrize("sw", ["afni", "fsl", "fs", "itk", "afni-array"])
def test_Linear_common(tmpdir, data_path, sw, image_orientation, get_testdata):
tmpdir.chdir()

Expand All @@ -206,6 +206,9 @@ def test_Linear_common(tmpdir, data_path, sw, image_orientation, get_testdata):

fname = f"affine-{image_orientation}.{sw}{ext}"

if sw == "afni-array":
fname.replace(image_orientation, "RAS")

# Test the transform loaders are implemented
xfm = factory.from_filename(data_path / fname)

Expand All @@ -222,6 +225,9 @@ def test_Linear_common(tmpdir, data_path, sw, image_orientation, get_testdata):

# Test from_ras
RAS = from_matvec(euler2mat(x=0.9, y=0.001, z=0.001), [4.0, 2.0, -1.0])
if sw == "afni-array":
RAS = [RAS, RAS]

xfm = factory.from_ras(RAS, reference=reference, moving=moving)
assert np.allclose(xfm.to_ras(reference=reference, moving=moving), RAS)

Expand Down

0 comments on commit 4c8f043

Please sign in to comment.