@@ -1102,15 +1102,15 @@ def convert_single_frame_dicom_series_to_multiframe(
11021102 # CRITICAL: Remove top-level ImagePositionPatient and ImageOrientationPatient
11031103 # Working files (that display correctly in OHIF MPR) have NEITHER at top level
11041104 # These should ONLY exist in functional groups for Enhanced CT
1105-
1105+
11061106 if hasattr (output_ds , "ImagePositionPatient" ):
11071107 delattr (output_ds , "ImagePositionPatient" )
11081108 logger .info (f" ✓ Removed top-level ImagePositionPatient (use per-frame only)" )
1109-
1109+
11101110 if hasattr (output_ds , "ImageOrientationPatient" ):
11111111 delattr (output_ds , "ImageOrientationPatient" )
11121112 logger .info (f" ✓ Removed top-level ImageOrientationPatient (use SharedFunctionalGroupsSequence only)" )
1113-
1113+
11141114 # CRITICAL: Set correct SOPClassUID for Enhanced multi-frame CT
11151115 output_ds .SOPClassUID = "1.2.840.10008.5.1.4.1.1.2.1" # Enhanced CT Image Storage
11161116 logger .info (f" ✓ Set SOPClassUID to Enhanced CT Image Storage" )
@@ -1169,7 +1169,9 @@ def convert_single_frame_dicom_series_to_multiframe(
11691169 else :
11701170 # If missing, use default (0,0,frame_idx * spacing)
11711171 # This shouldn't happen for valid CT series, but ensures MPR compatibility
1172- default_spacing = float (output_ds .SpacingBetweenSlices ) if hasattr (output_ds , 'SpacingBetweenSlices' ) else 1.0
1172+ default_spacing = (
1173+ float (output_ds .SpacingBetweenSlices ) if hasattr (output_ds , "SpacingBetweenSlices" ) else 1.0
1174+ )
11731175 plane_pos_item .ImagePositionPatient = [0.0 , 0.0 , frame_idx * default_spacing ]
11741176 logger .warning (f" Frame { frame_idx } missing ImagePositionPatient, using default" )
11751177 frame_item .PlanePositionSequence = Sequence ([plane_pos_item ])
0 commit comments