Skip to content

Commit 702515e

Browse files
authored
Merge pull request #2 from effigies/ignore-bad-csa
TEST: Basic tests for CT DICOM image
2 parents 3efe193 + bebaf9c commit 702515e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

nibabel/nicom/tests/test_dicomwrappers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from nose.tools import (assert_true, assert_false, assert_equal,
2121
assert_not_equal, assert_raises)
2222

23-
from numpy.testing import assert_array_equal, assert_array_almost_equal
23+
from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_warns
2424
from ...tests.nibabel_data import get_nibabel_data, needs_nibabel_data
2525

2626
IO_DATA_PATH = pjoin(dirname(__file__), 'data')
@@ -39,6 +39,8 @@
3939
DATA_FILE_EMPTY_ST = pjoin(IO_DATA_PATH, 'slicethickness_empty_string.dcm')
4040
DATA_FILE_4D_DERIVED = pjoin(get_nibabel_data(), 'nitest-dicom',
4141
'4d_multiframe_with_derived.dcm')
42+
DATA_FILE_CT = pjoin(get_nibabel_data(), 'nitest-dicom',
43+
'siemens_ct_header_csa.dcm')
4244

4345
# This affine from our converted image was shown to match our image spatially
4446
# with an image from SPM DICOM conversion. We checked the matching with SPM
@@ -633,6 +635,13 @@ def test_data_derived_shape(self):
633635
dw = didw.wrapper_from_file(DATA_FILE_4D_DERIVED)
634636
assert_equal(dw.image_shape, (96, 96, 60, 33))
635637

638+
@dicom_test
639+
@needs_nibabel_data('nitest-dicom')
640+
def test_data_unreadable_private_headers(self):
641+
# Test CT image with unreadable CSA tags
642+
dw = assert_warns(UserWarning, didw.wrapper_from_file, DATA_FILE_CT)
643+
assert_equal(dw.image_shape, (512, 571))
644+
636645
@dicom_test
637646
def test_data_fake(self):
638647
# Test algorithm for get_data

0 commit comments

Comments
 (0)