Mercurial > hg > orthanc
diff OrthancServer/FromDcmtkBridge.cpp @ 1693:558b25228a23
creation of tag hierarchy from json
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 08 Oct 2015 13:45:33 +0200 |
parents | e447f3cb8b30 |
children | 06d579e82bb8 |
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp Thu Oct 08 10:57:29 2015 +0200 +++ b/OrthancServer/FromDcmtkBridge.cpp Thu Oct 08 13:45:33 2015 +0200 @@ -1012,11 +1012,21 @@ } + static bool IsBinaryTag(const DcmTag& key) + { + return key.isPrivate() || key.isUnknownVR(); + } + DcmElement* FromDcmtkBridge::CreateElementForTag(const DicomTag& tag) { DcmTag key(tag.GetGroup(), tag.GetElement()); + if (IsBinaryTag(key)) + { + return new DcmOtherByteOtherWord(key); + } + switch (key.getEVR()) { // http://support.dcmtk.org/docs/dcvr_8h-source.html @@ -1163,9 +1173,9 @@ decoded = &binary; } + DcmTag key(tag.GetGroup(), tag.GetElement()); - if (FromDcmtkBridge::IsPrivateTag(tag) || - FromDcmtkBridge::IsUnknownTag(tag)) + if (IsBinaryTag(key)) { if (element.putUint8Array((const Uint8*) decoded->c_str(), decoded->size()).good()) { @@ -1177,7 +1187,6 @@ } } - DcmTag key(tag.GetGroup(), tag.GetElement()); bool ok = false; try @@ -1314,8 +1323,8 @@ } - DcmElement* FromDcmtkBridge::FromJson(const Json::Value& value, - const DicomTag& tag, + DcmElement* FromDcmtkBridge::FromJson(const DicomTag& tag, + const Json::Value& value, bool decodeBinaryTags) { std::auto_ptr<DcmElement> element; @@ -1345,7 +1354,7 @@ Json::Value::Members members = value[i].getMemberNames(); for (Json::Value::ArrayIndex j = 0; j < members.size(); j++) { - item->insert(FromJson(value[i][members[j]], ParseTag(members[j]), decodeBinaryTags)); + item->insert(FromJson(ParseTag(members[j]), value[i][members[j]], decodeBinaryTags)); } sequence->append(item.release());