changeset 5699:e8e028aed89f find-refactoring

c-find tests pass using ResourceFinder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2024 14:08:31 +0200
parents 075558c95cbb
children 1fab9ddaf702
files OrthancServer/Sources/OrthancFindRequestHandler.cpp OrthancServer/Sources/ResourceFinder.cpp
diffstat 2 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Fri Jul 12 12:48:37 2024 +0200
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Fri Jul 12 14:08:31 2024 +0200
@@ -537,7 +537,6 @@
       throw OrthancException(ErrorCode_NotImplemented);
     }
 
-
     DicomArray query(*filteredInput);
     CLOG(INFO, DICOM) << "DICOM C-Find request at level: " << EnumerationToString(level);
 
@@ -585,14 +584,21 @@
       const DicomTag tag = element.GetTag();
 
       // remove tags that are not used for matching
-      if (element.GetValue().IsNull() ||
-          tag == DICOM_TAG_QUERY_RETRIEVE_LEVEL ||
+      if (tag == DICOM_TAG_QUERY_RETRIEVE_LEVEL ||
           tag == DICOM_TAG_SPECIFIC_CHARACTER_SET ||
           tag == DICOM_TAG_TIMEZONE_OFFSET_FROM_UTC)  // time zone is not directly used for matching.  Once we support "Timezone query adjustment", we may use it to adjust date-time filters but for now, just ignore it 
       {
         continue;
       }
 
+      requestedTags.insert(tag);
+
+      if (element.GetValue().IsNull())
+      {
+        // There is no constraint on this tag
+        continue;
+      }
+
       std::string value = element.GetValue().GetContent();
       if (value.size() == 0)
       {
@@ -617,7 +623,6 @@
       }
       else
       {
-        requestedTags.insert(tag);
         CLOG(INFO, DICOM) << "Because of a patch for the manufacturer of the remote modality, " 
                           << "ignoring constraint on tag (" << tag.Format() << ") "
                           << FromDcmtkBridge::GetTagName(element);
@@ -632,7 +637,7 @@
     size_t limit = (level == ResourceType_Instance) ? maxInstances_ : maxResults_;
 
 
-    if (false)
+    if (true)
     {
       /**
        * EXPERIMENTAL VERSION
--- a/OrthancServer/Sources/ResourceFinder.cpp	Fri Jul 12 12:48:37 2024 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Fri Jul 12 14:08:31 2024 +0200
@@ -720,9 +720,8 @@
       }
       else
       {
-        // Main DICOM tags from the instance level will be retrieved anyway
-        assert(request_.IsRetrieveMainDicomTags());
-        assert(request_.IsRetrieveMetadata());
+        request_.SetRetrieveMainDicomTags(true);
+        request_.SetRetrieveMetadata(true);
         requestedInstanceTags_.insert(tag);
       }
 
@@ -834,7 +833,7 @@
       std::string missings;
       FromDcmtkBridge::FormatListOfTags(missings, missingTags);
 
-      LOG(WARNING) << "W001: Accessing Dicom tags from storage when accessing "
+      LOG(WARNING) << "W001: Accessing DICOM tags from storage when accessing "
                    << Orthanc::GetResourceTypeText(resource.GetLevel(), false, false)
                    << ": " << missings;
     }