comparison Framework/Outputs/MultiframeDicomWriter.cpp @ 167:605247fc8758

Fix issue #144 (OrthancWSIDicomizer PhotometricInterpretation)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2019 12:00:31 +0200
parents 6b8ccfc02051
children e3cbf890b588
comparison
equal deleted inserted replaced
166:f0dac1e8f736 167:605247fc8758
145 ImageCompression compression, 145 ImageCompression compression,
146 Orthanc::PixelFormat pixelFormat, 146 Orthanc::PixelFormat pixelFormat,
147 unsigned int width, 147 unsigned int width,
148 unsigned int height, 148 unsigned int height,
149 unsigned int tileWidth, 149 unsigned int tileWidth,
150 unsigned int tileHeight) : 150 unsigned int tileHeight,
151 Orthanc::PhotometricInterpretation photometric) :
151 compression_(compression), 152 compression_(compression),
152 width_(width), 153 width_(width),
153 height_(height) 154 height_(height)
154 { 155 {
155 switch (compression) 156 switch (compression)
185 DicomToolbox::SetUint16Tag(sharedTags_, DCM_Rows, tileHeight); 186 DicomToolbox::SetUint16Tag(sharedTags_, DCM_Rows, tileHeight);
186 DicomToolbox::SetUint16Tag(sharedTags_, DCM_BitsAllocated, 8); 187 DicomToolbox::SetUint16Tag(sharedTags_, DCM_BitsAllocated, 8);
187 DicomToolbox::SetUint16Tag(sharedTags_, DCM_BitsStored, 8); 188 DicomToolbox::SetUint16Tag(sharedTags_, DCM_BitsStored, 8);
188 DicomToolbox::SetUint16Tag(sharedTags_, DCM_HighBit, 7); 189 DicomToolbox::SetUint16Tag(sharedTags_, DCM_HighBit, 7);
189 DicomToolbox::SetUint16Tag(sharedTags_, DCM_PixelRepresentation, 0); // Unsigned values 190 DicomToolbox::SetUint16Tag(sharedTags_, DCM_PixelRepresentation, 0); // Unsigned values
191 DicomToolbox::SetStringTag(sharedTags_, DCM_PhotometricInterpretation, Orthanc::EnumerationToString(photometric));
190 192
191 switch (pixelFormat) 193 switch (pixelFormat)
192 { 194 {
193 case Orthanc::PixelFormat_RGB24: 195 case Orthanc::PixelFormat_RGB24:
194 uncompressedFrameSize_ = 3 * tileWidth * tileHeight; 196 uncompressedFrameSize_ = 3 * tileWidth * tileHeight;
195 DicomToolbox::SetUint16Tag(sharedTags_, DCM_SamplesPerPixel, 3); 197 DicomToolbox::SetUint16Tag(sharedTags_, DCM_SamplesPerPixel, 3);
196
197 if (compression_ == ImageCompression_Jpeg)
198 {
199 DicomToolbox::SetStringTag(sharedTags_, DCM_PhotometricInterpretation, "YBR_FULL_422");
200 }
201 else
202 {
203 DicomToolbox::SetStringTag(sharedTags_, DCM_PhotometricInterpretation, "RGB");
204 }
205
206 break; 198 break;
207 199
208 case Orthanc::PixelFormat_Grayscale8: 200 case Orthanc::PixelFormat_Grayscale8:
209 uncompressedFrameSize_ = tileWidth * tileHeight; 201 uncompressedFrameSize_ = tileWidth * tileHeight;
210 DicomToolbox::SetUint16Tag(sharedTags_, DCM_SamplesPerPixel, 1); 202 DicomToolbox::SetUint16Tag(sharedTags_, DCM_SamplesPerPixel, 1);
211 DicomToolbox::SetStringTag(sharedTags_, DCM_PhotometricInterpretation, "MONOCHROME2");
212 break; 203 break;
213 204
214 default: 205 default:
215 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 206 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
216 } 207 }