diff Plugins/Engine/PluginsEnumerations.cpp @ 2006:6301bbcbcaed

more generic support of value representations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 09 Jun 2016 14:48:40 +0200
parents ef1e9856c26f
children 655489d9165d
line wrap: on
line diff
--- a/Plugins/Engine/PluginsEnumerations.cpp	Wed Jun 08 12:36:21 2016 +0200
+++ b/Plugins/Engine/PluginsEnumerations.cpp	Thu Jun 09 14:48:40 2016 +0200
@@ -326,185 +326,201 @@
     }
 
 
-#if !defined(ORTHANC_ENABLE_DCMTK) || ORTHANC_ENABLE_DCMTK != 0
-    DcmEVR Convert(OrthancPluginValueRepresentation vr)
+    ValueRepresentation Convert(OrthancPluginValueRepresentation vr)
     {
       switch (vr)
       {
         case OrthancPluginValueRepresentation_AE:
-          return EVR_AE;
+          return ValueRepresentation_ApplicationEntity;
 
         case OrthancPluginValueRepresentation_AS:
-          return EVR_AS;
+          return ValueRepresentation_AgeString;
 
         case OrthancPluginValueRepresentation_AT:
-          return EVR_AT;
+          return ValueRepresentation_AttributeTag;
 
         case OrthancPluginValueRepresentation_CS:
-          return EVR_CS;
+          return ValueRepresentation_CodeString;
 
         case OrthancPluginValueRepresentation_DA:
-          return EVR_DA;
+          return ValueRepresentation_Date;
 
         case OrthancPluginValueRepresentation_DS:
-          return EVR_DS;
+          return ValueRepresentation_DecimalString;
 
         case OrthancPluginValueRepresentation_DT:
-          return EVR_DT;
+          return ValueRepresentation_DateTime;
 
         case OrthancPluginValueRepresentation_FD:
-          return EVR_FD;
+          return ValueRepresentation_FloatingPointDouble;
 
         case OrthancPluginValueRepresentation_FL:
-          return EVR_FL;
+          return ValueRepresentation_FloatingPointSingle;
 
         case OrthancPluginValueRepresentation_IS:
-          return EVR_IS;
+          return ValueRepresentation_IntegerString;
 
         case OrthancPluginValueRepresentation_LO:
-          return EVR_LO;
+          return ValueRepresentation_LongString;
 
         case OrthancPluginValueRepresentation_LT:
-          return EVR_LT;
+          return ValueRepresentation_LongText;
 
         case OrthancPluginValueRepresentation_OB:
-          return EVR_OB;
+          return ValueRepresentation_OtherByte;
 
         case OrthancPluginValueRepresentation_OF:
-          return EVR_OF;
+          return ValueRepresentation_OtherFloat;
 
         case OrthancPluginValueRepresentation_OW:
-          return EVR_OW;
+          return ValueRepresentation_OtherWord;
 
         case OrthancPluginValueRepresentation_PN:
-          return EVR_PN;
+          return ValueRepresentation_PatientName;
 
         case OrthancPluginValueRepresentation_SH:
-          return EVR_SH;
+          return ValueRepresentation_ShortString;
 
         case OrthancPluginValueRepresentation_SL:
-          return EVR_SL;
+          return ValueRepresentation_SignedLong;
 
         case OrthancPluginValueRepresentation_SQ:
-          return EVR_SQ;
+          return ValueRepresentation_Sequence;
 
         case OrthancPluginValueRepresentation_SS:
-          return EVR_SS;
+          return ValueRepresentation_SignedShort;
 
         case OrthancPluginValueRepresentation_ST:
-          return EVR_ST;
+          return ValueRepresentation_ShortText;
 
         case OrthancPluginValueRepresentation_TM:
-          return EVR_TM;
+          return ValueRepresentation_Time;
 
         case OrthancPluginValueRepresentation_UI:
-          return EVR_UI;
+          return ValueRepresentation_UniqueIdentifier;
 
         case OrthancPluginValueRepresentation_UL:
-          return EVR_UL;
+          return ValueRepresentation_UnsignedLong;
 
         case OrthancPluginValueRepresentation_UN:
-          return EVR_UN;
+          return ValueRepresentation_Unknown;
 
         case OrthancPluginValueRepresentation_US:
-          return EVR_US;
+          return ValueRepresentation_UnsignedShort;
 
         case OrthancPluginValueRepresentation_UT:
-          return EVR_UT;
+          return ValueRepresentation_UnlimitedText;
+
+        default:
+          throw OrthancException(ErrorCode_ParameterOutOfRange);
+
+          /*
+          Not supported as of DCMTK 3.6.0:
+          return ValueRepresentation_OtherDouble
+          return ValueRepresentation_OtherLong
+          return ValueRepresentation_UniversalResource
+          return ValueRepresentation_UnlimitedCharacters
+          */
+      }
+    }
+
+
+    OrthancPluginValueRepresentation Convert(ValueRepresentation vr)
+    {
+      switch (vr)
+      {
+        case ValueRepresentation_ApplicationEntity:
+          return OrthancPluginValueRepresentation_AE;
+
+        case ValueRepresentation_AgeString:
+          return OrthancPluginValueRepresentation_AS;
+
+        case ValueRepresentation_AttributeTag:
+          return OrthancPluginValueRepresentation_AT;
+
+        case ValueRepresentation_CodeString:
+          return OrthancPluginValueRepresentation_CS;
+
+        case ValueRepresentation_Date:
+          return OrthancPluginValueRepresentation_DA;
+
+        case ValueRepresentation_DecimalString:
+          return OrthancPluginValueRepresentation_DS;
+
+        case ValueRepresentation_DateTime:
+          return OrthancPluginValueRepresentation_DT;
+
+        case ValueRepresentation_FloatingPointDouble:
+          return OrthancPluginValueRepresentation_FD;
+
+        case ValueRepresentation_FloatingPointSingle:
+          return OrthancPluginValueRepresentation_FL;
+
+        case ValueRepresentation_IntegerString:
+          return OrthancPluginValueRepresentation_IS;
+
+        case ValueRepresentation_LongString:
+          return OrthancPluginValueRepresentation_LO;
+
+        case ValueRepresentation_LongText:
+          return OrthancPluginValueRepresentation_LT;
+
+        case ValueRepresentation_OtherByte:
+          return OrthancPluginValueRepresentation_OB;
+
+        case ValueRepresentation_OtherFloat:
+          return OrthancPluginValueRepresentation_OF;
+
+        case ValueRepresentation_OtherWord:
+          return OrthancPluginValueRepresentation_OW;
+
+        case ValueRepresentation_PatientName:
+          return OrthancPluginValueRepresentation_PN;
+
+        case ValueRepresentation_ShortString:
+          return OrthancPluginValueRepresentation_SH;
+
+        case ValueRepresentation_SignedLong:
+          return OrthancPluginValueRepresentation_SL;
+
+        case ValueRepresentation_Sequence:
+          return OrthancPluginValueRepresentation_SQ;
+
+        case ValueRepresentation_SignedShort:
+          return OrthancPluginValueRepresentation_SS;
+
+        case ValueRepresentation_ShortText:
+          return OrthancPluginValueRepresentation_ST;
+
+        case ValueRepresentation_Time:
+          return OrthancPluginValueRepresentation_TM;
+
+        case ValueRepresentation_UniqueIdentifier:
+          return OrthancPluginValueRepresentation_UI;
+
+        case ValueRepresentation_UnsignedLong:
+          return OrthancPluginValueRepresentation_UL;
+
+        case ValueRepresentation_UnsignedShort:
+          return OrthancPluginValueRepresentation_US;
+
+        case ValueRepresentation_UnlimitedText:
+          return OrthancPluginValueRepresentation_UT;
+
+        case ValueRepresentation_Unknown:
+          return OrthancPluginValueRepresentation_UN;  // Unknown
+
+          // These VR are not supported as of DCMTK 3.6.0, so they are
+          // mapped to "UN" (unknown) VR in the plugins
+        case ValueRepresentation_OtherDouble:          
+        case ValueRepresentation_OtherLong:
+        case ValueRepresentation_UniversalResource:
+        case ValueRepresentation_UnlimitedCharacters:
+          return OrthancPluginValueRepresentation_UN;
 
         default:
           throw OrthancException(ErrorCode_ParameterOutOfRange);
       }
     }
