Skip to content

Commit 5493d65

Browse files
committed
filter dicoms earlier to avoid crash with XA mutli-planar dicoms
1 parent 17fdfb4 commit 5493d65

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

heudiconv/dicoms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ def validate_dicom(
169169
Parse DICOM attributes. Returns None if not valid.
170170
"""
171171
mw = dw.wrapper_from_file(fl, force=True, stop_before_pixels=True)
172+
if dcmfilter is not None and dcmfilter(mw.dcm_data):
173+
lgr.warning("Ignoring %s because of DICOM filter", fl)
174+
return None
172175
# clean series signature
173176
for sig in ("iop", "ICE_Dims", "SequenceName"):
174177
try:
@@ -189,9 +192,6 @@ def validate_dicom(
189192
except AttributeError as e:
190193
lgr.warning('Ignoring %s since not quite a "normal" DICOM: %s', fl, e)
191194
return None
192-
if dcmfilter is not None and dcmfilter(mw.dcm_data):
193-
lgr.warning("Ignoring %s because of DICOM filter", fl)
194-
return None
195195
if mw.dcm_data[0x0008, 0x0016].repval in (
196196
"Raw Data Storage",
197197
"GrayscaleSoftcopyPresentationStateStorage",

0 commit comments

Comments
 (0)