diff Core/Images/ImageAccessor.cpp @ 2865:0f07bdae0805

ImageAccessor::GetWriteableAccessor() and GetReadOnlyAccessor()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Oct 2018 17:56:55 +0200
parents 9b4251721f22
children d924f9bb61cc
line wrap: on
line diff
--- a/Core/Images/ImageAccessor.cpp	Fri Oct 05 17:51:10 2018 +0200
+++ b/Core/Images/ImageAccessor.cpp	Fri Oct 05 17:56:55 2018 +0200
@@ -204,6 +204,19 @@
   }
 
 
+  void ImageAccessor::GetWriteableAccessor(ImageAccessor& target) const
+  {
+    if (readOnly_)
+    {
+      throw OrthancException(ErrorCode_ReadOnly);
+    }
+    else
+    {
+      target.AssignWritable(format_, width_, height_, pitch_, buffer_);
+    }
+  }
+
+
   void ImageAccessor::ToMatlabString(std::string& target) const
   {
     ChunkedBuffer buffer;