diff Plugin/DecodedImageAdapter.cpp @ 207:3d3d00e3e715

fix for new ImageAccessor API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Oct 2018 11:44:44 +0200
parents 993dd140bd30
children 2f27287c047c
line wrap: on
line diff
--- a/Plugin/DecodedImageAdapter.cpp	Fri Jul 20 14:25:04 2018 +0200
+++ b/Plugin/DecodedImageAdapter.cpp	Mon Oct 08 11:44:44 2018 +0200
@@ -323,14 +323,14 @@
     switch (accessor.GetFormat())
     {
       case Orthanc::PixelFormat_RGB24:
-        converted = accessor;
+        accessor.GetReadOnlyAccessor(converted);
         break;
 
       case Orthanc::PixelFormat_RGB48:
         buffer.reset(new Orthanc::ImageBuffer(Orthanc::PixelFormat_RGB24,
                                               accessor.GetWidth(),
                                               accessor.GetHeight(), false));
-        converted = buffer->GetAccessor();
+        buffer->GetWriteableAccessor(converted);
         ConvertRGB48ToRGB24(converted, accessor);
         break;
 
@@ -340,12 +340,12 @@
                                               accessor.GetWidth(),
                                               accessor.GetHeight(),
                                               true /* force minimal pitch */));
-        converted = buffer->GetAccessor();
+        buffer->GetWriteableAccessor(converted);
         Orthanc::ImageProcessing::Convert(converted, accessor);
         break;
 
       case Orthanc::PixelFormat_SignedGrayscale16:
-        converted = accessor;
+        accessor.GetReadOnlyAccessor(converted);
         break;
 
       default:
@@ -434,7 +434,7 @@
         accessor.GetFormat() == Orthanc::PixelFormat_RGB24)
     {
       result["Orthanc"]["Stretched"] = false;
-      converted = accessor;
+      accessor.GetReadOnlyAccessor(converted);
     }
     else if (accessor.GetFormat() == Orthanc::PixelFormat_RGB48)
     {
@@ -443,7 +443,8 @@
       buffer.reset(new Orthanc::ImageBuffer(Orthanc::PixelFormat_RGB24,
                                             accessor.GetWidth(),
                                             accessor.GetHeight(), false));
-      converted = buffer->GetAccessor();
+      buffer->GetWriteableAccessor(converted);
+      
       ConvertRGB48ToRGB24(converted, accessor);
     }
     else if (accessor.GetFormat() == Orthanc::PixelFormat_Grayscale16 ||
@@ -455,7 +456,7 @@
                                             accessor.GetWidth(),
                                             accessor.GetHeight(),
                                             true /* force minimal pitch */));
-      converted = buffer->GetAccessor();
+      buffer->GetWriteableAccessor(converted);
 
       int64_t a, b;
       Orthanc::ImageProcessing::GetMinMaxIntegerValue(a, b, accessor);