Skip to content

Commit

Permalink
handle special photometric interpretation cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed May 9, 2024
1 parent 578934f commit 6ff28fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dicom_unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys, traceback
import pudb
from pydicom.uid import ExplicitVRLittleEndian
__version__ = '1.2.8'
__version__ = '1.3.0'

DISPLAY_TITLE = r"""
_ _ _ _
Expand Down Expand Up @@ -97,7 +97,9 @@ def split_dicom_multiframe(dicom_data_set, output_file):
dicom_data_set.decompress()
for i, slice in enumerate(dicom_data_set.pixel_array):
dicom_data_set.PixelData = slice.tobytes()
dicom_data_set.PhotometricInterpretation = "RGB"
# specifically handle compressed dicoms with YBR_FULL_422 PI
if "YBR_FULL_422" in dicom_data_set.PhotometricInterpretation:
dicom_data_set.PhotometricInterpretation = "YBR_FULL"
dicom_data_set.NumberOfFrames = 1
op_dcm_path = os.path.join(dir_path, f'slice_{i:03n}.dcm')
print(f"Saving file : -->slice_{i:03n}.dcm<--")
Expand Down

0 comments on commit 6ff28fd

Please sign in to comment.