diff OrthancServer/Sources/Database/ResourcesContent.cpp @ 5044:6fed78e13233

Refactored DicomMap to handle sequences when needed
author Alain Mazy <am@osimis.io>
date Tue, 28 Jun 2022 17:45:09 +0200
parents 6eff25f70121
children 0ea402b4d901
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/ResourcesContent.cpp	Mon Jun 27 15:22:19 2022 +0200
+++ b/OrthancServer/Sources/Database/ResourcesContent.cpp	Tue Jun 28 17:45:09 2022 +0200
@@ -28,6 +28,7 @@
 
 #include "../../../OrthancFramework/Sources/DicomFormat/DicomArray.h"
 #include "../../../OrthancFramework/Sources/OrthancException.h"
+#include "../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h"
 
 #include <cassert>
 
@@ -45,8 +46,7 @@
       const DicomElement& element = flattened.GetElement(i);
       const DicomTag& tag = element.GetTag();
       const DicomValue& value = element.GetValue();
-      if (!value.IsNull() && 
-          !value.IsBinary())
+      if (value.IsString())
       {
         target.AddMainDicomTag(resource, tag, element.GetValue().GetContent());
       }
@@ -70,9 +70,7 @@
       assert(DicomMap::IsMainDicomTag(tags[i]));
         
       const DicomValue* value = map.TestAndGetValue(tags[i]);
-      if (value != NULL &&
-          !value->IsNull() &&
-          !value->IsBinary())
+      if (value != NULL && value->IsString())
       {
         std::string s = ServerToolbox::NormalizeIdentifier(value->GetContent());
         target.AddIdentifierTag(resource, tags[i], s);
@@ -133,7 +131,7 @@
         throw OrthancException(ErrorCode_InternalError);
     }
 
-    StoreMainDicomTagsInternal(*this, resource, tags);
+    StoreMainDicomTagsInternal(*this, resource, tags);  // saves only leaf tags, not sequences
   }