Mercurial > hg > orthanc
diff OrthancServer/ResourceFinder.cpp @ 1677:a903d57d9f0c db-changes
adaptation of search with patient tags at study level
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 05 Oct 2015 16:40:14 +0200 |
parents | f967bdf8534e |
children | 21d31da73374 |
line wrap: on
line diff
--- a/OrthancServer/ResourceFinder.cpp Fri Oct 02 17:09:18 2015 +0200 +++ b/OrthancServer/ResourceFinder.cpp Mon Oct 05 16:40:14 2015 +0200 @@ -37,8 +37,6 @@ #include "FromDcmtkBridge.h" #include "ServerContext.h" -#include <boost/algorithm/string/predicate.hpp> - namespace Orthanc { class ResourceFinder::CandidateResources @@ -190,8 +188,15 @@ } - void RestrictMainDicomTags(const IQuery& query) + void RestrictMainDicomTags(const IQuery& query, + bool filterPatientTagsAtStudyLevel) { + if (filterPatientTagsAtStudyLevel && + level_ == ResourceType_Patient) + { + return; + } + if (!query.HasMainDicomTagsFilter(level_)) { return; @@ -207,13 +212,23 @@ it = resources.begin(); it != resources.end(); ++it) { DicomMap mainTags; - if (index_.GetMainDicomTags(mainTags, *it, level_)) + if (!index_.GetMainDicomTags(mainTags, *it, level_, level_) || + !query.FilterMainDicomTags(*it, level_, mainTags)) { - if (query.FilterMainDicomTags(*it, level_, mainTags)) + continue; + } + + if (filterPatientTagsAtStudyLevel && + level_ == ResourceType_Study) + { + if (!index_.GetMainDicomTags(mainTags, *it, ResourceType_Study, ResourceType_Patient) || + !query.FilterMainDicomTags(*it, ResourceType_Patient, mainTags)) { - filtered_.insert(*it); - } + continue; + } } + + filtered_.insert(*it); } } }; @@ -266,7 +281,14 @@ throw OrthancException(ErrorCode_InternalError); } - candidates.RestrictMainDicomTags(query); + if (query.GetLevel() == ResourceType_Patient) + { + candidates.RestrictMainDicomTags(query, false); + } + else + { + candidates.RestrictMainDicomTags(query, true); + } }