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()