Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "nibabel-data/nitest-dicom"]
path = nibabel-data/nitest-dicom
url = https://github.com/effigies/nitest-dicom
[submodule "nibabel-data/dcm_qa_xa30"]
path = nibabel-data/dcm_qa_xa30
url = https://github.com/neurolabusc/dcm_qa_xa30.git
1 change: 1 addition & 0 deletions nibabel-data/dcm_qa_xa30
Submodule dcm_qa_xa30 added at 89b250
5 changes: 4 additions & 1 deletion nibabel/nicom/dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,14 @@ def image_shape(self):
if hasattr(first_frame, 'get') and first_frame.get([0x18, 0x9117]):
# DWI image may include derived isotropic, ADC or trace volume
try:
self.frames = pydicom.Sequence(
anisotropic = pydicom.Sequence(
frame
for frame in self.frames
if frame.MRDiffusionSequence[0].DiffusionDirectionality != 'ISOTROPIC'
)
# Image contains DWI volumes followed by derived images; remove derived images
if len(anisotropic) != 0:
self.frames = anisotropic
except IndexError:
# Sequence tag is found but missing items!
raise WrapperError('Diffusion file missing information')
Expand Down
12 changes: 12 additions & 0 deletions nibabel/nicom/tests/test_dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
DATA_FILE_EMPTY_ST = pjoin(IO_DATA_PATH, 'slicethickness_empty_string.dcm')
DATA_FILE_4D_DERIVED = pjoin(get_nibabel_data(), 'nitest-dicom', '4d_multiframe_with_derived.dcm')
DATA_FILE_CT = pjoin(get_nibabel_data(), 'nitest-dicom', 'siemens_ct_header_csa.dcm')
DATA_FILE_SIEMENS_TRACE = pjoin(
get_nibabel_data(),
'dcm_qa_xa30',
'In/20_DWI_dir80_AP/0001_1.3.12.2.1107.5.2.43.67093.2022071112140611403312307.dcm',
)

# This affine from our converted image was shown to match our image spatially
# with an image from SPM DICOM conversion. We checked the matching with SPM
Expand Down Expand Up @@ -656,6 +661,13 @@ def test_data_derived_shape(self):
with pytest.warns(UserWarning, match='Derived images found and removed'):
assert dw.image_shape == (96, 96, 60, 33)

@dicom_test
@needs_nibabel_data('dcm_qa_xa30')
def test_data_trace(self):
# Test that a standalone trace volume is found and not dropped
dw = didw.wrapper_from_file(DATA_FILE_SIEMENS_TRACE)
assert dw.image_shape == (72, 72, 39, 1)

@dicom_test
@needs_nibabel_data('nitest-dicom')
def test_data_unreadable_private_headers(self):
Expand Down