changeset 1683:21d31da73374 db-changes

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Oct 2015 14:44:52 +0200
parents 6414043df7d8
children 4aaaecae5803
files OrthancServer/ResourceFinder.cpp
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/ResourceFinder.cpp	Tue Oct 06 14:09:30 2015 +0200
+++ b/OrthancServer/ResourceFinder.cpp	Tue Oct 06 14:44:52 2015 +0200
@@ -197,7 +197,12 @@
         return;
       }
 
-      if (!query.HasMainDicomTagsFilter(level_))
+      bool hasTagsAtThisLevel = query.HasMainDicomTagsFilter(level_);
+      bool hasTagsAtPatientLevel = (filterPatientTagsAtStudyLevel &&
+                                    level_ == ResourceType_Study &&
+                                    query.HasMainDicomTagsFilter(ResourceType_Patient));
+
+      if (!hasTagsAtThisLevel && !hasTagsAtPatientLevel)        
       {
         return;
       }
@@ -212,20 +217,19 @@
              it = resources.begin(); it != resources.end(); ++it)
       {
         DicomMap mainTags;
-        if (!index_.GetMainDicomTags(mainTags, *it, level_, level_) ||
-            !query.FilterMainDicomTags(*it, level_, mainTags))
+
+        if (hasTagsAtThisLevel &&
+            (!index_.GetMainDicomTags(mainTags, *it, level_, level_) ||
+             !query.FilterMainDicomTags(*it, level_, mainTags)))
         {
           continue;
         }
 
-        if (filterPatientTagsAtStudyLevel &&
-            level_ == ResourceType_Study)
+        if (hasTagsAtPatientLevel &&
+            (!index_.GetMainDicomTags(mainTags, *it, ResourceType_Study, ResourceType_Patient) ||
+             !query.FilterMainDicomTags(*it, ResourceType_Patient, mainTags)))
         {
-          if (!index_.GetMainDicomTags(mainTags, *it, ResourceType_Study, ResourceType_Patient) ||
-              !query.FilterMainDicomTags(*it, ResourceType_Patient, mainTags))
-          {
-            continue;
-          }          
+          continue;
         }
 
         filtered_.insert(*it);