Skip to content

Commit 4f51a22

Browse files
committed
Revert
1 parent 5d29589 commit 4f51a22

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

monailabel/datastore/utils/convert_htj2k.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,21 +1099,19 @@ def convert_single_frame_dicom_series_to_multiframe(
10991099
setattr(output_ds, attr, default)
11001100
logger.warning(f" ⚠️ Added missing {attr} = {default}")
11011101

1102-
# CRITICAL FIX #1: Remove top-level ImagePositionPatient
1103-
# OHIF reads this for ALL frames instead of per-frame values → spacing[2] = 0
1102+
# CRITICAL: Remove top-level ImagePositionPatient and ImageOrientationPatient
1103+
# Working files (that display correctly in OHIF MPR) have NEITHER at top level
1104+
# These should ONLY exist in functional groups for Enhanced CT
1105+
11041106
if hasattr(output_ds, "ImagePositionPatient"):
11051107
delattr(output_ds, "ImagePositionPatient")
11061108
logger.info(f" ✓ Removed top-level ImagePositionPatient (use per-frame only)")
11071109

1108-
# CRITICAL FIX #2: Keep ImageOrientationPatient at top level
1109-
# OHIF needs this to recognize file as MPR-capable
1110-
# Safe to keep since orientation is the same for all frames
1111-
if hasattr(datasets[0], "ImageOrientationPatient"):
1112-
output_ds.ImageOrientationPatient = datasets[0].ImageOrientationPatient
1113-
logger.info(f" ✓ Kept top-level ImageOrientationPatient: {output_ds.ImageOrientationPatient}")
1110+
if hasattr(output_ds, "ImageOrientationPatient"):
1111+
delattr(output_ds, "ImageOrientationPatient")
1112+
logger.info(f" ✓ Removed top-level ImageOrientationPatient (use SharedFunctionalGroupsSequence only)")
11141113

1115-
# CRITICAL FIX #3: Set correct SOPClassUID for Enhanced multi-frame CT
1116-
# Use Enhanced CT Image Storage (not legacy CT Image Storage)
1114+
# CRITICAL: Set correct SOPClassUID for Enhanced multi-frame CT
11171115
output_ds.SOPClassUID = "1.2.840.10008.5.1.4.1.1.2.1" # Enhanced CT Image Storage
11181116
logger.info(f" ✓ Set SOPClassUID to Enhanced CT Image Storage")
11191117

0 commit comments

Comments
 (0)