Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5043:ec5c203a97ea
returning sequences in MainDicomTags and RequestedTags
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 27 Jun 2022 15:22:19 +0200 |
parents | 120945ce48b6 |
children | 6fed78e13233 |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Mon Jun 27 14:09:17 2022 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Mon Jun 27 15:22:19 2022 +0200 @@ -45,71 +45,6 @@ namespace Orthanc { - // copy all tags from Json (used to read from metadata) - void DicomSequencesMap::Deserialize(const Json::Value& serialized) - { - Json::Value::Members members = serialized.getMemberNames(); - for (size_t i = 0; i < members.size(); i++) - { - DicomTag tag = FromDcmtkBridge::ParseTag(members[i].c_str()); - sequences_[tag] = serialized[members[i]]; - } - } - - // serialize a subet of tags (used to store in the metadata) - void DicomSequencesMap::Serialize(Json::Value& target, const std::set<DicomTag>& tags) const - { - // add the sequences to "target" - for (std::map<DicomTag, Json::Value>::const_iterator it = sequences_.begin(); - it != sequences_.end(); ++it) - { - if (tags.find(it->first) != tags.end()) - { - target[it->first.Format()] = it->second; - } - } - } - - // copy a subset of tags from Json - void DicomSequencesMap::FromDicomAsJson(const Json::Value& dicomAsJson, const std::set<DicomTag>& tags) - { - for (std::set<DicomTag>::const_iterator it = tags.begin(); - it != tags.end(); ++it) - { - std::string tag = it->Format(); - if (dicomAsJson.isMember(tag)) - { - sequences_[*it] = dicomAsJson[tag]; - } - } - } - - void DicomSequencesMap::ToJson(Json::Value& target, DicomToJsonFormat format) const - { - // add the sequences to "target" - for (std::map<DicomTag, Json::Value>::const_iterator it = sequences_.begin(); - it != sequences_.end(); ++it) - { - Json::Value sequenceForConversion = Json::objectValue; - sequenceForConversion[it->first.Format()] = it->second; - - Json::Value& requestedFormatJson = sequenceForConversion; - Json::Value convertedJson; - - if (format != DicomToJsonFormat_Full) - { - Toolbox::SimplifyDicomAsJson(convertedJson, sequenceForConversion, format); - requestedFormatJson = convertedJson; - } - - Json::Value::Members keys = requestedFormatJson.getMemberNames(); - for (size_t i = 0; i < keys.size(); i++) // there should always be only one member in this JSON - { - target[keys[i]] = requestedFormatJson[keys[i]]; - } - } - } - namespace { /**