Skip to content

Commit 4969285

Browse files
committed
the other checks were fine, removing breaking changes
1 parent 80fc936 commit 4969285

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

pypet2bids/pypet2bids/dcm2niix4pet.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -568,50 +568,6 @@ def run_dcm2niix(self):
568568
destination_path=tempdir_pathlike
569569
)
570570

571-
# Additionally we want to check to see if the frame timing information is correct
572-
# often a series of dicoms is incomplete (missing files) but dcm2niix can still
573-
# output a nifti at the end. We can compare the outputs of dcm2niix with the
574-
# frame information in the dicom header.
575-
for dicom, matched in matched_dicoms_and_headers.items():
576-
matched_dicom = pydicom.dcmread(
577-
join(self.image_folder, dicom), stop_before_pixels=True
578-
)
579-
matched_json = next(
580-
(f for f in matched if f.endswith(".json")), None
581-
)
582-
matched_nii = next(
583-
(
584-
load(f)
585-
for f in matched
586-
if f.endswith(".nii") or f.endswith(".nii.gz")
587-
),
588-
None,
589-
)
590-
if matched_nii:
591-
try:
592-
nifti_time_dim = matched_nii.shape[3]
593-
except IndexError:
594-
nifti_time_dim = 0
595-
if (
596-
matched_dicom.get("NumberOfTimeSlices")
597-
!= nifti_time_dim
598-
and not self.ignore_dcm2niix_errors
599-
):
600-
raise Exception(
601-
f"NifTi produced has {nifti_time_dim} timing frames, should have {matched_dicom.get('NumberOfTimeSlices')} instead."
602-
)
603-
if matched_json:
604-
with open(matched_json, "r") as infile:
605-
matched_json = json.load(infile)
606-
json_num_frames = len(matched_json.get("FrameDuration", []))
607-
if (
608-
matched_dicom.get("NumberOfTimeSlices")
609-
!= json_num_frames
610-
and not self.ignore_dcm2niix_errors
611-
):
612-
raise Exception(
613-
f"Length of FrameDuration is {json_num_frames} should match {matched_dicom.filename}'s NumberOfTimeSlices value {matched_dicom.get('NumberOfTimeSlices')} instead"
614-
)
615571

616572
# we check to see what's missing from our recommended and required jsons by gathering the
617573
# output of check_json silently

0 commit comments

Comments
 (0)