changeset 3650:e5811a9f8df0

removing DicomMap::LoadMainDicomTags()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Feb 2020 11:52:10 +0100
parents 8aab20dde416
children 46cb00e4adbb
files Core/DicomFormat/DicomMap.cpp Core/DicomFormat/DicomMap.h OrthancServer/ServerIndex.cpp
diffstat 3 files changed, 51 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomFormat/DicomMap.cpp	Tue Feb 04 08:32:38 2020 +0100
+++ b/Core/DicomFormat/DicomMap.cpp	Wed Feb 05 11:52:10 2020 +0100
@@ -124,9 +124,9 @@
   };
 
 
-  void DicomMap::LoadMainDicomTags(const DicomTag*& tags,
-                                   size_t& size,
-                                   ResourceType level)
+  static void LoadMainDicomTags(const DicomTag*& tags,
+                                size_t& size,
+                                ResourceType level)
   {
     switch (level)
     {
@@ -1317,6 +1317,21 @@
   }
 
 
+  void DicomMap::DumpMainDicomTags(Json::Value& target,
+                                   ResourceType level) const
+  {
+    target = Json::objectValue;
+
+    
+  }
+  
+
+  void DicomMap::ParseMainDicomTags(Json::Value& target,
+                                    ResourceType level)
+  {
+  }
+
+
   void DicomMap::Print(FILE* fp) const
   {
     DicomArray a(*this);
--- a/Core/DicomFormat/DicomMap.h	Tue Feb 04 08:32:38 2020 +0100
+++ b/Core/DicomFormat/DicomMap.h	Wed Feb 05 11:52:10 2020 +0100
@@ -188,10 +188,6 @@
 
     void GetTags(std::set<DicomTag>& tags) const;
 
-    static void LoadMainDicomTags(const DicomTag*& tags,
-                                  size_t& size,
-                                  ResourceType level);
-
     static bool ParseDicomMetaInformation(DicomMap& result,
                                           const char* dicom,
                                           size_t size);
@@ -240,6 +236,12 @@
 
     void RemoveBinaryTags();
 
+    void DumpMainDicomTags(Json::Value& target,
+                           ResourceType level) const;
+
+    void ParseMainDicomTags(Json::Value& target,
+                            ResourceType level);
+
     void Print(FILE* fp) const;  // For debugging only
   };
 }
--- a/OrthancServer/ServerIndex.cpp	Tue Feb 04 08:32:38 2020 +0100
+++ b/OrthancServer/ServerIndex.cpp	Wed Feb 05 11:52:10 2020 +0100
@@ -356,34 +356,40 @@
       
     void LoadTags(ResourceType level)
     {
-      const DicomTag* tags = NULL;
-      size_t size;
+      {
+        const DicomTag* tags = NULL;
+        size_t size;
   
-      ServerToolbox::LoadIdentifiers(tags, size, level);
+        ServerToolbox::LoadIdentifiers(tags, size, level);
   
-      for (size_t i = 0; i < size; i++)
-      {
-        if (registry_.find(tags[i]) == registry_.end())
+        for (size_t i = 0; i < size; i++)
         {
-          registry_[tags[i]] = TagInfo(level, DicomTagType_Identifier);
-        }
-        else
-        {
-          // These patient-level tags are copied in the study level
-          assert(level == ResourceType_Study &&
-                 (tags[i] == DICOM_TAG_PATIENT_ID ||
-                  tags[i] == DICOM_TAG_PATIENT_NAME ||
-                  tags[i] == DICOM_TAG_PATIENT_BIRTH_DATE));
+          if (registry_.find(tags[i]) == registry_.end())
+          {
+            registry_[tags[i]] = TagInfo(level, DicomTagType_Identifier);
+          }
+          else
+          {
+            // These patient-level tags are copied in the study level
+            assert(level == ResourceType_Study &&
+                   (tags[i] == DICOM_TAG_PATIENT_ID ||
+                    tags[i] == DICOM_TAG_PATIENT_NAME ||
+                    tags[i] == DICOM_TAG_PATIENT_BIRTH_DATE));
+          }
         }
       }
-  
-      DicomMap::LoadMainDicomTags(tags, size, level);
-  
-      for (size_t i = 0; i < size; i++)
+
       {
-        if (registry_.find(tags[i]) == registry_.end())
+        std::set<DicomTag> tags;
+        DicomMap::GetMainDicomTags(tags, level);
+
+        for (std::set<DicomTag>::const_iterator
+               tag = tags.begin(); tag != tags.end(); ++tag)
         {
-          registry_[tags[i]] = TagInfo(level, DicomTagType_Main);
+          if (registry_.find(*tag) == registry_.end())
+          {
+            registry_[*tag] = TagInfo(level, DicomTagType_Main);
+          }
         }
       }
     }