Skip to content

Commit 357c109

Browse files
committed
make repronim dicom filter more robust, due to filtering earlier
1 parent 5493d65 commit 357c109

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

heudiconv/heuristics/reproin.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def _delete_chars(from_str: str, deletechars: str) -> str:
226226

227227
def filter_dicom(dcmdata: dcm.dataset.Dataset) -> bool:
228228
"""Return True if a DICOM dataset should be filtered out, else False"""
229-
return True if dcmdata.StudyInstanceUID in dicoms2skip else False
229+
return True if dcmdata.get("StudyInstanceUID") in dicoms2skip else False
230230

231231

232232
def filter_files(_fn: str) -> bool:
@@ -406,7 +406,11 @@ def infotodict(
406406
# XXX: skip derived sequences, we don't store them to avoid polluting
407407
# the directory, unless it is the motion corrected ones
408408
# (will get _rec-moco suffix)
409-
if skip_derived and curr_seqinfo.is_derived and not curr_seqinfo.is_motion_corrected:
409+
if (
410+
skip_derived
411+
and curr_seqinfo.is_derived
412+
and not curr_seqinfo.is_motion_corrected
413+
):
410414
skipped.append(curr_seqinfo.series_id)
411415
lgr.debug("Ignoring derived data %s", curr_seqinfo.series_id)
412416
continue
@@ -552,7 +556,10 @@ def infotodict(
552556
# XXX if we have a known earlier study, we need to always
553557
# increase the run counter for phasediff because magnitudes
554558
# were not acquired
555-
if get_study_hash([curr_seqinfo]) == "9d148e2a05f782273f6343507733309d":
559+
if (
560+
get_study_hash([curr_seqinfo])
561+
== "9d148e2a05f782273f6343507733309d"
562+
):
556563
current_run += 1
557564
else:
558565
raise RuntimeError(

0 commit comments

Comments
 (0)