changeset 60:0a255ec7a5e9

Upgrade to GDCM 3.0.10 for static builds
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Mar 2022 18:49:07 +0100
parents fa14f508d244
children d5d420f52a3c 773da384dd74
files NEWS Plugin/Plugin.cpp Resources/CMake/GdcmConfiguration.cmake
diffstat 3 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Mar 23 18:20:13 2022 +0100
+++ b/NEWS	Wed Mar 23 18:49:07 2022 +0100
@@ -1,8 +1,9 @@
 Pending changes in the mainline
 ===============================
 
-* Take the configuration "RestrictTransferSyntaxes" into account not 
-  only for Decoding but also for Transcoding.
+* Take the configuration option "RestrictTransferSyntaxes" into
+  account not only for decoding, but also for transcoding
+* Upgrade to GDCM 3.0.10 for static builds
 
 Version 1.4 (2021-07-06)
 ========================
--- a/Plugin/Plugin.cpp	Wed Mar 23 18:20:13 2022 +0100
+++ b/Plugin/Plugin.cpp	Wed Mar 23 18:49:07 2022 +0100
@@ -30,12 +30,19 @@
 #include <gdcmFileExplicitFilter.h>
 #include <gdcmImageChangePhotometricInterpretation.h>
 #include <gdcmImageChangeTransferSyntax.h>
+#include <gdcmImageHelper.h>
 #include <gdcmImageReader.h>
 #include <gdcmImageWriter.h>
 #include <gdcmTagKeywords.h>
 #include <gdcmUIDGenerator.h>
 #include <gdcmVersion.h>
-#include <gdcmImageHelper.h>
+
+#define GDCM_VERSION_IS_ABOVE(major, minor, revision)           \
+  (GDCM_MAJOR_VERSION > major ||                                \
+   (GDCM_MAJOR_VERSION == major &&                              \
+    (GDCM_MINOR_VERSION > minor ||                              \
+     (GDCM_MINOR_VERSION == minor &&                            \
+      GDCM_BUILD_VERSION >= revision))))
 
 
 static OrthancPlugins::GdcmDecoderCache  cache_;
@@ -378,19 +385,21 @@
           // https://groups.google.com/g/orthanc-users/c/xIwrkFRceuE/m/jwxy50djAQAJ
           throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Cannot transcode 1bpp DICOM images");
         }
-        
+
+#if !GDCM_VERSION_IS_ABOVE(3, 0, 9)
         if (reader.GetImage().GetPixelFormat().GetBitsStored() == 16u &&
             syntax == gdcm::TransferSyntax::JPEGExtendedProcess2_4)
         {
           /**
            * This is a temporary workaround for issue #513 in GDCM
-           * (will be fixed in GDCM 3.0.9):
+           * that was fixed in GDCM 3.0.9:
            * https://sourceforge.net/p/gdcm/bugs/513/
            * https://groups.google.com/g/orthanc-users/c/xt9hwpj6mlQ
            **/
           throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented,
                                           "Transcoding 16bpp images to 1.2.840.10008.1.2.4.51 might lead to a crash in GDCM");
         }
+#endif
         
         gdcm::ImageChangeTransferSyntax change;
         change.SetTransferSyntax(syntax);
--- a/Resources/CMake/GdcmConfiguration.cmake	Wed Mar 23 18:20:13 2022 +0100
+++ b/Resources/CMake/GdcmConfiguration.cmake	Wed Mar 23 18:49:07 2022 +0100
@@ -22,8 +22,8 @@
     set(GDCM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gdcm-2.8.9.tar.gz")
     set(GDCM_MD5 "aeb00e0cb5375d454010a72e2e0f6154")
   else()
-    set(GDCM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gdcm-3.0.8.tar.gz")
-    set(GDCM_MD5 "29e0e60b04183e3eb9c18ad093156b2c")
+    set(GDCM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gdcm-3.0.10.tar.gz")
+    set(GDCM_MD5 "28c70d02c2005a8c9d2a5847c8ba3c00")
   endif()
   
   if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR