diff OrthancServer/Sources/ResourceFinder.cpp @ 5855:aeb9f63923b1 find-refactoring

ignore tags from meta header in RequestedTags
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 20:00:42 +0100
parents ea547160f27e
children d1dea8ad74a6
line wrap: on
line diff
--- a/OrthancServer/Sources/ResourceFinder.cpp	Mon Nov 04 17:51:46 2024 +0100
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Mon Nov 04 20:00:42 2024 +0100
@@ -1022,11 +1022,13 @@
 
     bool isWarning002Enabled = false;
     bool isWarning004Enabled = false;
+    bool isWarning006Enabled = false;
 
     {
       OrthancConfiguration::ReaderLock lock;
       isWarning002Enabled = lock.GetConfiguration().IsWarningEnabled(Warnings_002_InconsistentDicomTagsInDb);
       isWarning004Enabled = lock.GetConfiguration().IsWarningEnabled(Warnings_004_NoMainDicomTagsSignature);
+      isWarning006Enabled = lock.GetConfiguration().IsWarningEnabled(Warnings_006_RequestingTagFromMetaHeader);
     }
 
     FindResponse response;
@@ -1084,6 +1086,28 @@
         InjectRequestedTags(outRequestedTags, remainingRequestedTags, resource, ResourceType_Series);
         InjectRequestedTags(outRequestedTags, remainingRequestedTags, resource, ResourceType_Instance);
 
+        if (DicomMap::HasMetaInformationTags(remainingRequestedTags)) // we are not able to retrieve meta information in RequestedTags
+        {
+          std::set<DicomTag> metaTagsToRemove;
+          for (std::set<DicomTag>::const_iterator it = remainingRequestedTags.begin(); it != remainingRequestedTags.end(); ++it)
+          {
+            if (it->GetGroup() == 0x0002)
+            {
+              metaTagsToRemove.insert(*it);
+            }
+          }
+
+          if (isWarning006Enabled)
+          {
+            std::string joinedMetaTags;
+            FromDcmtkBridge::FormatListOfTags(joinedMetaTags, metaTagsToRemove);
+            LOG(WARNING) << "W006: Unable to include tags from the Meta Header in 'RequestedTags'.  Skipping them: " << joinedMetaTags;
+          }
+
+          Toolbox::RemoveSets(remainingRequestedTags, metaTagsToRemove);
+        }
+
+
         if (!remainingRequestedTags.empty() && 
             !DicomMap::HasOnlyComputedTags(remainingRequestedTags)) // if the only remaining tags are computed tags, it is worthless to read them from disk
         {