Mercurial > hg > orthanc-wsi
diff Framework/ImageToolbox.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 | cea9a4701fce |
line wrap: on
line diff
--- a/Framework/ImageToolbox.cpp Fri Jul 12 09:06:54 2019 +0200 +++ b/Framework/ImageToolbox.cpp Fri Jul 12 12:00:31 2019 +0200 @@ -158,6 +158,25 @@ } + Orthanc::ImageAccessor* DecodeRawTile(const std::string& source, + Orthanc::PixelFormat format, + unsigned int width, + unsigned int height) + { + unsigned int bpp = GetBytesPerPixel(format); + + if (bpp * width * height != source.size()) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize); + } + + Orthanc::ImageAccessor accessor; + accessor.AssignReadOnly(format, width, height, bpp * width, source.empty() ? NULL : source.c_str()); + + return Orthanc::Image::Clone(accessor); + } + + void EncodeTile(std::string& target, const Orthanc::ImageAccessor& source, ImageCompression compression,