comparison Core/DicomFormat/DicomImageInformation.cpp @ 1905:8b1baa2315b8

Huge speedup if decoding the family of JPEG transfer syntaxes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Jan 2016 17:25:01 +0100
parents b1291df2f780
children 5096681efce6
comparison
equal deleted inserted replaced
1904:4be8accf8768 1905:8b1baa2315b8
216 isPlanar_ = (planarConfiguration != 0 ? true : false); 216 isPlanar_ = (planarConfiguration != 0 ? true : false);
217 isSigned_ = (pixelRepresentation != 0 ? true : false); 217 isSigned_ = (pixelRepresentation != 0 ? true : false);
218 } 218 }
219 219
220 220
221 bool DicomImageInformation::ExtractPixelFormat(PixelFormat& format) const 221 bool DicomImageInformation::ExtractPixelFormat(PixelFormat& format,
222 bool ignorePhotometricInterpretation) const
222 { 223 {
223 if (photometric_ == PhotometricInterpretation_Monochrome1 || 224 if (photometric_ == PhotometricInterpretation_Palette)
225 {
226 return false;
227 }
228
229 if (ignorePhotometricInterpretation ||
230 photometric_ == PhotometricInterpretation_Monochrome1 ||
224 photometric_ == PhotometricInterpretation_Monochrome2) 231 photometric_ == PhotometricInterpretation_Monochrome2)
225 { 232 {
226 if (GetBitsStored() == 8 && GetChannelCount() == 1 && !IsSigned()) 233 if (GetBitsStored() == 8 && GetChannelCount() == 1 && !IsSigned())
227 { 234 {
228 format = PixelFormat_Grayscale8; 235 format = PixelFormat_Grayscale8;
243 } 250 }
244 251
245 if (GetBitsStored() == 8 && 252 if (GetBitsStored() == 8 &&
246 GetChannelCount() == 3 && 253 GetChannelCount() == 3 &&
247 !IsSigned() && 254 !IsSigned() &&
248 photometric_ == PhotometricInterpretation_RGB) 255 (ignorePhotometricInterpretation || photometric_ == PhotometricInterpretation_RGB))
249 { 256 {
250 format = PixelFormat_RGB24; 257 format = PixelFormat_RGB24;
251 return true; 258 return true;
252 } 259 }
253 260