-
-
-    OrthancPluginValueRepresentation Convert(DcmEVR vr)
-    {
-      switch (vr)
-      {
-        case EVR_AE:
-          return OrthancPluginValueRepresentation_AE;
-
-        case EVR_AS:
-          return OrthancPluginValueRepresentation_AS;
-
-        case EVR_AT:
-          return OrthancPluginValueRepresentation_AT;
-
-        case EVR_CS:
-          return OrthancPluginValueRepresentation_CS;
-
-        case EVR_DA:
-          return OrthancPluginValueRepresentation_DA;
-
-        case EVR_DS:
-          return OrthancPluginValueRepresentation_DS;
-
-        case EVR_DT:
-          return OrthancPluginValueRepresentation_DT;
-
-        case EVR_FD:
-          return OrthancPluginValueRepresentation_FD;
-
-        case EVR_FL:
-          return OrthancPluginValueRepresentation_FL;
-
-        case EVR_IS:
-          return OrthancPluginValueRepresentation_IS;
-
-        case EVR_LO:
-          return OrthancPluginValueRepresentation_LO;
-
-        case EVR_LT:
-          return OrthancPluginValueRepresentation_LT;
-
-        case EVR_OB:
-          return OrthancPluginValueRepresentation_OB;
-
-        case EVR_OF:
-          return OrthancPluginValueRepresentation_OF;
-
-        case EVR_OW:
-          return OrthancPluginValueRepresentation_OW;
-
-        case EVR_PN:
-          return OrthancPluginValueRepresentation_PN;
-
-        case EVR_SH:
-          return OrthancPluginValueRepresentation_SH;
-
-        case EVR_SL:
-          return OrthancPluginValueRepresentation_SL;
-
-        case EVR_SQ:
-          return OrthancPluginValueRepresentation_SQ;
-
-        case EVR_SS:
-          return OrthancPluginValueRepresentation_SS;
-
-        case EVR_ST:
-          return OrthancPluginValueRepresentation_ST;
-
-        case EVR_TM:
-          return OrthancPluginValueRepresentation_TM;
-
-        case EVR_UI:
-          return OrthancPluginValueRepresentation_UI;
-
-        case EVR_UL:
-          return OrthancPluginValueRepresentation_UL;
-
-        case EVR_US:
-          return OrthancPluginValueRepresentation_US;
-
-        case EVR_UT:
-          return OrthancPluginValueRepresentation_UT;
-
-        case EVR_UN:
-        default:
-          return OrthancPluginValueRepresentation_UN;  // Unknown
-      }
-    }
-#endif
   }
 }