Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 3006:0e1755e5efd0
DicomMap::ExtractMainDicomTags()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Dec 2018 12:37:10 +0100 |
parents | 96089d1aba4d |
children | 8336204d95dc 4e43e67f8ecf |
comparison
equal
deleted
inserted
replaced
3005:8265a6b56100 | 3006:0e1755e5efd0 |
---|---|
2246 return true; | 2246 return true; |
2247 } | 2247 } |
2248 } | 2248 } |
2249 | 2249 |
2250 | 2250 |
2251 bool ServerIndex::GetAllMainDicomTags(DicomMap& result, | |
2252 const std::string& instancePublicId) | |
2253 { | |
2254 result.Clear(); | |
2255 | |
2256 boost::mutex::scoped_lock lock(mutex_); | |
2257 | |
2258 // Lookup for the requested resource | |
2259 int64_t instance; | |
2260 ResourceType type; | |
2261 if (!db_.LookupResource(instance, type, instancePublicId) || | |
2262 type != ResourceType_Instance) | |
2263 { | |
2264 return false; | |
2265 } | |
2266 else | |
2267 { | |
2268 DicomMap tmp; | |
2269 | |
2270 db_.GetMainDicomTags(tmp, instance); | |
2271 result.Merge(tmp); | |
2272 | |
2273 int64_t series; | |
2274 if (!db_.LookupParent(series, instance)) | |
2275 { | |
2276 throw OrthancException(ErrorCode_InternalError); | |
2277 } | |
2278 | |
2279 tmp.Clear(); | |
2280 db_.GetMainDicomTags(tmp, series); | |
2281 result.Merge(tmp); | |
2282 | |
2283 int64_t study; | |
2284 if (!db_.LookupParent(study, series)) | |
2285 { | |
2286 throw OrthancException(ErrorCode_InternalError); | |
2287 } | |
2288 | |
2289 tmp.Clear(); | |
2290 db_.GetMainDicomTags(tmp, study); | |
2291 result.Merge(tmp); | |
2292 | |
2293 #ifndef NDEBUG | |
2294 { | |
2295 // Sanity test to check that all the main DICOM tags from the | |
2296 // patient level are copied at the study level | |
2297 | |
2298 int64_t patient; | |
2299 if (!db_.LookupParent(patient, study)) | |
2300 { | |
2301 throw OrthancException(ErrorCode_InternalError); | |
2302 } | |
2303 | |
2304 tmp.Clear(); | |
2305 db_.GetMainDicomTags(tmp, study); | |
2306 | |
2307 std::set<DicomTag> patientTags; | |
2308 tmp.GetTags(patientTags); | |
2309 | |
2310 for (std::set<DicomTag>::const_iterator | |
2311 it = patientTags.begin(); it != patientTags.end(); ++it) | |
2312 { | |
2313 assert(result.HasTag(*it)); | |
2314 } | |
2315 } | |
2316 #endif | |
2317 | |
2318 return true; | |
2319 } | |
2320 } | |
2321 | |
2322 | |
2251 bool ServerIndex::LookupResourceType(ResourceType& type, | 2323 bool ServerIndex::LookupResourceType(ResourceType& type, |
2252 const std::string& publicId) | 2324 const std::string& publicId) |
2253 { | 2325 { |
2254 boost::mutex::scoped_lock lock(mutex_); | 2326 boost::mutex::scoped_lock lock(mutex_); |
2255 | 2327 |