Skip to content

Commit 07d2fac

Browse files
committed
TST: Make sure the slice normal is sufficiently orthogonal, even when CSA slice normal is not.
1 parent 7f9a470 commit 07d2fac

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed
13.1 KB
Binary file not shown.

nibabel/nicom/tests/test_dicomreaders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def test_read_dwi():
2727

2828
@dicom_test
2929
def test_read_dwis():
30-
data, aff, bs, gs = didr.read_mosaic_dwi_dir(IO_DATA_PATH, '*.dcm.gz')
30+
data, aff, bs, gs = didr.read_mosaic_dwi_dir(IO_DATA_PATH,
31+
'siemens_dwi_*.dcm.gz')
3132
assert_equal(data.ndim, 4)
3233
assert_array_almost_equal(aff, EXPECTED_AFFINE)
3334
assert_array_almost_equal(bs, (0, EXPECTED_PARAMS[0]))

nibabel/nicom/tests/test_dicomwrappers.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
else:
3131
DATA = None
3232
DATA_FILE_B0 = pjoin(IO_DATA_PATH, 'siemens_dwi_0.dcm.gz')
33+
DATA_FILE_SLC_NORM = pjoin(IO_DATA_PATH, 'csa_slice_norm.dcm')
3334

3435
# This affine from our converted image was shown to match our image
3536
# spatially with an image from SPM DICOM conversion. We checked the
@@ -48,7 +49,6 @@
4849
0.99997450,
4950
-0.005023611)]
5051

51-
5252
@dicom_test
5353
def test_wrappers():
5454
# test direct wrapper calls
@@ -143,3 +143,14 @@ def test_slice_indicator():
143143
assert_equal(z, dw_1000.slice_indicator)
144144
dw_empty = didw.Wrapper()
145145
assert_true(dw_empty.slice_indicator is None)
146+
147+
@dicom_test
148+
def test_slice_normal():
149+
dw = didw.wrapper_from_file(DATA_FILE_SLC_NORM)
150+
151+
#Test that the slice normal is sufficiently orthogonal
152+
R = dw.rotation_matrix
153+
assert np.allclose(np.eye(3),
154+
np.dot(R, R.T),
155+
atol=1e-6)
156+

0 commit comments

Comments
 (0)