Compare commits

...

2 Commits

View File

@ -1,5 +1,5 @@
# ev-to-dicom
# Copyright © 2023–2024 Lee Yingtong Li
# Copyright © 2023–2025 Lee Yingtong Li
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -86,14 +86,19 @@ def ev_files_to_dcm_file(study_uid, series_uid, series_number, image_number, inp
ds.InstitutionName = metadata['metadata']['institutionName']
ds.PatientAge = metadata['metadata']['patientAge']
ds.SamplesPerPixel = 3 if metadata['color'] else 1
ds.PixelRepresentation = 1 if metadata['isSigned'] else 0
if 'isSigned' in metadata:
ds.PixelRepresentation = 1 if metadata['isSigned'] else 0
else:
ds.PixelRepresentation = 1 if metadata['signed'] else 0
#ds.BitsAllocated = metadata['bytesPerSample'] * 8 # Incorrect value!
#ds.BitsStored = metadata['bytesPerSample'] * 8
ds.Columns = metadata['columns']
ds.WindowCenter = metadata['windowCenter']
if 'windowCenter' in metadata:
ds.WindowCenter = metadata['windowCenter']
ds.LossyImageCompression = '01' if metadata['isLossyImage'] else '00'
ds.PixelSpacing = [metadata['rowPixelSpacing'], metadata['columnPixelSpacing']]
ds.WindowWidth = metadata['windowWidth']
if 'windowWidth' in metadata:
ds.WindowWidth = metadata['windowWidth']
ds.PlanarConfiguration = 1 if metadata['planarConfiguration'] else 0
ds.Rows = metadata['rows']