changeset 2:4f6495e05084

CMake option: ORTHANC_SDK_VERSION
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 19 May 2020 12:38:44 +0200
parents cfceeebf12a5
children 28b9a9868307
files CMakeLists.txt Plugin/Plugin.cpp
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri May 15 16:18:20 2020 +0200
+++ b/CMakeLists.txt	Tue May 19 12:38:44 2020 +0200
@@ -45,6 +45,7 @@
 # Advanced parameters to fine-tune linking against system libraries
 set(USE_SYSTEM_GDCM ON CACHE BOOL "Use the system version of Grassroot DICOM (GDCM)")
 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
+set(ORTHANC_SDK_VERSION "0.9.5" CACHE STRING "Version of the Orthanc plugin SDK to use, if not using the system version (can be \"0.9.5\", or \"framework\")")
 
 
 # Download and setup the Orthanc framework
@@ -65,7 +66,13 @@
 
 # Check that the Orthanc SDK headers are available
 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
-  include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-0.9.5)
+  if (ORTHANC_SDK_VERSION STREQUAL "0.9.5")
+    include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-0.9.5)
+  elseif (ORTHANC_SDK_VERSION STREQUAL "framework")
+    include_directories(${ORTHANC_ROOT}/Plugins/Include)
+  else()
+    message(FATAL_ERROR "Unsupported version of the Orthanc plugin SDK: ${ORTHANC_SDK_VERSION}")
+  endif()
 else ()
   CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
   if (NOT HAVE_ORTHANC_H)
--- a/Plugin/Plugin.cpp	Fri May 15 16:18:20 2020 +0200
+++ b/Plugin/Plugin.cpp	Tue May 19 12:38:44 2020 +0200
@@ -30,6 +30,7 @@
 #include <gdcmImageReader.h>
 #include <gdcmImageWriter.h>
 #include <gdcmUIDGenerator.h>
+#include <gdcmTagKeywords.h>
 
 
 static OrthancPlugins::GdcmDecoderCache  cache_;
@@ -250,7 +251,7 @@
                                               "GDCM cannot generate a UID");
             }
 
-            gdcm::Attribute<0x0008,0x0018> sopInstanceUid;
+            gdcm::Keywords::SOPInstanceUID sopInstanceUid;
             sopInstanceUid.SetValue(uid);
             reader.GetFile().GetDataSet().Replace(sopInstanceUid.GetAsDataElement());
             *hasSopInstanceUidChanged = 1;