Mercurial > hg > orthanc-wsi
changeset 171:1390d5c87603
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Aug 2019 16:03:15 +0200 |
parents | cea9a4701fce |
children | 11413cc2b9d6 |
files | Applications/Dicomizer.cpp Framework/Inputs/DecodedTiledPyramid.h Framework/Inputs/OpenSlidePyramid.h Framework/Inputs/SingleLevelDecodedPyramid.cpp Framework/Inputs/SingleLevelDecodedPyramid.h |
diffstat | 5 files changed, 42 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp Fri Aug 02 15:31:19 2019 +0200 +++ b/Applications/Dicomizer.cpp Fri Aug 02 16:03:15 2019 +0200 @@ -194,20 +194,27 @@ { // The tiles of the source image will be re-encoded transcoding = false; - - switch (parameters.GetTargetCompression()) + + if (source.GetPixelFormat() == Orthanc::PixelFormat_Grayscale8) + { + targetPhotometric = source.GetPhotometricInterpretation(); + } + else { - case OrthancWSI::ImageCompression_Jpeg: - case OrthancWSI::ImageCompression_Jpeg2000: - targetPhotometric = Orthanc::PhotometricInterpretation_YBRFull422; - break; + switch (parameters.GetTargetCompression()) + { + case OrthancWSI::ImageCompression_Jpeg: + case OrthancWSI::ImageCompression_Jpeg2000: + targetPhotometric = Orthanc::PhotometricInterpretation_YBRFull422; + break; - case OrthancWSI::ImageCompression_None: - targetPhotometric = Orthanc::PhotometricInterpretation_RGB; - break; + case OrthancWSI::ImageCompression_None: + targetPhotometric = Orthanc::PhotometricInterpretation_RGB; + break; - default: - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + default: + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + } } } else
--- a/Framework/Inputs/DecodedTiledPyramid.h Fri Aug 02 15:31:19 2019 +0200 +++ b/Framework/Inputs/DecodedTiledPyramid.h Fri Aug 02 16:03:15 2019 +0200 @@ -34,6 +34,7 @@ class DecodedTiledPyramid : public ITiledPyramid { private: + bool grayscale_; uint8_t backgroundColor_[3]; protected: @@ -68,10 +69,5 @@ { return false; // No access to the raw tiles } - - virtual Orthanc::PhotometricInterpretation GetPhotometricInterpretation() const - { - return Orthanc::PhotometricInterpretation_RGB; - } }; }
--- a/Framework/Inputs/OpenSlidePyramid.h Fri Aug 02 15:31:19 2019 +0200 +++ b/Framework/Inputs/OpenSlidePyramid.h Fri Aug 02 16:03:15 2019 +0200 @@ -73,5 +73,10 @@ { return Orthanc::PixelFormat_RGB24; } + + virtual Orthanc::PhotometricInterpretation GetPhotometricInterpretation() const + { + return Orthanc::PhotometricInterpretation_RGB; + } }; }
--- a/Framework/Inputs/SingleLevelDecodedPyramid.cpp Fri Aug 02 15:31:19 2019 +0200 +++ b/Framework/Inputs/SingleLevelDecodedPyramid.cpp Fri Aug 02 16:03:15 2019 +0200 @@ -58,4 +58,20 @@ return image_.GetHeight(); } + + + Orthanc::PhotometricInterpretation SingleLevelDecodedPyramid::GetPhotometricInterpretation() const + { + switch (image_.GetFormat()) + { + case Orthanc::PixelFormat_Grayscale8: + return Orthanc::PhotometricInterpretation_Monochrome2; + + case Orthanc::PixelFormat_RGB24: + return Orthanc::PhotometricInterpretation_RGB; + + default: + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + } + } }
--- a/Framework/Inputs/SingleLevelDecodedPyramid.h Fri Aug 02 15:31:19 2019 +0200 +++ b/Framework/Inputs/SingleLevelDecodedPyramid.h Fri Aug 02 16:03:15 2019 +0200 @@ -74,5 +74,7 @@ { return image_.GetFormat(); } + + virtual Orthanc::PhotometricInterpretation GetPhotometricInterpretation() const; }; }