changeset 5:ef6ddcfed855

fix linking against system-wide Orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 25 Apr 2022 14:57:58 +0200
parents 206b763f9bce
children 1e000761eb62
files CMakeLists.txt Sources/Framework/InputDicomInstance.cpp Sources/Framework/InputDicomInstance.h
diffstat 3 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Apr 25 11:12:00 2022 +0200
+++ b/CMakeLists.txt	Mon Apr 25 14:57:58 2022 +0200
@@ -59,7 +59,8 @@
       message(FATAL_ERROR "Unable to locate Boost on this system")
     endif()
     
-    link_libraries(${Boost_LIBRARIES} jsoncpp)
+    include(FindDCMTK)
+    link_libraries(${Boost_LIBRARIES} ${DCMTK_LIBRARIES} jsoncpp)
   endif()
 
   link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
@@ -158,7 +159,7 @@
   Sources/Plugin/PluginFrameDecoder.cpp
 
   ${NEURO_SOURCES}
-  ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
+  ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
   )
 
 add_dependencies(OrthancNeuro AutogeneratedTarget)
@@ -168,7 +169,6 @@
   Sources/UnitTestsSources/UnitTestsMain.cpp
 
   ${NEURO_SOURCES}
-  ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
   ${GOOGLE_TEST_SOURCES}
   )
 
--- a/Sources/Framework/InputDicomInstance.cpp	Mon Apr 25 11:12:00 2022 +0200
+++ b/Sources/Framework/InputDicomInstance.cpp	Mon Apr 25 14:57:58 2022 +0200
@@ -611,7 +611,8 @@
         !GetCSAHeader().ParseUnsignedInteger32(numberOfImagesInMosaic, CSA_NUMBER_OF_IMAGES_IN_MOSAIC) ||
         numberOfImagesInMosaic == 0)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
+      ExtractGenericSlices(slices, instanceIndexInCollection);
+      return;
     }
   
     const unsigned int countPerAxis = static_cast<unsigned int>(std::ceil(sqrtf(numberOfImagesInMosaic)));
--- a/Sources/Framework/InputDicomInstance.h	Mon Apr 25 11:12:00 2022 +0200
+++ b/Sources/Framework/InputDicomInstance.h	Mon Apr 25 14:57:58 2022 +0200
@@ -19,10 +19,6 @@
 
 #pragma once
 
-#if !defined(ORTHANC_ENABLE_DCMTK)
-#  error The macro ORTHANC_ENABLE_DCMTK must be defined
-#endif
-
 #include "CSAHeader.h"
 #include "NeuroEnumerations.h"
 #include "Slice.h"
@@ -30,6 +26,10 @@
 #include <DicomFormat/DicomImageInformation.h>
 #include <DicomFormat/DicomMap.h>
 
+#if !defined(ORTHANC_ENABLE_DCMTK)
+#  error The macro ORTHANC_ENABLE_DCMTK must be defined
+#endif
+
 #if ORTHANC_ENABLE_DCMTK == 1
 #  include <DicomParsing/ParsedDicomFile.h>
 #endif