# HG changeset patch # User Sebastien Jodogne # Date 1743857575 -7200 # Node ID be713f91c3e6d9593072859625f410b088fb0a87 # Parent c1838c53851001b99acefa7baaa58d4180fce6aa refactoring diff -r c1838c538510 -r be713f91c3e6 ViewerPlugin/OrthancPyramidFrameFetcher.cpp --- a/ViewerPlugin/OrthancPyramidFrameFetcher.cpp Sat Apr 05 13:28:04 2025 +0200 +++ b/ViewerPlugin/OrthancPyramidFrameFetcher.cpp Sat Apr 05 14:52:55 2025 +0200 @@ -168,6 +168,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } + std::unique_ptr rendered(new Orthanc::Image(targetFormat, paddedWidth, paddedHeight, false)); if (paddedWidth != frame->GetWidth() || @@ -176,29 +177,15 @@ Orthanc::ImageProcessing::Set(*rendered, backgroundRed, backgroundGreen, backgroundBlue, 255 /* alpha */); } - Orthanc::ImageAccessor target; - rendered->GetRegion(target, 0, 0, frame->GetWidth(), frame->GetHeight()); - - Orthanc::ImageAccessor source; - source.AssignReadOnly(sourceFormat, frame->GetWidth(), frame->GetHeight(), frame->GetPitch(), frame->GetBuffer()); - - switch (targetFormat) { - case Orthanc::PixelFormat_RGB24: - Orthanc::ImageProcessing::Copy(target, source); - break; + Orthanc::ImageAccessor target; + rendered->GetRegion(target, 0, 0, frame->GetWidth(), frame->GetHeight()); - case Orthanc::PixelFormat_Grayscale8: - { - double offset, scaling; - info.ComputeRenderingTransform(offset, scaling); // Use the default windowing - Orthanc::ImageProcessing::ShiftScale2(target, source, static_cast(offset), static_cast(scaling), false); - break; - } + Orthanc::ImageAccessor source; + source.AssignReadOnly(sourceFormat, frame->GetWidth(), frame->GetHeight(), frame->GetPitch(), frame->GetBuffer()); - default: - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + Orthanc::ImageProcessing::RenderDefaultWindow(target, info, source); }