From 2c3d0aa838d5275ddeb5897137ea889d143ee4d2 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Wed, 24 Aug 2022 13:14:37 +0100 Subject: [PATCH] TEST: check data has been rotated as well --- unit_tests/avwutils/fix_orient/feedsRun | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/unit_tests/avwutils/fix_orient/feedsRun b/unit_tests/avwutils/fix_orient/feedsRun index a56d814..61cade7 100755 --- a/unit_tests/avwutils/fix_orient/feedsRun +++ b/unit_tests/avwutils/fix_orient/feedsRun @@ -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__': -- GitLab