diff UnitTestsSources/FromDcmtkTests.cpp @ 2861:9b4251721f22

ImageAccessor now non-copyable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Oct 2018 17:46:02 +0200
parents 6db878376018
children 8b331be57606
line wrap: on
line diff
--- a/UnitTestsSources/FromDcmtkTests.cpp	Wed Oct 03 16:13:19 2018 +0200
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Fri Oct 05 17:46:02 2018 +0200
@@ -191,17 +191,20 @@
     img.SetHeight(256);
     img.SetFormat(PixelFormat_Grayscale16);
 
+    ImageAccessor accessor;
+    img.GetWriteableAccessor(accessor);
+    
     uint16_t v = 0;
     for (unsigned int y = 0; y < img.GetHeight(); y++)
     {
-      uint16_t *p = reinterpret_cast<uint16_t*>(img.GetAccessor().GetRow(y));
+      uint16_t *p = reinterpret_cast<uint16_t*>(accessor.GetRow(y));
       for (unsigned int x = 0; x < img.GetWidth(); x++, p++, v++)
       {
         *p = v;
       }
     }
 
-    o.EmbedImage(img.GetAccessor());
+    o.EmbedImage(accessor);
     o.SaveToFile("UnitTestsResults/png4.dcm");
   }
 }
@@ -866,9 +869,12 @@
     }
   }
 
-  Orthanc::ImageAccessor r = image.GetRegion(32, 32, 64, 192);
-  Orthanc::ImageProcessing::Set(r, 0); 
-  r = image.GetRegion(160, 32, 64, 192);
+  Orthanc::ImageAccessor r;
+
+  image.GetRegion(r, 32, 32, 64, 192);
+  Orthanc::ImageProcessing::Set(r, 0);
+  
+  image.GetRegion(r, 160, 32, 64, 192);
   Orthanc::ImageProcessing::Set(r, 255); 
 
   {
@@ -982,9 +988,12 @@
     }
   }
 
-  Orthanc::ImageAccessor r = image.GetRegion(32, 32, 64, 192);
-  Orthanc::ImageProcessing::Set(r, 0); 
-  r = image.GetRegion(160, 32, 64, 192);
+  Orthanc::ImageAccessor r;
+  
+  image.GetRegion(r, 32, 32, 64, 192);
+  Orthanc::ImageProcessing::Set(r, 0);
+  
+  image.GetRegion(r, 160, 32, 64, 192);
   Orthanc::ImageProcessing::Set(r, 65535); 
 
   {
@@ -1036,9 +1045,11 @@
     }
   }
 
-  Orthanc::ImageAccessor r = image.GetRegion(32, 32, 64, 192);
-  Orthanc::ImageProcessing::Set(r, -32768); 
-  r = image.GetRegion(160, 32, 64, 192);
+  Orthanc::ImageAccessor r;
+  image.GetRegion(r, 32, 32, 64, 192);
+  Orthanc::ImageProcessing::Set(r, -32768);
+  
+  image.GetRegion(r, 160, 32, 64, 192);
   Orthanc::ImageProcessing::Set(r, 32767); 
 
   {