Mercurial > hg > orthanc
comparison OrthancServer/FromDcmtkBridge.cpp @ 1368:b22ba8c5edbe query-retrieve
query retrieve
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 26 May 2015 17:54:34 +0200 |
parents | 0649c5aef34a |
children | 8e23f16a198d |
comparison
equal
deleted
inserted
replaced
1367:fe6e5a9f1ea2 | 1368:b22ba8c5edbe |
---|---|
622 } | 622 } |
623 } | 623 } |
624 | 624 |
625 | 625 |
626 void FromDcmtkBridge::ToJson(Json::Value& result, | 626 void FromDcmtkBridge::ToJson(Json::Value& result, |
627 const DicomMap& values) | 627 const DicomMap& values, |
628 bool simplify) | |
628 { | 629 { |
629 if (result.type() != Json::objectValue) | 630 if (result.type() != Json::objectValue) |
630 { | 631 { |
631 throw OrthancException(ErrorCode_BadParameterType); | 632 throw OrthancException(ErrorCode_BadParameterType); |
632 } | 633 } |
634 result.clear(); | 635 result.clear(); |
635 | 636 |
636 for (DicomMap::Map::const_iterator | 637 for (DicomMap::Map::const_iterator |
637 it = values.map_.begin(); it != values.map_.end(); ++it) | 638 it = values.map_.begin(); it != values.map_.end(); ++it) |
638 { | 639 { |
639 result[GetName(it->first)] = it->second->AsString(); | 640 if (simplify) |
641 { | |
642 result[GetName(it->first)] = it->second->AsString(); | |
643 } | |
644 else | |
645 { | |
646 Json::Value value = Json::objectValue; | |
647 | |
648 value["Name"] = GetName(it->first); | |
649 | |
650 if (it->second->IsNull()) | |
651 { | |
652 value["Type"] = "Null"; | |
653 value["Value"] = Json::nullValue; | |
654 } | |
655 else | |
656 { | |
657 value["Type"] = "String"; | |
658 value["Value"] = it->second->AsString(); | |
659 } | |
660 | |
661 result[it->first.Format()] = value; | |
662 } | |
640 } | 663 } |
641 } | 664 } |
642 | 665 |
643 | 666 |
644 std::string FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType level) | 667 std::string FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType level) |