Skip to content
Snippets Groups Projects
Commit 2c3d0aa8 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: check data has been rotated as well

parent 90fe4b4f
No related branches found
No related tags found
1 merge request!45TEST: check data has been rotated as well
Pipeline #15220 skipped
......@@ -99,6 +99,7 @@ def test_fix_orient():
fixed = nib.load('fixed.nii.gz')
new_data = fixed.get_fdata()
new_qform, qcode = fixed.get_qform(coded=True)
_, scode = fixed.get_sform(coded=True)
......@@ -107,6 +108,7 @@ def test_fix_orient():
assert qcode == 1
assert scode == 0
assert np.all(np.isclose(new_qform, np.diag([2, 2, 2, 1])))
assert np.all(np.isclose(new_data, data.transpose((0, 2, 1))))
# An alternate strategy which involves
......@@ -126,12 +128,14 @@ def test_fix_orient_alternate():
sprun('imcp orig cleared')
sprun('fslorient -deleteorient cleared')
sprun('fslswapdim cleared x z y swapped')
sprun('imcp swapped fixed')
sprun('fslorient -setqform 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 fixed')
sprun('imcp swapped fixed1')
sprun('fslorient -setqform 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 fixed1')
sprun('imcp fixed1 fixed')
sprun('fslorient -setqformcode 1 fixed')
fixed = nib.load('fixed.nii.gz')
new_data = fixed.get_fdata()
new_qform, qcode = fixed.get_qform(coded=True)
_, scode = fixed.get_sform(coded=True)
......@@ -140,7 +144,7 @@ def test_fix_orient_alternate():
assert qcode == 1
assert scode == 0
assert np.all(np.isclose(new_qform, np.diag([2, 2, 2, 1])))
assert np.all(np.isclose(new_data, data.transpose((0, 2, 1))))
if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment