changeset 3730:ae31ba2b09a6

toolbox: LookupTransferSyntax()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Mar 2020 15:06:22 +0100
parents 982c24a70dfd
children e7ff4f9b34bd 6cd4b7724c3d
files Core/DicomParsing/FromDcmtkBridge.cpp Core/DicomParsing/FromDcmtkBridge_TransferSyntaxes.impl.h Core/Enumerations.cpp Core/Enumerations.h Core/Enumerations_TransferSyntaxes.impl.h Resources/GenerateTransferSyntaxes.py Resources/GenerateTransferSyntaxesDcmtk.mustache Resources/GenerateTransferSyntaxesEnumerations.mustache
diffstat 8 files changed, 944 insertions(+), 350 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/FromDcmtkBridge.cpp	Sun Mar 08 19:51:57 2020 +0100
+++ b/Core/DicomParsing/FromDcmtkBridge.cpp	Mon Mar 09 15:06:22 2020 +0100
@@ -2569,181 +2569,7 @@
     Encoding encoding = DetectEncoding(hasCodeExtensions, dataset, defaultEncoding);
     ApplyVisitorToDataset(dataset, visitor, parentTags, parentIndexes, encoding, hasCodeExtensions);
   }
-
-
-  // This function is autogenerated by the script
-  // "Resources/GenerateTransferSyntaxes.py"
-  bool FromDcmtkBridge::GetDcmtkTransferSyntax(E_TransferSyntax& target,
-                                               DicomTransferSyntax syntax)
-  {
-    switch (syntax)
-    {
-      case DicomTransferSyntax_LittleEndianImplicit:
-        target = EXS_LittleEndianImplicit;
-        return true;
-
-      case DicomTransferSyntax_LittleEndianExplicit:
-        target = EXS_LittleEndianExplicit;
-        return true;
-
-      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
-        target = EXS_DeflatedLittleEndianExplicit;
-        return true;
-
-      case DicomTransferSyntax_BigEndianExplicit:
-        target = EXS_BigEndianExplicit;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess1:
-        target = EXS_JPEGProcess1;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess2_4:
-        target = EXS_JPEGProcess2_4;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess3_5:
-        target = EXS_JPEGProcess3_5;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess6_8:
-        target = EXS_JPEGProcess6_8;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess7_9:
-        target = EXS_JPEGProcess7_9;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess10_12:
-        target = EXS_JPEGProcess10_12;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess11_13:
-        target = EXS_JPEGProcess11_13;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess14:
-        target = EXS_JPEGProcess14;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess15:
-        target = EXS_JPEGProcess15;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess16_18:
-        target = EXS_JPEGProcess16_18;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess17_19:
-        target = EXS_JPEGProcess17_19;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess20_22:
-        target = EXS_JPEGProcess20_22;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess21_23:
-        target = EXS_JPEGProcess21_23;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess24_26:
-        target = EXS_JPEGProcess24_26;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess25_27:
-        target = EXS_JPEGProcess25_27;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess28:
-        target = EXS_JPEGProcess28;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess29:
-        target = EXS_JPEGProcess29;
-        return true;
-
-      case DicomTransferSyntax_JPEGProcess14SV1:
-        target = EXS_JPEGProcess14SV1;
-        return true;
-
-      case DicomTransferSyntax_JPEGLSLossless:
-        target = EXS_JPEGLSLossless;
-        return true;
-
-      case DicomTransferSyntax_JPEGLSLossy:
-        target = EXS_JPEGLSLossy;
-        return true;
-
-      case DicomTransferSyntax_JPEG2000LosslessOnly:
-        target = EXS_JPEG2000LosslessOnly;
-        return true;
-
-      case DicomTransferSyntax_JPEG2000:
-        target = EXS_JPEG2000;
-        return true;
-
-      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
-        target = EXS_JPEG2000MulticomponentLosslessOnly;
-        return true;
-
-      case DicomTransferSyntax_JPEG2000Multicomponent:
-        target = EXS_JPEG2000Multicomponent;
-        return true;
-
-      case DicomTransferSyntax_JPIPReferenced:
-        target = EXS_JPIPReferenced;
-        return true;
-
-      case DicomTransferSyntax_JPIPReferencedDeflate:
-        target = EXS_JPIPReferencedDeflate;
-        return true;
-
-      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
-        target = EXS_MPEG2MainProfileAtMainLevel;
-        return true;
-
-      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
-        target = EXS_MPEG2MainProfileAtHighLevel;
-        return true;
-
-      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
-        target = EXS_MPEG4HighProfileLevel4_1;
-        return true;
-
-      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
-        target = EXS_MPEG4BDcompatibleHighProfileLevel4_1;
-        return true;
-
-      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
-        target = EXS_MPEG4HighProfileLevel4_2_For2DVideo;
-        return true;
-
-      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
-        target = EXS_MPEG4HighProfileLevel4_2_For3DVideo;
-        return true;
-
-      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
-        target = EXS_MPEG4StereoHighProfileLevel4_2;
-        return true;
-
-#if DCMTK_VERSION_NUMBER >= 362
-      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
-        target = EXS_HEVCMainProfileLevel5_1;
-        return true;
-#endif
-
-#if DCMTK_VERSION_NUMBER >= 362
-      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
-        target = EXS_HEVCMain10ProfileLevel5_1;
-        return true;
-#endif
-
-      case DicomTransferSyntax_RLELossless:
-        target = EXS_RLELossless;
-        return true;
-        
-      default:
-        return false;
-    }
-  }
 }
+
+
+#include "./FromDcmtkBridge_TransferSyntaxes.impl.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/DicomParsing/FromDcmtkBridge_TransferSyntaxes.impl.h	Mon Mar 09 15:06:22 2020 +0100
@@ -0,0 +1,210 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2020 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"
+
+namespace Orthanc
+{
+  bool GetDcmtkTransferSyntax(E_TransferSyntax& target,
+                              DicomTransferSyntax syntax)
+  {
+    switch (syntax)
+    {
+      case DicomTransferSyntax_LittleEndianImplicit:
+        target = EXS_LittleEndianImplicit;
+        return true;
+
+      case DicomTransferSyntax_LittleEndianExplicit:
+        target = EXS_LittleEndianExplicit;
+        return true;
+
+      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
+        target = EXS_DeflatedLittleEndianExplicit;
+        return true;
+
+      case DicomTransferSyntax_BigEndianExplicit:
+        target = EXS_BigEndianExplicit;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess1:
+        target = EXS_JPEGProcess1;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess2_4:
+        target = EXS_JPEGProcess2_4;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess3_5:
+        target = EXS_JPEGProcess3_5;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess6_8:
+        target = EXS_JPEGProcess6_8;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess7_9:
+        target = EXS_JPEGProcess7_9;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess10_12:
+        target = EXS_JPEGProcess10_12;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess11_13:
+        target = EXS_JPEGProcess11_13;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess14:
+        target = EXS_JPEGProcess14;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess15:
+        target = EXS_JPEGProcess15;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess16_18:
+        target = EXS_JPEGProcess16_18;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess17_19:
+        target = EXS_JPEGProcess17_19;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess20_22:
+        target = EXS_JPEGProcess20_22;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess21_23:
+        target = EXS_JPEGProcess21_23;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess24_26:
+        target = EXS_JPEGProcess24_26;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess25_27:
+        target = EXS_JPEGProcess25_27;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess28:
+        target = EXS_JPEGProcess28;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess29:
+        target = EXS_JPEGProcess29;
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess14SV1:
+        target = EXS_JPEGProcess14SV1;
+        return true;
+
+      case DicomTransferSyntax_JPEGLSLossless:
+        target = EXS_JPEGLSLossless;
+        return true;
+
+      case DicomTransferSyntax_JPEGLSLossy:
+        target = EXS_JPEGLSLossy;
+        return true;
+
+      case DicomTransferSyntax_JPEG2000LosslessOnly:
+        target = EXS_JPEG2000LosslessOnly;
+        return true;
+
+      case DicomTransferSyntax_JPEG2000:
+        target = EXS_JPEG2000;
+        return true;
+
+      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
+        target = EXS_JPEG2000MulticomponentLosslessOnly;
+        return true;
+
+      case DicomTransferSyntax_JPEG2000Multicomponent:
+        target = EXS_JPEG2000Multicomponent;
+        return true;
+
+      case DicomTransferSyntax_JPIPReferenced:
+        target = EXS_JPIPReferenced;
+        return true;
+
+      case DicomTransferSyntax_JPIPReferencedDeflate:
+        target = EXS_JPIPReferencedDeflate;
+        return true;
+
+      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
+        target = EXS_MPEG2MainProfileAtMainLevel;
+        return true;
+
+      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
+        target = EXS_MPEG2MainProfileAtHighLevel;
+        return true;
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
+        target = EXS_MPEG4HighProfileLevel4_1;
+        return true;
+
+      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
+        target = EXS_MPEG4BDcompatibleHighProfileLevel4_1;
+        return true;
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
+        target = EXS_MPEG4HighProfileLevel4_2_For2DVideo;
+        return true;
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
+        target = EXS_MPEG4HighProfileLevel4_2_For3DVideo;
+        return true;
+
+      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
+        target = EXS_MPEG4StereoHighProfileLevel4_2;
+        return true;
+
+#if DCMTK_VERSION_NUMBER >= 362
+      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
+        target = EXS_HEVCMainProfileLevel5_1;
+        return true;
+#endif
+
+#if DCMTK_VERSION_NUMBER >= 362
+      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
+        target = EXS_HEVCMain10ProfileLevel5_1;
+        return true;
+#endif
+
+      case DicomTransferSyntax_RLELossless:
+        target = EXS_RLELossless;
+        return true;
+
+      default:
+        return false;
+    }
+  }
+}
--- a/Core/Enumerations.cpp	Sun Mar 08 19:51:57 2020 +0100
+++ b/Core/Enumerations.cpp	Mon Mar 09 15:06:22 2020 +0100
@@ -2244,142 +2244,7 @@
 
     LOG(INFO) << "Default encoding for DICOM was changed to: " << name;
   }
+}
 
 
-  // This function is autogenerated by the script
-  // "Resources/GenerateTransferSyntaxes.py"
-  const char* GetTransferSyntaxUid(DicomTransferSyntax syntax)
-  {
-    switch (syntax)
-    {
-      case DicomTransferSyntax_LittleEndianImplicit:
-        return "1.2.840.10008.1.2";
-
-      case DicomTransferSyntax_LittleEndianExplicit:
-        return "1.2.840.10008.1.2.1";
-
-      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
-        return "1.2.840.10008.1.2.1.99";
-
-      case DicomTransferSyntax_BigEndianExplicit:
-        return "1.2.840.10008.1.2.2";
-
-      case DicomTransferSyntax_JPEGProcess1:
-        return "1.2.840.10008.1.2.4.50";
-
-      case DicomTransferSyntax_JPEGProcess2_4:
-        return "1.2.840.10008.1.2.4.51";
-
-      case DicomTransferSyntax_JPEGProcess3_5:
-        return "1.2.840.10008.1.2.4.52";
-
-      case DicomTransferSyntax_JPEGProcess6_8:
-        return "1.2.840.10008.1.2.4.53";
-
-      case DicomTransferSyntax_JPEGProcess7_9:
-        return "1.2.840.10008.1.2.4.54";
-
-      case DicomTransferSyntax_JPEGProcess10_12:
-        return "1.2.840.10008.1.2.4.55";
-
-      case DicomTransferSyntax_JPEGProcess11_13:
-        return "1.2.840.10008.1.2.4.56";
-
-      case DicomTransferSyntax_JPEGProcess14:
-        return "1.2.840.10008.1.2.4.57";
-
-      case DicomTransferSyntax_JPEGProcess15:
-        return "1.2.840.10008.1.2.4.58";
-
-      case DicomTransferSyntax_JPEGProcess16_18:
-        return "1.2.840.10008.1.2.4.59";
-
-      case DicomTransferSyntax_JPEGProcess17_19:
-        return "1.2.840.10008.1.2.4.60";
-
-      case DicomTransferSyntax_JPEGProcess20_22:
-        return "1.2.840.10008.1.2.4.61";
-
-      case DicomTransferSyntax_JPEGProcess21_23:
-        return "1.2.840.10008.1.2.4.62";
-
-      case DicomTransferSyntax_JPEGProcess24_26:
-        return "1.2.840.10008.1.2.4.63";
-
-      case DicomTransferSyntax_JPEGProcess25_27:
-        return "1.2.840.10008.1.2.4.64";
-
-      case DicomTransferSyntax_JPEGProcess28:
-        return "1.2.840.10008.1.2.4.65";
-
-      case DicomTransferSyntax_JPEGProcess29:
-        return "1.2.840.10008.1.2.4.66";
-
-      case DicomTransferSyntax_JPEGProcess14SV1:
-        return "1.2.840.10008.1.2.4.70";
-
-      case DicomTransferSyntax_JPEGLSLossless:
-        return "1.2.840.10008.1.2.4.80";
-
-      case DicomTransferSyntax_JPEGLSLossy:
-        return "1.2.840.10008.1.2.4.81";
-
-      case DicomTransferSyntax_JPEG2000LosslessOnly:
-        return "1.2.840.10008.1.2.4.90";
-
-      case DicomTransferSyntax_JPEG2000:
-        return "1.2.840.10008.1.2.4.91";
-
-      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
-        return "1.2.840.10008.1.2.4.92";
-
-      case DicomTransferSyntax_JPEG2000Multicomponent:
-        return "1.2.840.10008.1.2.4.93";
-
-      case DicomTransferSyntax_JPIPReferenced:
-        return "1.2.840.10008.1.2.4.94";
-
-      case DicomTransferSyntax_JPIPReferencedDeflate:
-        return "1.2.840.10008.1.2.4.95";
-
-      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
-        return "1.2.840.10008.1.2.4.100";
-
-      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
-        return "1.2.840.10008.1.2.4.101";
-
-      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
-        return "1.2.840.10008.1.2.4.102";
-
-      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
-        return "1.2.840.10008.1.2.4.103";
-
-      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
-        return "1.2.840.10008.1.2.4.104";
-
-      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
-        return "1.2.840.10008.1.2.4.105";
-
-      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
-        return "1.2.840.10008.1.2.4.106";
-
-      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
-        return "1.2.840.10008.1.2.4.107";
-
-      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
-        return "1.2.840.10008.1.2.4.108";
-
-      case DicomTransferSyntax_RLELossless:
-        return "1.2.840.10008.1.2.5";
-
-      case DicomTransferSyntax_RFC2557MimeEncapsulation:
-        return "1.2.840.10008.1.2.6.1";
-
-      case DicomTransferSyntax_XML:
-        return "1.2.840.10008.1.2.6.2";
-        
-      default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
-    }
-  }
-}
+#include "./Enumerations_TransferSyntaxes.impl.h"
--- a/Core/Enumerations.h	Sun Mar 08 19:51:57 2020 +0100
+++ b/Core/Enumerations.h	Mon Mar 09 15:06:22 2020 +0100
@@ -848,4 +848,9 @@
   void SetDefaultDicomEncoding(Encoding encoding);
 
   const char* GetTransferSyntaxUid(DicomTransferSyntax syntax);
