# HG changeset patch # User Sebastien Jodogne # Date 1564754595 -7200 # Node ID 1390d5c876030b0ee0c59557c3fb543286682508 # Parent cea9a4701fce4b41010b4f93608f99ed3e0f47cf fix diff -r cea9a4701fce -r 1390d5c87603 Applications/Dicomizer.cpp --- 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 diff -r cea9a4701fce -r 1390d5c87603 Framework/Inputs/DecodedTiledPyramid.h --- 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; - } }; } diff -r cea9a4701fce -r 1390d5c87603 Framework/Inputs/OpenSlidePyramid.h --- 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; + } }; } diff -r cea9a4701fce -r 1390d5c87603 Framework/Inputs/SingleLevelDecodedPyramid.cpp --- 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); + } + } } diff -r cea9a4701fce -r 1390d5c87603 Framework/Inputs/SingleLevelDecodedPyramid.h --- 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; }; }