Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 3031:18a2d196414b db-changes
simplification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Dec 2018 13:08:04 +0100 |
parents | 25afa7b8cb51 |
children | 5da6d1063d8f |
comparison
equal
deleted
inserted
replaced
3030:25afa7b8cb51 | 3031:18a2d196414b |
---|---|
2563 { | 2563 { |
2564 assert(mainDicomTagsRegistry_.get() != NULL); | 2564 assert(mainDicomTagsRegistry_.get() != NULL); |
2565 | 2565 |
2566 target.clear(); | 2566 target.clear(); |
2567 target.reserve(source.GetConstraintsCount()); | 2567 target.reserve(source.GetConstraintsCount()); |
2568 | 2568 |
2569 for (size_t i = 0; i < source.GetConstraintsCount(); i++) | 2569 for (size_t i = 0; i < source.GetConstraintsCount(); i++) |
2570 { | 2570 { |
2571 const DicomTagConstraint& constraint = source.GetConstraint(i); | 2571 ResourceType level; |
2572 DicomTagType type; | |
2572 | 2573 |
2573 ResourceType tagLevel; | 2574 mainDicomTagsRegistry_->LookupTag(level, type, source.GetConstraint(i).GetTag()); |
2574 DicomTagType tagType; | 2575 |
2575 mainDicomTagsRegistry_->LookupTag(tagLevel, tagType, constraint.GetTag()); | 2576 if (type == DicomTagType_Identifier || |
2576 | 2577 type == DicomTagType_Main) |
2577 if (//IsResourceLevelAboveOrEqual(tagLevel, queryLevel) && | |
2578 (tagType == DicomTagType_Identifier || | |
2579 tagType == DicomTagType_Main)) | |
2580 { | 2578 { |
2581 // Use the fact that patient-level tags are copied at the study level | 2579 // Use the fact that patient-level tags are copied at the study level |
2582 if (queryLevel != ResourceType_Patient && | 2580 if (level == ResourceType_Patient && |
2583 tagLevel == ResourceType_Patient) | 2581 queryLevel != ResourceType_Patient) |
2584 { | 2582 { |
2585 tagLevel = ResourceType_Study; | 2583 level = ResourceType_Study; |
2586 } | 2584 } |
2587 | 2585 |
2588 DatabaseConstraint c(constraint, tagLevel, tagType); | 2586 DatabaseConstraint c(source.GetConstraint(i), level, type); |
2589 | 2587 target.push_back(c); |
2590 // Avoid universal constraints | 2588 } |
2591 if (!(c.GetConstraintType() == ConstraintType_Equal && | 2589 } |
2592 c.GetSingleValue() == "") && | 2590 } |
2593 !(c.GetConstraintType() == ConstraintType_Wildcard && | 2591 |
2594 c.GetSingleValue() == "*")) | 2592 |
2595 { | |
2596 target.push_back(c); | |
2597 } | |
2598 } | |
2599 } | |
2600 } | |
2601 | |
2602 | |
2603 void ServerIndex::ApplyLookupPatients(std::vector<std::string>& patientsId, | |
2604 std::vector<std::string>& instancesId, | |
2605 const DatabaseLookup& lookup, | |
2606 size_t limit) | |
2607 { | |
2608 std::vector<DatabaseConstraint> normalized; | |
2609 NormalizeLookup(normalized, lookup, ResourceType_Patient); | |
2610 | |
2611 { | |
2612 boost::mutex::scoped_lock lock(mutex_); | |
2613 db_.ApplyLookupPatients(patientsId, instancesId, normalized, limit); | |
2614 } | |
2615 } | |
2616 | |
2617 | |
2618 void ServerIndex::ApplyLookupResources(std::vector<std::string>& resourcesId, | 2593 void ServerIndex::ApplyLookupResources(std::vector<std::string>& resourcesId, |
2619 std::vector<std::string>& instancesId, | 2594 std::vector<std::string>& instancesId, |
2620 const DatabaseLookup& lookup, | 2595 const DatabaseLookup& lookup, |
2621 ResourceType queryLevel, | 2596 ResourceType queryLevel, |
2622 size_t limit) | 2597 size_t limit) |