diff OrthancServer/ServerToolbox.cpp @ 1859:4e7c318a3f69

C-FIND SCP will return tags with sequence value representation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Dec 2015 11:22:05 +0100
parents 559956d5ceb2
children c7d70f659190
line wrap: on
line diff
--- a/OrthancServer/ServerToolbox.cpp	Tue Dec 01 16:57:03 2015 +0100
+++ b/OrthancServer/ServerToolbox.cpp	Wed Dec 02 11:22:05 2015 +0100
@@ -47,7 +47,8 @@
   namespace Toolbox
   {
     void SimplifyTags(Json::Value& target,
-                      const Json::Value& source)
+                      const Json::Value& source,
+                      DicomToJsonFormat format)
     {
       assert(source.isObject());
 
@@ -57,9 +58,23 @@
       for (size_t i = 0; i < members.size(); i++)
       {
         const Json::Value& v = source[members[i]];
-        const std::string& name = v["Name"].asString();
         const std::string& type = v["Type"].asString();
 
+        std::string name;
+        switch (format)
+        {
+          case DicomToJsonFormat_Simple:
+            name = v["Name"].asString();
+            break;
+
+          case DicomToJsonFormat_Short:
+            name = members[i];
+            break;
+
+          default:
+            throw OrthancException(ErrorCode_ParameterOutOfRange);
+        }
+
         if (type == "String")
         {
           target[name] = v["Value"].asString();
@@ -78,7 +93,7 @@
           for (Json::Value::ArrayIndex i = 0; i < array.size(); i++)
           {
             Json::Value c;
-            SimplifyTags(c, array[i]);
+            SimplifyTags(c, array[i], format);
             children.append(c);
           }