Mercurial > hg > orthanc-stone
changeset 203:431e991af593
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 27 Mar 2018 11:12:50 +0200 |
parents | e7f90aba3c97 |
children | 9d269d7cfeb8 |
files | Framework/Toolbox/OrthancSlicesLoader.cpp |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp Mon Mar 26 18:10:34 2018 +0200 +++ b/Framework/Toolbox/OrthancSlicesLoader.cpp Tue Mar 27 11:12:50 2018 +0200 @@ -610,14 +610,17 @@ // Decode a grayscale JPEG 8bpp image coming from the Web viewer std::auto_ptr<Orthanc::ImageAccessor> image (new Orthanc::Image(expectedFormat, reader->GetWidth(), reader->GetHeight(), false)); + + Orthanc::ImageProcessing::Convert(*image, *reader); + reader.reset(NULL); float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f; - float offset = static_cast<float>(stretchLow) / scaling; - - Orthanc::ImageProcessing::Convert(*image, *reader); - reader.reset(NULL); - - Orthanc::ImageProcessing::ShiftScale(*image, offset, scaling, true); + + if (!LinearAlgebra::IsCloseToZero(scaling)) + { + float offset = static_cast<float>(stretchLow) / scaling; + Orthanc::ImageProcessing::ShiftScale(*image, offset, scaling, true); + } NotifySliceImageSuccess(operation, image); }