comparison 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
comparison
equal deleted inserted replaced
1856:36ab170733d6 1859:4e7c318a3f69
45 namespace Orthanc 45 namespace Orthanc
46 { 46 {
47 namespace Toolbox 47 namespace Toolbox
48 { 48 {
49 void SimplifyTags(Json::Value& target, 49 void SimplifyTags(Json::Value& target,
50 const Json::Value& source) 50 const Json::Value& source,
51 DicomToJsonFormat format)
51 { 52 {
52 assert(source.isObject()); 53 assert(source.isObject());
53 54
54 target = Json::objectValue; 55 target = Json::objectValue;
55 Json::Value::Members members = source.getMemberNames(); 56 Json::Value::Members members = source.getMemberNames();
56 57
57 for (size_t i = 0; i < members.size(); i++) 58 for (size_t i = 0; i < members.size(); i++)
58 { 59 {
59 const Json::Value& v = source[members[i]]; 60 const Json::Value& v = source[members[i]];
60 const std::string& name = v["Name"].asString();
61 const std::string& type = v["Type"].asString(); 61 const std::string& type = v["Type"].asString();
62
63 std::string name;
64 switch (format)
65 {
66 case DicomToJsonFormat_Simple:
67 name = v["Name"].asString();
68 break;
69
70 case DicomToJsonFormat_Short:
71 name = members[i];
72 break;
73
74 default:
75 throw OrthancException(ErrorCode_ParameterOutOfRange);
76 }
62 77
63 if (type == "String") 78 if (type == "String")
64 { 79 {
65 target[name] = v["Value"].asString(); 80 target[name] = v["Value"].asString();
66 } 81 }
76 91
77 Json::Value children = Json::arrayValue; 92 Json::Value children = Json::arrayValue;
78 for (Json::Value::ArrayIndex i = 0; i < array.size(); i++) 93 for (Json::Value::ArrayIndex i = 0; i < array.size(); i++)
79 { 94 {
80 Json::Value c; 95 Json::Value c;
81 SimplifyTags(c, array[i]); 96 SimplifyTags(c, array[i], format);
82 children.append(c); 97 children.append(c);
83 } 98 }
84 99
85 target[name] = children; 100 target[name] = children;
86 } 101 }