diff Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 2848:dd3914a44b87

added accessors in C++ wrappers
author am@osimis.io
date Mon, 01 Oct 2018 11:35:01 +0200
parents 807169f85ba9
children c67b5d80b758 9f949922d603
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Fri Sep 28 19:17:04 2018 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Mon Oct 01 11:35:01 2018 +0200
@@ -231,6 +231,18 @@
     Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), NULL, flags));
   }
 
+  void MemoreyBuffer::CreateDicom(const Json::Value& tags,
+                   const OrthancPluginImage& pixelData,
+                   OrthancPluginCreateDicomFlags flags)
+  {
+    Clear();
+
+    Json::FastWriter writer;
+    std::string s = writer.write(tags);
+
+    Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), pixelData.GetObject(), flags));
+  }
+
 
   void MemoryBuffer::ReadFile(const std::string& path)
   {
@@ -885,6 +897,23 @@
     }
   }
 
+  OrthancImage::OrthancImage(OrthancPluginContext*     context,
+                             OrthancPluginPixelFormat  format,
+                             uint32_t                  width,
+                             uint32_t                  height,
+                             uint32_t                  pitch,
+                             void*                     buffer) :
+    context_(context)
+  {
+    if (context == NULL)
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
+    }
+    else
+    {
+      image_ = OrthancPluginCreateImageAccessor(context, format, width, height, pitch, buffer);
+    }
+  }
 
   void OrthancImage::UncompressPngImage(const void* data,
                                         size_t size)