Mercurial > hg > orthanc-wsi
diff Framework/Inputs/DicomPyramidInstance.cpp @ 166:f0dac1e8f736
access to photometric interpretation of source pyramids
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 12 Jul 2019 09:06:54 +0200 |
parents | 6b8ccfc02051 |
children | e3cbf890b588 |
line wrap: on
line diff
--- a/Framework/Inputs/DicomPyramidInstance.cpp Fri Feb 22 14:28:40 2019 +0100 +++ b/Framework/Inputs/DicomPyramidInstance.cpp Fri Jul 12 09:06:54 2019 +0200 @@ -69,17 +69,21 @@ } - static Orthanc::PixelFormat DetectPixelFormat(OrthancPlugins::DicomDatasetReader& reader) + static void DetectPixelFormat(Orthanc::PixelFormat& format, + Orthanc::PhotometricInterpretation& photometric, + OrthancPlugins::DicomDatasetReader& reader) { using namespace OrthancPlugins; - std::string photometric = Orthanc::Toolbox::StripSpaces + std::string p = Orthanc::Toolbox::StripSpaces (reader.GetMandatoryStringValue(DICOM_TAG_PHOTOMETRIC_INTERPRETATION)); + + photometric = Orthanc::StringToPhotometricInterpretation(p.c_str()); - if (photometric == "PALETTE") + if (photometric == Orthanc::PhotometricInterpretation_Palette) { - LOG(ERROR) << "Unsupported photometric interpretation: " << photometric; - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, + "Unsupported photometric interpretation: " + p); } unsigned int bitsStored, samplesPerPixel, tmp; @@ -97,18 +101,17 @@ samplesPerPixel == 1 && !isSigned) { - return Orthanc::PixelFormat_Grayscale8; + format = Orthanc::PixelFormat_Grayscale8; } else if (bitsStored == 8 && samplesPerPixel == 3 && !isSigned) { - return Orthanc::PixelFormat_RGB24; + format = Orthanc::PixelFormat_RGB24; } else { - LOG(ERROR) << "Unsupported pixel format"; - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Unsupported pixel format"); } } @@ -149,7 +152,7 @@ } hasCompression_ = false; - format_ = DetectPixelFormat(reader); + DetectPixelFormat(format_, photometric_, reader); unsigned int tmp; if (!reader.GetUnsignedIntegerValue(tileWidth_, DICOM_TAG_COLUMNS) ||