diff OrthancServer/ServerEnumerations.cpp @ 2309:4dc313b9a20a issue-46-anonymization

Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jul 2017 13:40:02 +0200
parents a3a65de1840f
children d19e716b79fa
line wrap: on
line diff
--- a/OrthancServer/ServerEnumerations.cpp	Wed Jul 12 09:12:12 2017 +0200
+++ b/OrthancServer/ServerEnumerations.cpp	Wed Jul 12 13:40:02 2017 +0200
@@ -462,6 +462,49 @@
   }
 
 
+  const char* EnumerationToString(DicomVersion version)
+  {
+    switch (version)
+    {
+      case DicomVersion_2008:
+        return "2008";
+        break;
+
+      case DicomVersion_2011:
+        return "2011";
+        break;
+
+      case DicomVersion_2017c:
+        return "2017c";
+        break;
+
+      default: 
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
+  DicomVersion StringToDicomVersion(const std::string& version)
+  {
+    if (version == "2008")
+    {
+      return DicomVersion_2008;
+    }
+    else if (version == "2011")
+    {
+      return DicomVersion_2011;
+    }
+    else if (version == "2017c")
+    {
+      return DicomVersion_2017c;
+    }
+    else
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+  
   bool IsUserMetadata(MetadataType metadata)
   {
     return (metadata >= MetadataType_StartUser &&