Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/OrthancSlicesLoader.cpp @ 203:431e991af593
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 27 Mar 2018 11:12:50 +0200 |
parents | e9c7a78a3e77 |
children | 5412adf19980 |
comparison
equal
deleted
inserted
replaced
202:e7f90aba3c97 | 203:431e991af593 |
---|---|
608 } | 608 } |
609 | 609 |
610 // Decode a grayscale JPEG 8bpp image coming from the Web viewer | 610 // Decode a grayscale JPEG 8bpp image coming from the Web viewer |
611 std::auto_ptr<Orthanc::ImageAccessor> image | 611 std::auto_ptr<Orthanc::ImageAccessor> image |
612 (new Orthanc::Image(expectedFormat, reader->GetWidth(), reader->GetHeight(), false)); | 612 (new Orthanc::Image(expectedFormat, reader->GetWidth(), reader->GetHeight(), false)); |
613 | 613 |
614 float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f; | |
615 float offset = static_cast<float>(stretchLow) / scaling; | |
616 | |
617 Orthanc::ImageProcessing::Convert(*image, *reader); | 614 Orthanc::ImageProcessing::Convert(*image, *reader); |
618 reader.reset(NULL); | 615 reader.reset(NULL); |
619 | 616 |
620 Orthanc::ImageProcessing::ShiftScale(*image, offset, scaling, true); | 617 float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f; |
618 | |
619 if (!LinearAlgebra::IsCloseToZero(scaling)) | |
620 { | |
621 float offset = static_cast<float>(stretchLow) / scaling; | |
622 Orthanc::ImageProcessing::ShiftScale(*image, offset, scaling, true); | |
623 } | |
621 | 624 |
622 NotifySliceImageSuccess(operation, image); | 625 NotifySliceImageSuccess(operation, image); |
623 } | 626 } |
624 | 627 |
625 | 628 |