Skip to content

Commit

Permalink
filter dicoms earlier to avoid crash with XA mutli-planar dicoms
Browse files Browse the repository at this point in the history
  • Loading branch information
bpinsard committed Nov 29, 2024
1 parent 17fdfb4 commit 5493d65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions heudiconv/dicoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ def validate_dicom(
Parse DICOM attributes. Returns None if not valid.
"""
mw = dw.wrapper_from_file(fl, force=True, stop_before_pixels=True)
if dcmfilter is not None and dcmfilter(mw.dcm_data):
lgr.warning("Ignoring %s because of DICOM filter", fl)
return None
# clean series signature
for sig in ("iop", "ICE_Dims", "SequenceName"):
try:
Expand All @@ -189,9 +192,6 @@ def validate_dicom(
except AttributeError as e:
lgr.warning('Ignoring %s since not quite a "normal" DICOM: %s', fl, e)
return None
if dcmfilter is not None and dcmfilter(mw.dcm_data):
lgr.warning("Ignoring %s because of DICOM filter", fl)
return None
if mw.dcm_data[0x0008, 0x0016].repval in (
"Raw Data Storage",
"GrayscaleSoftcopyPresentationStateStorage",
Expand Down

0 comments on commit 5493d65

Please sign in to comment.