Skip to content

Commit 612275b

Browse files
committed
NF - warning for nicom import closes gh-10; error for not mosaic closes gh-11
1 parent 8d6bcb7 commit 612275b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

nibabel/nicom/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@
1919
dwiparams
2020
structreader
2121
"""
22+
import warnings
23+
24+
warnings.warn('The DICOM readers are highly experimental, unstable,'
25+
' and only work for Siemens time-series at the moment\n'
26+
'Please use with caution. We would be grateful for your '
27+
'help in improving them',
28+
UserWarning, stacklevel=2)

nibabel/nicom/dicomreaders.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def read_mosaic_dwi_dir(dicom_path, globber='*.dcm'):
4040

4141

4242
def read_mosaic_dir(dicom_path, globber='*.dcm', check_is_dwi=False):
43-
''' Read all Siemens DICOMs in directory, return arrays, params
43+
''' Read all Siemens mosaic DICOMs in directory, return arrays, params
4444
4545
Parameters
4646
----------
@@ -77,6 +77,11 @@ def read_mosaic_dir(dicom_path, globber='*.dcm', check_is_dwi=False):
7777
raise IOError('Found no files with "%s"' % full_globber)
7878
for fname in filenames:
7979
dcm_w = wrapper_from_file(fname)
80+
# Because the routine sorts by filename, it only makes sense to use this
81+
# order for mosaic images. Slice by slice dicoms need more sensible
82+
# sorting
83+
if not dcm_w.is_mosaic:
84+
raise DicomReadError('data does not appear to be in mosaic format')
8085
arrays.append(dcm_w.get_data()[...,None])
8186
q = dcm_w.q_vector
8287
if q is None: # probably not diffusion

0 commit comments

Comments
 (0)