Skip to content

Commit 2680959

Browse files
committed
tst: add LTA transform test, currently failing
1 parent 477d98c commit 2680959

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

nitransforms/tests/test_io.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_LinearTransformArray(tmpdir, data_path):
4545
xform = lta['xforms'][0]
4646

4747
assert np.allclose(
48-
xform['m_L'], np.genfromtxt(test_lta, skip_header=5, skip_footer=20)
48+
xform['m_L'], np.genfromtxt(test_lta, skip_header=8, skip_footer=18)
4949
)
5050

5151
outlta = (tmpdir / 'out.lta').strpath
@@ -57,6 +57,24 @@ def test_LinearTransformArray(tmpdir, data_path):
5757
assert np.allclose(lta['xforms'][0]['m_L'], lta2['xforms'][0]['m_L'])
5858

5959

60+
def test_LT_conversions(data_path):
61+
r = str(data_path / 'r2r.lta')
62+
v = str(data_path / 'v2v.lta')
63+
with open(r) as fa, open(v) as fb:
64+
r2r = LTA.from_fileobj(fa)
65+
v2v = LTA.from_fileobj(fb)
66+
assert r2r['type'] == 1
67+
assert v2v['type'] == 0
68+
69+
r2r_m = r2r['xforms'][0]['m_L']
70+
v2v_m = v2v['xforms'][0]['m_L']
71+
assert np.any(r2r_m != v2v_m)
72+
# convert vox2vox LTA to ras2ras
73+
v2v.set_type('LINEAR_RAS_TO_RAS')
74+
assert v2v['type'] == 1
75+
assert np.all(r2r_m == v2v_m)
76+
77+
6078
def test_ITKLinearTransformArray(tmpdir, data_path):
6179
tmpdir.chdir()
6280

0 commit comments

Comments
 (0)