diff Core/Lua/LuaFunctionCall.cpp @ 2218:3eefb84ac0bd

dynamically fix outgoing C-Find requests using "OutgoingFindRequestFilter()"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Dec 2016 10:27:20 +0100
parents 45c4387a379c
children a3a65de1840f
line wrap: on
line diff
--- a/Core/Lua/LuaFunctionCall.cpp	Mon Dec 12 11:56:26 2016 +0100
+++ b/Core/Lua/LuaFunctionCall.cpp	Tue Dec 13 10:27:20 2016 +0100
@@ -166,4 +166,26 @@
 
     PushJson(json);
   }
+
+
+  void LuaFunctionCall::PushDicom(const DicomMap& dicom)
+  {
+    DicomArray a(dicom);
+    PushDicom(a);
+  }
+
+
+  void LuaFunctionCall::PushDicom(const DicomArray& dicom)
+  {
+    Json::Value value = Json::objectValue;
+
+    for (size_t i = 0; i < dicom.GetSize(); i++)
+    {
+      const DicomValue& v = dicom.GetElement(i).GetValue();
+      std::string s = (v.IsNull() || v.IsBinary()) ? "" : v.GetContent();
+      value[dicom.GetElement(i).GetTag().Format()] = s;
+    }
+
+    PushJson(value);
+  }
 }