diff Core/SerializationToolbox.cpp @ 2996:d547f998c947 db-changes

integration mainline->db-changes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Dec 2018 20:33:13 +0100
parents af068a6b476b
children 4e43e67f8ecf
line wrap: on
line diff
--- a/Core/SerializationToolbox.cpp	Thu Dec 06 15:58:08 2018 +0100
+++ b/Core/SerializationToolbox.cpp	Mon Dec 10 20:33:13 2018 +0100
@@ -36,10 +36,33 @@
 
 #include "OrthancException.h"
 
+#if ORTHANC_ENABLE_DCMTK == 1
+#  include "DicomParsing/FromDcmtkBridge.h"
+#endif
+
 namespace Orthanc
 {
   namespace SerializationToolbox
   {
+    static bool ParseTagInternal(DicomTag& tag,
+                                 const char* name)
+    {
+#if ORTHANC_ENABLE_DCMTK == 1
+      try
+      {
+        tag = FromDcmtkBridge::ParseTag(name);
+        return true;
+      }
+      catch (OrthancException& e)
+      {
+        return false;
+      }
+#else
+      return DicomTag::ParseHexadecimal(tag, name);
+#endif   
+    }
+
+    
     std::string ReadString(const Json::Value& value,
                            const std::string& field)
     {
@@ -191,7 +214,7 @@
         DicomTag tag(0, 0);
 
         if (arr[i].type() != Json::stringValue ||
-            !DicomTag::ParseHexadecimal(tag, arr[i].asCString()))
+            !ParseTagInternal(tag, arr[i].asCString()))
         {
           throw OrthancException(ErrorCode_BadFileFormat,
                                  "Set of DICOM tags expected in field: " + field);
@@ -263,7 +286,7 @@
 
         DicomTag tag(0, 0);
 
-        if (!DicomTag::ParseHexadecimal(tag, members[i].c_str()) ||
+        if (!ParseTagInternal(tag, members[i].c_str()) ||
             tmp.type() != Json::stringValue)
         {
           throw OrthancException(ErrorCode_BadFileFormat,