diff OrthancFramework/Sources/DicomFormat/DicomMap.cpp @ 4936:8422e4f99a18 more-tags

Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
author Alain Mazy <am@osimis.io>
date Fri, 11 Mar 2022 17:38:16 +0100
parents acd3f72e2a21
children 304514ce84ee
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Thu Mar 10 19:00:43 2022 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Fri Mar 11 17:38:16 2022 +0100
@@ -403,7 +403,8 @@
   }
 
 
-  static void ExtractTags(DicomMap& result,
+  // MORE_TAGS: TODO: we can probably remove the std::string from MainDicomTags (not used here !!!)
+  static void ExtractTagsInternal(DicomMap& result,
                           const DicomMap::Content& source,
                           const std::map<DicomTag, std::string>& mainDicomTags)
   {
@@ -420,10 +421,25 @@
     }
   }
 
+  void DicomMap::ExtractTags(DicomMap& result, const std::set<DicomTag>& tags) const
+  {
+    result.Clear();
+
+    for (std::set<DicomTag>::const_iterator itmt = tags.begin();
+         itmt != tags.end(); itmt++)
+    {
+      DicomMap::Content::const_iterator it = content_.find(*itmt);
+      if (it != content_.end())
+      {
+        result.SetValue(it->first, *it->second /* value will be cloned */);
+      }
+    }
+  }
+
   void DicomMap::ExtractResourceInformation(DicomMap& result, ResourceType level) const
   {
     const std::map<DicomTag, std::string>& mainDicomTags = DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTags(level);
-    ExtractTags(result, content_, mainDicomTags);
+    ExtractTagsInternal(result, content_, mainDicomTags);
   }
 
   void DicomMap::ExtractPatientInformation(DicomMap& result) const