changeset 1486:b931ddbe070e

preserve aspect ratio in SeriesThumbnailsLoader
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 23 Jun 2020 07:50:14 +0200
parents 60be4627ae52
children 7f16987131e1 5d892f5dd9c4
files Framework/Loaders/SeriesThumbnailsLoader.cpp
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Loaders/SeriesThumbnailsLoader.cpp	Mon Jun 22 21:07:39 2020 +0200
+++ b/Framework/Loaders/SeriesThumbnailsLoader.cpp	Tue Jun 23 07:50:14 2020 +0200
@@ -562,19 +562,16 @@
 
       if (frame->GetFormat() == Orthanc::PixelFormat_RGB24)
       {
-        thumbnail.reset(Orthanc::ImageProcessing::FitSize(*frame, width_, height_));
+        thumbnail.reset(Orthanc::ImageProcessing::FitSizeKeepAspectRatio(*frame, width_, height_));
       }
       else
       {
-        const unsigned int width = frame->GetWidth();
-        const unsigned int height = frame->GetHeight();
-
         std::unique_ptr<Orthanc::ImageAccessor> converted(
-          new Orthanc::Image(Orthanc::PixelFormat_Float32, width, height, false));
+          new Orthanc::Image(Orthanc::PixelFormat_Float32, frame->GetWidth(), frame->GetHeight(), false));
         Orthanc::ImageProcessing::Convert(*converted, *frame);
 
         std::unique_ptr<Orthanc::ImageAccessor> resized(
-          Orthanc::ImageProcessing::FitSize(*converted, width, height));
+          Orthanc::ImageProcessing::FitSizeKeepAspectRatio(*converted, width_, height_));
       
         float minValue, maxValue;
         Orthanc::ImageProcessing::GetMinMaxFloatValue(minValue, maxValue, *resized);
@@ -589,7 +586,7 @@
 
         converted.reset(NULL);
 
-        thumbnail.reset(new Orthanc::Image(Orthanc::PixelFormat_Grayscale8, width, height, false));
+        thumbnail.reset(new Orthanc::Image(Orthanc::PixelFormat_Grayscale8, width_, height_, false));
         Orthanc::ImageProcessing::Convert(*thumbnail, *resized);
       }