+
+  bool IsRetiredTransferSyntax(DicomTransferSyntax syntax);
+
+  bool LookupTransferSyntax(DicomTransferSyntax& target,
+                            const std::string& uid);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/Enumerations_TransferSyntaxes.impl.h	Mon Mar 09 15:06:22 2020 +0100
@@ -0,0 +1,566 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2020 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"
+
+namespace Orthanc
+{
+  const char* GetTransferSyntaxUid(DicomTransferSyntax syntax)
+  {
+    switch (syntax)
+    {
+      case DicomTransferSyntax_LittleEndianImplicit:
+        return "1.2.840.10008.1.2";
+
+      case DicomTransferSyntax_LittleEndianExplicit:
+        return "1.2.840.10008.1.2.1";
+
+      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
+        return "1.2.840.10008.1.2.1.99";
+
+      case DicomTransferSyntax_BigEndianExplicit:
+        return "1.2.840.10008.1.2.2";
+
+      case DicomTransferSyntax_JPEGProcess1:
+        return "1.2.840.10008.1.2.4.50";
+
+      case DicomTransferSyntax_JPEGProcess2_4:
+        return "1.2.840.10008.1.2.4.51";
+
+      case DicomTransferSyntax_JPEGProcess3_5:
+        return "1.2.840.10008.1.2.4.52";
+
+      case DicomTransferSyntax_JPEGProcess6_8:
+        return "1.2.840.10008.1.2.4.53";
+
+      case DicomTransferSyntax_JPEGProcess7_9:
+        return "1.2.840.10008.1.2.4.54";
+
+      case DicomTransferSyntax_JPEGProcess10_12:
+        return "1.2.840.10008.1.2.4.55";
+
+      case DicomTransferSyntax_JPEGProcess11_13:
+        return "1.2.840.10008.1.2.4.56";
+
+      case DicomTransferSyntax_JPEGProcess14:
+        return "1.2.840.10008.1.2.4.57";
+
+      case DicomTransferSyntax_JPEGProcess15:
+        return "1.2.840.10008.1.2.4.58";
+
+      case DicomTransferSyntax_JPEGProcess16_18:
+        return "1.2.840.10008.1.2.4.59";
+
+      case DicomTransferSyntax_JPEGProcess17_19:
+        return "1.2.840.10008.1.2.4.60";
+
+      case DicomTransferSyntax_JPEGProcess20_22:
+        return "1.2.840.10008.1.2.4.61";
+
+      case DicomTransferSyntax_JPEGProcess21_23:
+        return "1.2.840.10008.1.2.4.62";
+
+      case DicomTransferSyntax_JPEGProcess24_26:
+        return "1.2.840.10008.1.2.4.63";
+
+      case DicomTransferSyntax_JPEGProcess25_27:
+        return "1.2.840.10008.1.2.4.64";
+
+      case DicomTransferSyntax_JPEGProcess28:
+        return "1.2.840.10008.1.2.4.65";
+
+      case DicomTransferSyntax_JPEGProcess29:
+        return "1.2.840.10008.1.2.4.66";
+
+      case DicomTransferSyntax_JPEGProcess14SV1:
+        return "1.2.840.10008.1.2.4.70";
+
+      case DicomTransferSyntax_JPEGLSLossless:
+        return "1.2.840.10008.1.2.4.80";
+
+      case DicomTransferSyntax_JPEGLSLossy:
+        return "1.2.840.10008.1.2.4.81";
+
+      case DicomTransferSyntax_JPEG2000LosslessOnly:
+        return "1.2.840.10008.1.2.4.90";
+
+      case DicomTransferSyntax_JPEG2000:
+        return "1.2.840.10008.1.2.4.91";
+
+      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
+        return "1.2.840.10008.1.2.4.92";
+
+      case DicomTransferSyntax_JPEG2000Multicomponent:
+        return "1.2.840.10008.1.2.4.93";
+
+      case DicomTransferSyntax_JPIPReferenced:
+        return "1.2.840.10008.1.2.4.94";
+
+      case DicomTransferSyntax_JPIPReferencedDeflate:
+        return "1.2.840.10008.1.2.4.95";
+
+      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
+        return "1.2.840.10008.1.2.4.100";
+
+      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
+        return "1.2.840.10008.1.2.4.101";
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
+        return "1.2.840.10008.1.2.4.102";
+
+      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
+        return "1.2.840.10008.1.2.4.103";
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
+        return "1.2.840.10008.1.2.4.104";
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
+        return "1.2.840.10008.1.2.4.105";
+
+      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
+        return "1.2.840.10008.1.2.4.106";
+
+      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
+        return "1.2.840.10008.1.2.4.107";
+
+      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
+        return "1.2.840.10008.1.2.4.108";
+
+      case DicomTransferSyntax_RLELossless:
+        return "1.2.840.10008.1.2.5";
+
+      case DicomTransferSyntax_RFC2557MimeEncapsulation:
+        return "1.2.840.10008.1.2.6.1";
+
+      case DicomTransferSyntax_XML:
+        return "1.2.840.10008.1.2.6.2";
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
+  bool IsRetiredTransferSyntax(DicomTransferSyntax syntax)
+  {
+    switch (syntax)
+    {
+      case DicomTransferSyntax_LittleEndianImplicit:
+        return false;
+
+      case DicomTransferSyntax_LittleEndianExplicit:
+        return false;
+
+      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
+        return false;
+
+      case DicomTransferSyntax_BigEndianExplicit:
+        return false;
+
+      case DicomTransferSyntax_JPEGProcess1:
+        return false;
+
+      case DicomTransferSyntax_JPEGProcess2_4:
+        return false;
+
+      case DicomTransferSyntax_JPEGProcess3_5:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess6_8:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess7_9:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess10_12:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess11_13:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess14:
+        return false;
+
+      case DicomTransferSyntax_JPEGProcess15:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess16_18:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess17_19:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess20_22:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess21_23:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess24_26:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess25_27:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess28:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess29:
+        return true;
+
+      case DicomTransferSyntax_JPEGProcess14SV1:
+        return false;
+
+      case DicomTransferSyntax_JPEGLSLossless:
+        return false;
+
+      case DicomTransferSyntax_JPEGLSLossy:
+        return false;
+
+      case DicomTransferSyntax_JPEG2000LosslessOnly:
+        return false;
+
+      case DicomTransferSyntax_JPEG2000:
+        return false;
+
+      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
+        return false;
+
+      case DicomTransferSyntax_JPEG2000Multicomponent:
+        return false;
+
+      case DicomTransferSyntax_JPIPReferenced:
+        return false;
+
+      case DicomTransferSyntax_JPIPReferencedDeflate:
+        return false;
+
+      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
+        return false;
+
+      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
+        return false;
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
+        return false;
+
+      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
+        return false;
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
+        return false;
+
+      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
+        return false;
+
+      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
+        return false;
+
+      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
+        return false;
+
+      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
+        return false;
+
+      case DicomTransferSyntax_RLELossless:
+        return false;
+
+      case DicomTransferSyntax_RFC2557MimeEncapsulation:
+        return true;
+
+      case DicomTransferSyntax_XML:
+        return true;
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
+  bool LookupTransferSyntax(DicomTransferSyntax& target,
+                            const std::string& uid)
+  {
+    if (uid == "1.2.840.10008.1.2")
+    {
+      target = DicomTransferSyntax_LittleEndianImplicit;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.1")
+    {
+      target = DicomTransferSyntax_LittleEndianExplicit;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.1.99")
+    {
+      target = DicomTransferSyntax_DeflatedLittleEndianExplicit;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.2")
+    {
+      target = DicomTransferSyntax_BigEndianExplicit;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.50")
+    {
+      target = DicomTransferSyntax_JPEGProcess1;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.51")
+    {
+      target = DicomTransferSyntax_JPEGProcess2_4;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.52")
+    {
+      target = DicomTransferSyntax_JPEGProcess3_5;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.53")
+    {
+      target = DicomTransferSyntax_JPEGProcess6_8;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.54")
+    {
+      target = DicomTransferSyntax_JPEGProcess7_9;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.55")
+    {
+      target = DicomTransferSyntax_JPEGProcess10_12;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.56")
+    {
+      target = DicomTransferSyntax_JPEGProcess11_13;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.57")
+    {
+      target = DicomTransferSyntax_JPEGProcess14;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.58")
+    {
+      target = DicomTransferSyntax_JPEGProcess15;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.59")
+    {
+      target = DicomTransferSyntax_JPEGProcess16_18;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.60")
+    {
+      target = DicomTransferSyntax_JPEGProcess17_19;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.61")
+    {
+      target = DicomTransferSyntax_JPEGProcess20_22;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.62")
+    {
+      target = DicomTransferSyntax_JPEGProcess21_23;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.63")
+    {
+      target = DicomTransferSyntax_JPEGProcess24_26;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.64")
+    {
+      target = DicomTransferSyntax_JPEGProcess25_27;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.65")
+    {
+      target = DicomTransferSyntax_JPEGProcess28;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.66")
+    {
+      target = DicomTransferSyntax_JPEGProcess29;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.70")
+    {
+      target = DicomTransferSyntax_JPEGProcess14SV1;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.80")
+    {
+      target = DicomTransferSyntax_JPEGLSLossless;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.81")
+    {
+      target = DicomTransferSyntax_JPEGLSLossy;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.90")
+    {
+      target = DicomTransferSyntax_JPEG2000LosslessOnly;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.91")
+    {
+      target = DicomTransferSyntax_JPEG2000;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.92")
+    {
+      target = DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.93")
+    {
+      target = DicomTransferSyntax_JPEG2000Multicomponent;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.94")
+    {
+      target = DicomTransferSyntax_JPIPReferenced;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.95")
+    {
+      target = DicomTransferSyntax_JPIPReferencedDeflate;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.100")
+    {
+      target = DicomTransferSyntax_MPEG2MainProfileAtMainLevel;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.101")
+    {
+      target = DicomTransferSyntax_MPEG2MainProfileAtHighLevel;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.102")
+    {
+      target = DicomTransferSyntax_MPEG4HighProfileLevel4_1;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.103")
+    {
+      target = DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.104")
+    {
+      target = DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.105")
+    {
+      target = DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.106")
+    {
+      target = DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.107")
+    {
+      target = DicomTransferSyntax_HEVCMainProfileLevel5_1;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.4.108")
+    {
+      target = DicomTransferSyntax_HEVCMain10ProfileLevel5_1;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.5")
+    {
+      target = DicomTransferSyntax_RLELossless;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.6.1")
+    {
+      target = DicomTransferSyntax_RFC2557MimeEncapsulation;
+      return true;
+    }
+    
+    if (uid == "1.2.840.10008.1.2.6.2")
+    {
+      target = DicomTransferSyntax_XML;
+      return true;
+    }
+    
+    return false;
+  }
+}
--- a/Resources/GenerateTransferSyntaxes.py	Sun Mar 08 19:51:57 2020 +0100
+++ b/Resources/GenerateTransferSyntaxes.py	Mon Mar 09 15:06:22 2020 +0100
@@ -35,6 +35,7 @@
 import os
 import re
 import sys
+import pystache
 
 BASE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 
@@ -65,43 +66,19 @@
     f.write(a)
 
 
-    
+
 ##
-## Generate the "GetTransferSyntaxUid()" function in
-## "Enumerations.cpp"
+## Generate the implementations
 ##
 
-path = os.path.join(BASE, 'Core', 'Enumerations.cpp')
-with open(path, 'r') as f:
-    a = f.read()
-
-s = '\n\n'.join(map(lambda x: '      case DicomTransferSyntax_%s:\n        return "%s";' % (x['Value'], x['UID']), SYNTAXES))
-a = re.sub('(GetTransferSyntaxUid\(DicomTransferSyntax.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)',
-           r'\1\n%s\2' % s, a, re.DOTALL)
-
-with open(path, 'w') as f:
-    f.write(a)
-
-    
-##
-## Generate the "GetDcmtkTransferSyntax()" function in
-## "FromDcmtkBridge.cpp"
-##
+with open(os.path.join(BASE, 'Core', 'Enumerations_TransferSyntaxes.impl.h'), 'w') as b:
+    with open(os.path.join(BASE, 'Resources', 'GenerateTransferSyntaxesEnumerations.mustache'), 'r') as a:
+        b.write(pystache.render(a.read(), {
+            'Syntaxes' : SYNTAXES
+        }))
 
-path = os.path.join(BASE, 'Core', 'DicomParsing', 'FromDcmtkBridge.cpp')
-with open(path, 'r') as f:
-    a = f.read()
-
-def Format(x):
-    t = '      case DicomTransferSyntax_%s:\n        target = %s;\n        return true;' % (x['Value'], x['DCMTK'])
-    if 'SinceDCMTK' in x:
-        return '#if DCMTK_VERSION_NUMBER >= %s\n%s\n#endif' % (x['SinceDCMTK'], t)
-    else:
-        return t
-    
-s = '\n\n'.join(map(Format, filter(lambda x: 'DCMTK' in x, SYNTAXES)))
-a = re.sub('(GetDcmtkTransferSyntax\(E_TransferSyntax.*?\s*DicomTransferSyntax.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)',
-           r'\1\n%s\2' % s, a, re.DOTALL)
-
-with open(path, 'w') as f:
-    f.write(a)
+with open(os.path.join(BASE, 'Core', 'DicomParsing', 'FromDcmtkBridge_TransferSyntaxes.impl.h'), 'w') as b:
+    with open(os.path.join(BASE, 'Resources', 'GenerateTransferSyntaxesDcmtk.mustache'), 'r') as a:
+        b.write(pystache.render(a.read(), {
+            'Syntaxes' : SYNTAXES
+        }))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/GenerateTransferSyntaxesDcmtk.mustache	Mon Mar 09 15:06:22 2020 +0100
@@ -0,0 +1,60 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2020 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"
+
+namespace Orthanc
+{
+  bool GetDcmtkTransferSyntax(E_TransferSyntax& target,
+                              DicomTransferSyntax syntax)
+  {
+    switch (syntax)
+    {
+      {{#Syntaxes}}
+      {{#DCMTK}}
+      {{#SinceDCMTK}}
+#if DCMTK_VERSION_NUMBER >= {{SinceDCMTK}}
+      {{/SinceDCMTK}}
+      case DicomTransferSyntax_{{Value}}:
+        target = {{DCMTK}};
+        return true;
+      {{#SinceDCMTK}}
+#endif
+      {{/SinceDCMTK}}
+
+      {{/DCMTK}}
+      {{/Syntaxes}}
+      default:
+        return false;
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/GenerateTransferSyntaxesEnumerations.mustache	Mon Mar 09 15:06:22 2020 +0100
@@ -0,0 +1,85 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2020 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"
+
+namespace Orthanc
+{
+  const char* GetTransferSyntaxUid(DicomTransferSyntax syntax)
+  {
+    switch (syntax)
+    {
+      {{#Syntaxes}}
+      case DicomTransferSyntax_{{Value}}:
+        return "{{UID}}";
+
+      {{/Syntaxes}}
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
+  bool IsRetiredTransferSyntax(DicomTransferSyntax syntax)
+  {
+    switch (syntax)
+    {
+      {{#Syntaxes}}
+      case DicomTransferSyntax_{{Value}}:
+        {{#Retired}}
+        return true;
+        {{/Retired}}
+        {{^Retired}}
+        return false;
+        {{/Retired}}
+
+      {{/Syntaxes}}
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
+  bool LookupTransferSyntax(DicomTransferSyntax& target,
+                            const std::string& uid)
+  {
+    {{#Syntaxes}}
+    if (uid == "{{UID}}")
+    {
+      target = DicomTransferSyntax_{{Value}};
+      return true;
+    }
+    
+    {{/Syntaxes}}
+    return false;
+  }
+}