From 1d02c328d1f7aee028d5d61c124d2aff11396603 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Wed, 15 Sep 2021 15:45:36 +0200 Subject: [PATCH] Properly set Pixel Presentation (#105) Pixel Presentation != Pixel Representation For reference: http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.16.2.html#table_C.8-131 --- src/highdicom/legacy/sop.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/highdicom/legacy/sop.py b/src/highdicom/legacy/sop.py index b592e019..306ac02b 100644 --- a/src/highdicom/legacy/sop.py +++ b/src/highdicom/legacy/sop.py @@ -189,7 +189,10 @@ def _convert_legacy_to_enhanced( unique_image_types.add(tuple(frame_type)) frame_type_item = Dataset() frame_type_item.FrameType = frame_type - frame_type_item.PixelRepresentation = pixel_representation + if pixel_representation == 0: + frame_type_item.PixelPresentation = 'MONOCHROME' + else: + frame_type_item.PixelPresentation = 'COLOR' frame_type_item.VolumetricProperties = volumetric_properties if frame_type[0] == 'ORIGINAL': frame_type_item.VolumeBasedCalculationTechnique = 'NONE' @@ -335,7 +338,10 @@ def _convert_legacy_to_enhanced( mf_dataset.ImageType = list(list(unique_image_types)[0]) if len(unique_image_types) > 1: mf_dataset.ImageType[2] = 'MIXED' - mf_dataset.PixelRepresentation = pixel_representation + if pixel_representation == 0: + mf_dataset.PixelPresentation = 'MONOCHROME' + else: + mf_dataset.PixelPresentation = 'COLOR' mf_dataset.VolumetricProperties = volumetric_properties # Shared Functional Groups