Skip to content

Commit 4ce1119

Browse files
committed
reorder again to improve testcov: clean signatures at the end
1 parent 357c109 commit 4ce1119

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

heudiconv/dicoms.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,6 @@ 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
175-
# clean series signature
176-
for sig in ("iop", "ICE_Dims", "SequenceName"):
177-
try:
178-
del mw.series_signature[sig]
179-
except KeyError:
180-
pass
181172
# Workaround for protocol name in private siemens csa header
182173
if not getattr(mw.dcm_data, "ProtocolName", "").strip():
183174
mw.dcm_data.ProtocolName = (
@@ -203,6 +194,15 @@ def validate_dicom(
203194
except AttributeError:
204195
lgr.info("File {} is missing any StudyInstanceUID".format(fl))
205196
file_studyUID = None
197+
if dcmfilter is not None and dcmfilter(mw.dcm_data):
198+
lgr.warning("Ignoring %s because of DICOM filter", fl)
199+
return None
200+
# clean series signature
201+
for sig in ("iop", "ICE_Dims", "SequenceName"):
202+
try:
203+
del mw.series_signature[sig]
204+
except KeyError:
205+
pass
206206
return mw, series_id, file_studyUID
207207

208208

0 commit comments

Comments
 (0)