Skip to content

Commit

Permalink
reorder again to improve testcov: clean signatures at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
bpinsard committed Dec 13, 2024
1 parent 357c109 commit 4ce1119
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions heudiconv/dicoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,6 @@ 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:
del mw.series_signature[sig]
except KeyError:
pass
# Workaround for protocol name in private siemens csa header
if not getattr(mw.dcm_data, "ProtocolName", "").strip():
mw.dcm_data.ProtocolName = (
Expand All @@ -203,6 +194,15 @@ def validate_dicom(
except AttributeError:
lgr.info("File {} is missing any StudyInstanceUID".format(fl))
file_studyUID = None
if dcmfilter is not None and dcmfilter(mw.dcm_data):
lgr.warning("Ignoring %s because of DICOM filter", fl)
return None

Check warning on line 199 in heudiconv/dicoms.py

View check run for this annotation

Codecov / codecov/patch

heudiconv/dicoms.py#L198-L199

Added lines #L198 - L199 were not covered by tests
# clean series signature
for sig in ("iop", "ICE_Dims", "SequenceName"):
try:
del mw.series_signature[sig]
except KeyError:
pass
return mw, series_id, file_studyUID


Expand Down

0 comments on commit 4ce1119

Please sign in to comment.