From 99283145f45f10dd67c2de7a71b9b7a8d2c6d20c Mon Sep 17 00:00:00 2001 From: "sandipsamal117@gmail.com" Date: Mon, 1 Apr 2024 19:08:15 -0400 Subject: [PATCH] change transfer syntax UID and LUT space --- dicommake.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dicommake.py b/dicommake.py index a8844dd..54d7939 100644 --- a/dicommake.py +++ b/dicommake.py @@ -19,6 +19,7 @@ from PIL import Image import numpy as np from loguru import logger +from pydicom.uid import ExplicitVRLittleEndian LOG = logger.debug logger_format = ( "{time:YYYY-MM-DD HH:mm:ss} │ " @@ -34,7 +35,7 @@ -__version__ = '2.2.6' +__version__ = '2.2.8' DISPLAY_TITLE = r""" _ _ _ _ @@ -137,6 +138,14 @@ def npimage_get(image): ds.BitsAllocated = 8 ds.HighBit = 7 ds.PixelRepresentation = 0 + + # The changes in `pfdcm` made to use `oxidicom` to receive PACS files from a server + # changes the TransferSyntaxUID of a DICOM file to 'lossy JPEG compression'. Since the image + # file itself isn't compressed, saving it as a DICOM file would throw error. + # The below fix handles this. + # We change the transfer syntax UID (https://github.com/pydicom/pydicom/issues/1109) + ds.PresentationLUTShape = '' + ds.file_meta.TransferSyntaxUID = ExplicitVRLittleEndian ds.PixelData = np_image.tobytes() ds.AcquisitionTime = AcquisitionTime() ds.AcquisitionDate = AcquisitionDate()