Mercurial > hg > orthanc
comparison Core/DicomFormat/DicomMap.cpp @ 3006:0e1755e5efd0
DicomMap::ExtractMainDicomTags()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Dec 2018 12:37:10 +0100 |
parents | 8265a6b56100 |
children | abe49ca61cd5 |
comparison
equal
deleted
inserted
replaced
3005:8265a6b56100 | 3006:0e1755e5efd0 |
---|---|
1019 } | 1019 } |
1020 } | 1020 } |
1021 } | 1021 } |
1022 | 1022 |
1023 | 1023 |
1024 void DicomMap::Merge(const DicomMap& other) | |
1025 { | |
1026 for (Map::const_iterator it = other.map_.begin(); | |
1027 it != other.map_.end(); ++it) | |
1028 { | |
1029 assert(it->second != NULL); | |
1030 | |
1031 if (map_.find(it->first) == map_.end()) | |
1032 { | |
1033 map_[it->first] = it->second->Clone(); | |
1034 } | |
1035 } | |
1036 } | |
1037 | |
1038 | |
1039 void DicomMap::ExtractMainDicomTagsInternal(const DicomMap& other, | |
1040 ResourceType level) | |
1041 { | |
1042 const DicomTag* tags = NULL; | |
1043 size_t size = 0; | |
1044 | |
1045 LoadMainDicomTags(tags, size, level); | |
1046 assert(tags != NULL && size > 0); | |
1047 | |
1048 for (size_t i = 0; i < size; i++) | |
1049 { | |
1050 Map::const_iterator found = other.map_.find(tags[i]); | |
1051 | |
1052 if (found != other.map_.end() && | |
1053 map_.find(tags[i]) == map_.end()) | |
1054 { | |
1055 assert(found->second != NULL); | |
1056 map_[tags[i]] = found->second->Clone(); | |
1057 } | |
1058 } | |
1059 } | |
1060 | |
1061 | |
1062 void DicomMap::ExtractMainDicomTags(const DicomMap& other) | |
1063 { | |
1064 Clear(); | |
1065 ExtractMainDicomTagsInternal(other, ResourceType_Patient); | |
1066 ExtractMainDicomTagsInternal(other, ResourceType_Study); | |
1067 ExtractMainDicomTagsInternal(other, ResourceType_Series); | |
1068 ExtractMainDicomTagsInternal(other, ResourceType_Instance); | |
1069 } | |
1070 | |
1071 | |
1024 void DicomMap::Serialize(Json::Value& target) const | 1072 void DicomMap::Serialize(Json::Value& target) const |
1025 { | 1073 { |
1026 target = Json::objectValue; | 1074 target = Json::objectValue; |
1027 | 1075 |
1028 for (Map::const_iterator it = map_.begin(); it != map_.end(); ++it) | 1076 for (Map::const_iterator it = map_.begin(); it != map_.end(); ++it) |