[itk] Revise, test, fix (#41525)

This commit is contained in:
Kai Pastor 2024-11-16 01:16:45 +01:00 committed by GitHub
parent 8cbab05e49
commit b2cb0da531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 1067 additions and 1216 deletions

101
ports/itk/dependencies.diff Normal file
View File

@ -0,0 +1,101 @@
diff --git a/CMake/ITKConfig.cmake.in b/CMake/ITKConfig.cmake.in
index 7a77ae3..6a565e8 100644
--- a/CMake/ITKConfig.cmake.in
+++ b/CMake/ITKConfig.cmake.in
@@ -1,3 +1,8 @@
+include(CMakeFindDependencyMacro)
+find_dependency(double-conversion CONFIG)
+find_dependency(OpenJPEG CONFIG)
+find_dependency(VXL CONFIG)
+include("${VXL_CMAKE_DIR}/UseVXL.cmake")
#-----------------------------------------------------------------------------
#
# ITKConfig.cmake - ITK CMake configuration file for external projects.
diff --git a/CMake/itkOpenCL.cmake b/CMake/itkOpenCL.cmake
index 21aab8c..f2bf8ae 100644
--- a/CMake/itkOpenCL.cmake
+++ b/CMake/itkOpenCL.cmake
@@ -1,5 +1,7 @@
if(ITK_USE_GPU)
find_package(OpenCL REQUIRED)
+ set(OPENCL_INCLUDE_DIRS "${OpenCL_INCLUDE_DIRS}")
+ set(OPENCL_LIBRARIES "${OpenCL_LIBRARIES}")
if(NOT ${OPENCL_FOUND})
message(FATAL "Could not find OpenCL")
endif()
diff --git a/Modules/ThirdParty/DoubleConversion/CMakeLists.txt b/Modules/ThirdParty/DoubleConversion/CMakeLists.txt
index 135c1d3..f644a32 100644
--- a/Modules/ThirdParty/DoubleConversion/CMakeLists.txt
+++ b/Modules/ThirdParty/DoubleConversion/CMakeLists.txt
@@ -7,9 +7,9 @@ option(ITK_USE_SYSTEM_DOUBLECONVERSION
mark_as_advanced(ITK_USE_SYSTEM_DOUBLECONVERSION)
if(ITK_USE_SYSTEM_DOUBLECONVERSION)
- find_package(double-conversion 3.1.6 REQUIRED)
+ find_package(double-conversion 3.1.6 REQUIRED GLOBAL)
get_target_property(ITKDoubleConversion_INCLUDE_DIRS double-conversion::double-conversion INTERFACE_INCLUDE_DIRECTORIES)
- get_target_property(ITKDoubleConversion_LIBRARIES double-conversion::double-conversion LOCATION)
+ set(ITKDoubleConversion_LIBRARIES double-conversion::double-conversion)
else()
set(ITKDoubleConversion_INCLUDE_DIRS
${ITKDoubleConversion_SOURCE_DIR}/src
diff --git a/Modules/ThirdParty/Eigen3/CMakeLists.txt b/Modules/ThirdParty/Eigen3/CMakeLists.txt
index 8dbbb86..428d335 100644
--- a/Modules/ThirdParty/Eigen3/CMakeLists.txt
+++ b/Modules/ThirdParty/Eigen3/CMakeLists.txt
@@ -88,7 +88,7 @@ find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED CONFI
# Eigen3 targets are not installed if ITK_USE_SYSTEM_EIGEN==True
itk_module_impl()
-configure_file(src/itk_eigen.h.in src/itk_eigen.h)
+configure_file(src/itk_eigen.h.in src/itk_eigen.h @ONLY)
install(FILES ${ITKEigen3_BINARY_DIR}/src/itk_eigen.h
DESTINATION ${ITKEigen3_INSTALL_INCLUDE_DIR}
COMPONENT Development
diff --git a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
index 103eaa9..b59eb81 100644
--- a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
+++ b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
@@ -1,12 +1,19 @@
project(ITKOpenJPEG)
set(ITKOpenJPEG_THIRD_PARTY 1)
+if(ITK_USE_SYSTEM_OpenJPEG)
+ find_package(OpenJPEG CONFIG REQUIRED GLOBAL)
+ set(ITKOpenJPEG_INCLUDE_DIRS "")
+ set(ITKOpenJPEG_LIBRARIES $<TARGET_NAME:openjp2>)
+ set(ITKOpenJPEG_NO_SRC 1)
+else()
set(ITKOpenJPEG_INCLUDE_DIRS
${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg
)
set(ITKOpenJPEG_LIBRARIES itkopenjpeg)
set(ITK_LIBRARY_PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
+endif()
itk_module_impl()
diff --git a/Modules/ThirdParty/VNL/CMakeLists.txt b/Modules/ThirdParty/VNL/CMakeLists.txt
index c379a24..6a15432 100644
--- a/Modules/ThirdParty/VNL/CMakeLists.txt
+++ b/Modules/ThirdParty/VNL/CMakeLists.txt
@@ -5,7 +5,7 @@ option(ITK_USE_SYSTEM_VXL "Use an outside build of VXL." OFF)
mark_as_advanced(ITK_USE_SYSTEM_VXL)
if(ITK_USE_SYSTEM_VXL)
- find_package(VXL 3.0.0 REQUIRED)
+ find_package(VXL 3.0.0 REQUIRED GLOBAL)
# 3.0.0 is the first version of VXL that supports
# the requirement of front() and back() members
# in the vnl_vector and vnl_vector_fixed.
@@ -17,7 +17,8 @@ if(ITK_USE_SYSTEM_VXL)
${VXL_CORE_INCLUDE_DIR}
)
set(ITKVNL_LIBRARIES vnl_algo vnl v3p_netlib netlib vcl)
- set(ITKVNL_SYSTEM_LIBRARY_DIRS "${VXL_LIBRARY_DIR}")
+ list(TRANSFORM ITKVNL_LIBRARIES REPLACE "^(.+)\$" "\$<TARGET_NAME:\\1>")
+ set(ITKVNL_SYSTEM_LIBRARY_DIRS "")
set(ITKVNL_NO_SRC 1)
else()

View File

@ -1,22 +0,0 @@
diff --git a/Modules/ThirdParty/DoubleConversion/CMakeLists.txt b/Modules/ThirdParty/DoubleConversion/CMakeLists.txt
index 16c611fd3..13978724c 100644
--- a/Modules/ThirdParty/DoubleConversion/CMakeLists.txt
+++ b/Modules/ThirdParty/DoubleConversion/CMakeLists.txt
@@ -9,7 +9,16 @@ mark_as_advanced(ITK_USE_SYSTEM_DOUBLECONVERSION)
if(ITK_USE_SYSTEM_DOUBLECONVERSION)
find_package(double-conversion 3.1.6 REQUIRED)
get_target_property(ITKDoubleConversion_INCLUDE_DIRS double-conversion::double-conversion INTERFACE_INCLUDE_DIRECTORIES)
- get_target_property(ITKDoubleConversion_LIBRARIES double-conversion::double-conversion LOCATION)
+ get_target_property(ITKDoubleConversion_LIBRARY_RELEASE double-conversion::double-conversion IMPORTED_IMPLIB_RELEASE)
+ if(NOT ITKDoubleConversion_LIBRARY_RELEASE)
+ get_target_property(ITKDoubleConversion_LIBRARY_RELEASE double-conversion::double-conversion IMPORTED_LOCATION_RELEASE)
+ endif()
+ get_target_property(ITKDoubleConversion_LIBRARY_DEBUG double-conversion::double-conversion IMPORTED_IMPLIB_DEBUG)
+ if(NOT ITKDoubleConversion_LIBRARY_DEBUG)
+ get_target_property(ITKDoubleConversion_LIBRARY_DEBUG double-conversion::double-conversion IMPORTED_LOCATION_DEBUG)
+ endif()
+ include(SelectLibraryConfigurations)
+ select_library_configurations(ITKDoubleConversion)
else()
set(ITKDoubleConversion_INCLUDE_DIRS
${ITKDoubleConversion_SOURCE_DIR}/src

68
ports/itk/fftw.diff Normal file
View File

@ -0,0 +1,68 @@
diff --git a/CMake/FindFFTW.cmake b/CMake/FindFFTW.cmake
index 709c0cd..64baa8e 100644
--- a/CMake/FindFFTW.cmake
+++ b/CMake/FindFFTW.cmake
@@ -30,7 +30,27 @@
## to set the initial value of the CMake variable `MKLROOT` (see
## https://software.intel.com/en-us/mkl-linux-developer-guide-scripts-to-set-environment-variables).
-if(ITK_USE_FFTWD OR ITK_USE_FFTWF)
+set(FFTW_INCLUDE "")
+if(ITK_USE_CUFFTW)
+ find_package(CUDAToolkit REQUIRED)
+ find_path(CUFFTW_INCLUDE_PATH cufftw.h PATHS ${CUDAToolkit_INCLUDE_DIRS} NO_DEFAULT_PATH REQUIRED)
+ set(FFTW_INCLUDE ${CUFFTW_INCLUDE_PATH})
+ set(FFTWD_LIBRARIES CUDA::cufftw)
+ set(FFTWD_FOUND 1)
+ set(FFTWF_LIBRARIES CUDA::cufftw)
+ set(FFTWF_FOUND 1)
+elseif(ITK_USE_FFTWD OR ITK_USE_FFTWF)
+ find_path(FFTW_INCLUDE_PATH fftw3.h REQUIRED)
+ set(FFTW_INCLUDE ${CUFFTW_INCLUDE_PATH})
+ if(ITK_USE_FFTWD)
+ find_package(FFTWD NAMES FFTW3 CONFIG REQUIRED)
+ set(FFTWD_LIBRARIES FFTW3::fftw3)
+ endif()
+ if(ITK_USE_FFTWF)
+ find_package(FFTWF NAMES FFTW3f CONFIG REQUIRED)
+ set(FFTWF_LIBRARIES FFTW3::fftw3f)
+ endif()
+elseif(0)
if(ITK_USE_MKL)
# If the user has provided the MKL include path then search nearby for library files
diff --git a/CMake/ITKConfig.cmake.in b/CMake/ITKConfig.cmake.in
index 9066d4f..4ec0266 100644
--- a/CMake/ITKConfig.cmake.in
+++ b/CMake/ITKConfig.cmake.in
@@ -3,6 +3,16 @@ include(CMakeFindDependencyMacro)
find_dependency(OpenJPEG CONFIG)
find_dependency(VXL CONFIG)
include("${VXL_CMAKE_DIR}/UseVXL.cmake")
+if("@ITK_USE_CUFFTW@")
+ find_dependency(CUDAToolkit)
+else()
+ if("@ITK_USE_FFTWD@")
+ find_dependency(FFTW3 CONFIG)
+ endif()
+ if("@ITK_USE_FFTWF@")
+ find_dependency(FFTW3f CONFIG)
+ endif()
+endif()
#-----------------------------------------------------------------------------
#
# ITKConfig.cmake - ITK CMake configuration file for external projects.
diff --git a/Modules/Filtering/FFT/src/CMakeLists.txt b/Modules/Filtering/FFT/src/CMakeLists.txt
index 83b176c..b51bc48 100644
--- a/Modules/Filtering/FFT/src/CMakeLists.txt
+++ b/Modules/Filtering/FFT/src/CMakeLists.txt
@@ -10,6 +10,9 @@ endif()
itk_module_add_library(ITKFFT ${ITKFFT_SRCS})
# this library is only needed if FFTW is used
+if(ITK_USE_CUFFTW)
+ target_link_libraries(ITKFFT LINK_PUBLIC CUDA::cufftw)
+endif()
if(ITK_USE_FFTWF
OR ITK_USE_FFTWD
AND NOT ITK_USE_CUFFTW)

View File

@ -1,156 +0,0 @@
diff --git a/Modules/Core/GPUCommon/src/CMakeLists.txt b/Modules/Core/GPUCommon/src/CMakeLists.txt
index 0b39f2a9a..160f7a752 100644
--- a/Modules/Core/GPUCommon/src/CMakeLists.txt
+++ b/Modules/Core/GPUCommon/src/CMakeLists.txt
@@ -14,5 +14,5 @@ if(ITK_USE_GPU)
write_gpu_kernels("${ITKGPUCommon_Kernels}" ITKGPUCommon_SRCS)
itk_module_add_library(ITKGPUCommon ${ITKGPUCommon_SRCS})
- target_link_libraries(ITKGPUCommon LINK_PUBLIC ${OPENCL_LIBRARIES})
+ target_link_libraries(ITKGPUCommon LINK_PUBLIC ${OpenCL_LIBRARIES})
endif()
diff --git a/Modules/Core/GPUFiniteDifference/CMakeLists.txt b/Modules/Core/GPUFiniteDifference/CMakeLists.txt
index c1bfde450..a642d9230 100644
--- a/Modules/Core/GPUFiniteDifference/CMakeLists.txt
+++ b/Modules/Core/GPUFiniteDifference/CMakeLists.txt
@@ -9,8 +9,8 @@ if(NOT ITK_SOURCE_DIR)
endif()
if(ITK_USE_GPU)
- set(ITKGPUFiniteDifference_SYSTEM_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS})
- set(ITKGPUFiniteDifference_SYSTEM_LIBRARY_DIRS ${OPENCL_LIBRARIES})
+ set(ITKGPUFiniteDifference_SYSTEM_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
+ set(ITKGPUFiniteDifference_SYSTEM_LIBRARY_DIRS ${OpenCL_LIBRARIES})
set(ITKGPUFiniteDifference_LIBRARIES ITKGPUFiniteDifference)
endif()
diff --git a/Modules/Core/GPUFiniteDifference/src/CMakeLists.txt b/Modules/Core/GPUFiniteDifference/src/CMakeLists.txt
index 8425cc025..8335c69a0 100644
--- a/Modules/Core/GPUFiniteDifference/src/CMakeLists.txt
+++ b/Modules/Core/GPUFiniteDifference/src/CMakeLists.txt
@@ -9,5 +9,5 @@ if(ITK_USE_GPU)
write_gpu_kernels("${ITKGPUFiniteDifference_Kernels}" ITKGPUFiniteDifference_SRCS)
itk_module_add_library(ITKGPUFiniteDifference ${ITKGPUFiniteDifference_SRCS})
- target_link_libraries(ITKGPUFiniteDifference LINK_PUBLIC ${OPENCL_LIBRARIES})
+ target_link_libraries(ITKGPUFiniteDifference LINK_PUBLIC ${OpenCL_LIBRARIES})
endif()
diff --git a/Modules/Filtering/GPUAnisotropicSmoothing/CMakeLists.txt b/Modules/Filtering/GPUAnisotropicSmoothing/CMakeLists.txt
index f36fd887d..310d983fa 100644
--- a/Modules/Filtering/GPUAnisotropicSmoothing/CMakeLists.txt
+++ b/Modules/Filtering/GPUAnisotropicSmoothing/CMakeLists.txt
@@ -10,8 +10,8 @@ endif()
if(ITK_USE_GPU)
set(ITKGPUAnisotropicSmoothing_LIBRARIES ITKGPUAnisotropicSmoothing)
- set(ITKGPUAnisotropicSmoothing_SYSTEM_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS})
- set(ITKGPUAnisotropicSmoothing_SYSTEM_LIBRARY_DIRS ${OPENCL_LIBRARIES})
+ set(ITKGPUAnisotropicSmoothing_SYSTEM_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
+ set(ITKGPUAnisotropicSmoothing_SYSTEM_LIBRARY_DIRS ${OpenCL_LIBRARIES})
endif()
if(NOT ITK_SOURCE_DIR)
diff --git a/Modules/Filtering/GPUImageFilterBase/CMakeLists.txt b/Modules/Filtering/GPUImageFilterBase/CMakeLists.txt
index 078905521..67fd7b832 100644
--- a/Modules/Filtering/GPUImageFilterBase/CMakeLists.txt
+++ b/Modules/Filtering/GPUImageFilterBase/CMakeLists.txt
@@ -10,8 +10,8 @@ endif()
if(ITK_USE_GPU)
set(ITKGPUImageFilterBase_LIBRARIES ITKGPUImageFilterBase)
- set(ITKGPUImageFilterBase_SYSTEM_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS})
- set(ITKGPUImageFilterBase_SYSTEM_LIBRARY_DIRS ${OPENCL_LIBRARIES})
+ set(ITKGPUImageFilterBase_SYSTEM_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
+ set(ITKGPUImageFilterBase_SYSTEM_LIBRARY_DIRS ${OpenCL_LIBRARIES})
endif()
if(NOT ITK_SOURCE_DIR)
diff --git a/Modules/Filtering/GPUImageFilterBase/src/CMakeLists.txt b/Modules/Filtering/GPUImageFilterBase/src/CMakeLists.txt
index 251493f5e..6d33fa964 100644
--- a/Modules/Filtering/GPUImageFilterBase/src/CMakeLists.txt
+++ b/Modules/Filtering/GPUImageFilterBase/src/CMakeLists.txt
@@ -10,5 +10,5 @@ if(ITK_USE_GPU)
write_gpu_kernels("${ITKGPUImageFilterBase_Kernels}" ITKGPUImageFilterBase_SRCS)
itk_module_add_library(ITKGPUImageFilterBase ${ITKGPUImageFilterBase_SRCS})
- target_link_libraries(ITKGPUImageFilterBase LINK_PUBLIC ${OPENCL_LIBRARIES})
+ target_link_libraries(ITKGPUImageFilterBase LINK_PUBLIC ${OpenCL_LIBRARIES})
endif()
diff --git a/Modules/Filtering/GPUSmoothing/CMakeLists.txt b/Modules/Filtering/GPUSmoothing/CMakeLists.txt
index 9bac40921..2ed493d40 100644
--- a/Modules/Filtering/GPUSmoothing/CMakeLists.txt
+++ b/Modules/Filtering/GPUSmoothing/CMakeLists.txt
@@ -10,8 +10,8 @@ endif()
if(ITK_USE_GPU)
set(ITKGPUSmoothing_LIBRARIES ITKGPUSmoothing)
- set(ITKGPUSmoothing_SYSTEM_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS})
- set(ITKGPUSmoothing_SYSTEM_LIBRARY_DIRS ${OPENCL_LIBRARIES})
+ set(ITKGPUSmoothing_SYSTEM_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
+ set(ITKGPUSmoothing_SYSTEM_LIBRARY_DIRS ${OpenCL_LIBRARIES})
endif()
if(NOT ITK_SOURCE_DIR)
diff --git a/Modules/Filtering/GPUSmoothing/src/CMakeLists.txt b/Modules/Filtering/GPUSmoothing/src/CMakeLists.txt
index d2120e842..2c6ca4a4a 100644
--- a/Modules/Filtering/GPUSmoothing/src/CMakeLists.txt
+++ b/Modules/Filtering/GPUSmoothing/src/CMakeLists.txt
@@ -9,5 +9,5 @@ if(ITK_USE_GPU)
write_gpu_kernels("${ITKGPUSmoothing_Kernels}" ITKGPUSmoothing_SRCS)
itk_module_add_library(ITKGPUSmoothing ${ITKGPUSmoothing_SRCS})
- target_link_libraries(ITKGPUSmoothing LINK_PUBLIC ${OPENCL_LIBRARIES})
+ target_link_libraries(ITKGPUSmoothing LINK_PUBLIC ${OpenCL_LIBRARIES})
endif()
diff --git a/Modules/Filtering/GPUThresholding/CMakeLists.txt b/Modules/Filtering/GPUThresholding/CMakeLists.txt
index 4390785f5..61786b7a8 100644
--- a/Modules/Filtering/GPUThresholding/CMakeLists.txt
+++ b/Modules/Filtering/GPUThresholding/CMakeLists.txt
@@ -2,8 +2,8 @@ project(ITKGPUThresholding)
if(ITK_USE_GPU)
set(ITKGPUThresholding_LIBRARIES ITKGPUThresholding)
- set(ITKGPUThresholding_SYSTEM_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS})
- set(ITKGPUThresholding_SYSTEM_LIBRARY_DIRS ${OPENCL_LIBRARIES})
+ set(ITKGPUThresholding_SYSTEM_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
+ set(ITKGPUThresholding_SYSTEM_LIBRARY_DIRS ${OpenCL_LIBRARIES})
endif()
itk_module_impl()
diff --git a/Modules/Filtering/GPUThresholding/src/CMakeLists.txt b/Modules/Filtering/GPUThresholding/src/CMakeLists.txt
index 326c86859..c07c80414 100644
--- a/Modules/Filtering/GPUThresholding/src/CMakeLists.txt
+++ b/Modules/Filtering/GPUThresholding/src/CMakeLists.txt
@@ -9,5 +9,5 @@ if(ITK_USE_GPU)
write_gpu_kernels("${ITKGPUThresholding_Kernels}" ITKGPUThresholding_SRCS)
itk_module_add_library(ITKGPUThresholding ${ITKGPUThresholding_SRCS})
- target_link_libraries(ITKGPUThresholding LINK_PUBLIC ${OPENCL_LIBRARIES})
+ target_link_libraries(ITKGPUThresholding LINK_PUBLIC ${OpenCL_LIBRARIES})
endif()
diff --git a/Modules/Registration/GPUPDEDeformable/CMakeLists.txt b/Modules/Registration/GPUPDEDeformable/CMakeLists.txt
index c8d70a423..097c974c5 100644
--- a/Modules/Registration/GPUPDEDeformable/CMakeLists.txt
+++ b/Modules/Registration/GPUPDEDeformable/CMakeLists.txt
@@ -2,8 +2,8 @@ project(ITKGPUPDEDeformableRegistration)
if(ITK_USE_GPU)
set(ITKGPUPDEDeformableRegistration_LIBRARIES ITKGPUPDEDeformableRegistration)
- set(ITKGPUPDEDeformableRegistration_SYSTEM_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS})
- set(ITKGPUPDEDeformableRegistration_SYSTEM_LIBRARY_DIRS ${OPENCL_LIBRARIES})
+ set(ITKGPUPDEDeformableRegistration_SYSTEM_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS})
+ set(ITKGPUPDEDeformableRegistration_SYSTEM_LIBRARY_DIRS ${OpenCL_LIBRARIES})
endif()
itk_module_impl()
diff --git a/Modules/Registration/GPUPDEDeformable/src/CMakeLists.txt b/Modules/Registration/GPUPDEDeformable/src/CMakeLists.txt
index 28b1d194c..1a049bdde 100644
--- a/Modules/Registration/GPUPDEDeformable/src/CMakeLists.txt
+++ b/Modules/Registration/GPUPDEDeformable/src/CMakeLists.txt
@@ -10,5 +10,5 @@ if(ITK_USE_GPU)
write_gpu_kernels("${ITKGPUPDEDeformableRegistration_Kernels}" ITKGPUPDEDeformableRegistration_SRCS)
itk_module_add_library(ITKGPUPDEDeformableRegistration ${ITKGPUPDEDeformableRegistration_SRCS})
- target_link_libraries(ITKGPUPDEDeformableRegistration LINK_PUBLIC ${OPENCL_LIBRARIES})
+ target_link_libraries(ITKGPUPDEDeformableRegistration LINK_PUBLIC ${OpenCL_LIBRARIES})
endif()

View File

@ -1,8 +1,8 @@
diff --git a/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx b/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx
index 1b1fe9526..0da4aa0c4 100644
index 3592573..aefb8a2 100644
--- a/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx
+++ b/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx
@@ -26,9 +26,9 @@
@@ -26,9 +26,7 @@
extern "C"
{
@ -10,12 +10,10 @@ index 1b1fe9526..0da4aa0c4 100644
-#include "j2k.h"
-#include "jp2.h"
+#include <openjpeg.h>
+//#include "j2k.h"
+//##include "jp2.h"
}
@@ -62,8 +62,7 @@ public:
@@ -62,8 +60,7 @@ public:
OPJ_UINT32 m_TileStartX;
OPJ_UINT32 m_TileStartY;
@ -25,7 +23,7 @@ index 1b1fe9526..0da4aa0c4 100644
opj_dparameters_t m_DecompressionParameters; /* decompression parameters */
};
@@ -86,8 +85,7 @@ JPEG2000ImageIO::JPEG2000ImageIO()
@@ -86,8 +83,7 @@ JPEG2000ImageIO::JPEG2000ImageIO()
this->m_Internal->m_TileStartX = 0;
this->m_Internal->m_TileStartY = 0;
@ -35,7 +33,7 @@ index 1b1fe9526..0da4aa0c4 100644
const char * extensions[] = { ".j2k", ".jp2", ".jpt" };
@@ -139,22 +137,16 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -139,22 +135,16 @@ JPEG2000ImageIO::ReadImageInformation()
{
itkDebugMacro("ReadImageInformation()");
@ -62,7 +60,7 @@ index 1b1fe9526..0da4aa0c4 100644
this->m_Internal->m_Dinfo = nullptr; /* handle to a decompressor */
opj_image_t * l_image = nullptr;
@@ -187,14 +179,14 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -187,14 +177,14 @@ JPEG2000ImageIO::ReadImageInformation()
/* JPEG-2000 codestream */
/* get a decoder handle */
@ -80,7 +78,7 @@ index 1b1fe9526..0da4aa0c4 100644
}
break;
}
@@ -202,14 +194,14 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -202,14 +192,14 @@ JPEG2000ImageIO::ReadImageInformation()
{
/* JPEG 2000 compressed image data */
/* get a decoder handle */
@ -98,7 +96,7 @@ index 1b1fe9526..0da4aa0c4 100644
}
break;
}
@@ -217,20 +209,19 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -217,20 +207,19 @@ JPEG2000ImageIO::ReadImageInformation()
{
/* JPEG 2000, JPIP */
/* get a decoder handle */
@ -122,7 +120,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkExceptionMacro("JPEG2000ImageIO failed to read file: "
<< this->GetFileName() << std::endl
<< "Reason: "
@@ -247,27 +238,11 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -247,27 +236,11 @@ JPEG2000ImageIO::ReadImageInformation()
<< "Reason: opj_setup_decoder returns false");
}
@ -151,7 +149,7 @@ index 1b1fe9526..0da4aa0c4 100644
if (!bResult)
{
@@ -283,14 +258,22 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -283,14 +256,22 @@ JPEG2000ImageIO::ReadImageInformation()
<< "Reason: Error whle reading image header");
}
@ -176,7 +174,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkDebugMacro("Number of Components = " << l_image->numcomps);
@@ -319,7 +302,7 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -319,7 +300,7 @@ JPEG2000ImageIO::ReadImageInformation()
this->SetPixelType(IOPixelEnum::SCALAR);
break;
case 3:
@ -185,7 +183,7 @@ index 1b1fe9526..0da4aa0c4 100644
{
itkWarningMacro("file does not specify color space, assuming sRGB");
}
@@ -335,8 +318,7 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -335,8 +316,7 @@ JPEG2000ImageIO::ReadImageInformation()
itkDebugMacro("Tile Start Y = " << this->m_Internal->m_TileStartY);
itkDebugMacro("Tile Width = " << this->m_Internal->m_TileWidth);
itkDebugMacro("Tile Height = " << this->m_Internal->m_TileHeight);
@ -195,7 +193,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkDebugMacro("image->x1 = " << l_image->x1);
itkDebugMacro("image->y1 = " << l_image->y1);
@@ -349,7 +331,6 @@ JPEG2000ImageIO::ReadImageInformation()
@@ -349,7 +329,6 @@ JPEG2000ImageIO::ReadImageInformation()
/* close the byte stream */
opj_stream_destroy(cio);
@ -203,7 +201,7 @@ index 1b1fe9526..0da4aa0c4 100644
if (this->m_Internal->m_Dinfo)
{
@@ -368,16 +349,7 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -368,16 +347,7 @@ JPEG2000ImageIO::Read(void * buffer)
{
itkDebugMacro("JPEG2000ImageIO::Read() Begin");
@ -221,7 +219,7 @@ index 1b1fe9526..0da4aa0c4 100644
if (!l_stream)
{
itkExceptionMacro("JPEG2000ImageIO failed to read file: "
@@ -397,12 +369,13 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -397,12 +367,13 @@ JPEG2000ImageIO::Read(void * buffer)
{
/* JPEG-2000 codestream */
/* get a decoder handle */
@ -237,7 +235,7 @@ index 1b1fe9526..0da4aa0c4 100644
}
break;
}
@@ -410,12 +383,13 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -410,12 +381,13 @@ JPEG2000ImageIO::Read(void * buffer)
{
/* JPEG 2000 compressed image data */
/* get a decoder handle */
@ -253,7 +251,7 @@ index 1b1fe9526..0da4aa0c4 100644
}
break;
}
@@ -423,17 +397,18 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -423,17 +395,18 @@ JPEG2000ImageIO::Read(void * buffer)
{
/* JPEG 2000, JPIP */
/* get a decoder handle */
@ -275,7 +273,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkExceptionMacro("JPEG2000ImageIO failed to read file: "
<< this->GetFileName() << std::endl
<< "Reason: "
@@ -448,29 +423,13 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -448,29 +421,13 @@ JPEG2000ImageIO::Read(void * buffer)
<< "Reason: opj_setup_decoder returns false");
}
@ -306,7 +304,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl
<< "Reason: opj_read_header returns false");
}
@@ -499,7 +458,7 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -499,7 +456,7 @@ JPEG2000ImageIO::Read(void * buffer)
itkDebugMacro("p_end_x = " << p_end_x);
itkDebugMacro("p_end_y = " << p_end_y);
@ -315,7 +313,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkDebugMacro("opj_set_decode_area() after");
@@ -508,7 +467,6 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -508,7 +465,6 @@ JPEG2000ImageIO::Read(void * buffer)
opj_destroy_codec(this->m_Internal->m_Dinfo);
this->m_Internal->m_Dinfo = nullptr;
opj_stream_destroy(l_stream);
@ -323,7 +321,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl
<< "Reason: opj_set_decode_area returns false");
}
@@ -525,13 +483,13 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -525,13 +481,13 @@ JPEG2000ImageIO::Read(void * buffer)
OPJ_UINT32 l_max_data_size = 1000;
@ -339,7 +337,7 @@ index 1b1fe9526..0da4aa0c4 100644
&l_tile_index,
&l_data_size,
&l_current_tile_x0,
@@ -539,14 +497,12 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -539,14 +495,12 @@ JPEG2000ImageIO::Read(void * buffer)
&l_current_tile_x1,
&l_current_tile_y1,
&l_nb_comps,
@ -355,7 +353,7 @@ index 1b1fe9526..0da4aa0c4 100644
opj_destroy_codec(this->m_Internal->m_Dinfo);
opj_image_destroy(l_image);
itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl
@@ -571,7 +527,6 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -571,7 +525,6 @@ JPEG2000ImageIO::Read(void * buffer)
if (!l_data)
{
opj_stream_destroy(l_stream);
@ -363,7 +361,7 @@ index 1b1fe9526..0da4aa0c4 100644
opj_destroy_codec(this->m_Internal->m_Dinfo);
opj_image_destroy(l_image);
itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl
@@ -590,7 +545,6 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -590,7 +543,6 @@ JPEG2000ImageIO::Read(void * buffer)
{
free(l_data);
opj_stream_destroy(l_stream);
@ -371,7 +369,7 @@ index 1b1fe9526..0da4aa0c4 100644
opj_destroy_codec(this->m_Internal->m_Dinfo);
opj_image_destroy(l_image);
itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl
@@ -654,7 +608,6 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -654,7 +606,6 @@ JPEG2000ImageIO::Read(void * buffer)
{
free(l_data);
opj_stream_destroy(l_stream);
@ -379,7 +377,7 @@ index 1b1fe9526..0da4aa0c4 100644
opj_destroy_codec(this->m_Internal->m_Dinfo);
opj_image_destroy(l_image);
itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl
@@ -666,14 +619,12 @@ JPEG2000ImageIO::Read(void * buffer)
@@ -666,14 +617,12 @@ JPEG2000ImageIO::Read(void * buffer)
opj_destroy_codec(this->m_Internal->m_Dinfo);
this->m_Internal->m_Dinfo = nullptr;
opj_stream_destroy(l_stream);
@ -394,7 +392,7 @@ index 1b1fe9526..0da4aa0c4 100644
if (this->m_Internal->m_Dinfo)
{
@@ -840,13 +791,13 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -842,13 +791,13 @@ JPEG2000ImageIO::Write(const void * buffer)
parameters.numresolution = numberOfResolutions;
@ -410,7 +408,7 @@ index 1b1fe9526..0da4aa0c4 100644
/* initialize image components */
memset(&cmptparms[0], 0, 3 * sizeof(opj_image_cmptparm_t));
@@ -864,7 +815,7 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -866,7 +815,7 @@ JPEG2000ImageIO::Write(const void * buffer)
if (this->GetNumberOfComponents() == 1)
{
@ -419,7 +417,7 @@ index 1b1fe9526..0da4aa0c4 100644
/* initialize image components */
memset(&cmptparms[0], 0, sizeof(opj_image_cmptparm_t));
@@ -940,32 +891,32 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -942,32 +891,32 @@ JPEG2000ImageIO::Write(const void * buffer)
opj_codec_t * cinfo = nullptr;
if (extension == ".j2k")
{
@ -458,7 +456,7 @@ index 1b1fe9526..0da4aa0c4 100644
}
}
else
@@ -989,17 +940,9 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -991,17 +940,9 @@ JPEG2000ImageIO::Write(const void * buffer)
<< "Reason: opj_setup_encoder returns false");
}
@ -477,7 +475,7 @@ index 1b1fe9526..0da4aa0c4 100644
if (!cio)
{
itkExceptionMacro("JPEG2000ImageIO failed to write file: "
@@ -1017,8 +960,7 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -1019,8 +960,7 @@ JPEG2000ImageIO::Write(const void * buffer)
if (!bSuccess)
{
opj_stream_destroy(cio);
@ -487,7 +485,7 @@ index 1b1fe9526..0da4aa0c4 100644
<< "Reason: opj_start_compress returns false");
}
@@ -1026,7 +968,6 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -1028,7 +968,6 @@ JPEG2000ImageIO::Write(const void * buffer)
if (!bSuccess)
{
opj_stream_destroy(cio);
@ -495,7 +493,7 @@ index 1b1fe9526..0da4aa0c4 100644
itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl
<< "Reason: opj_encode returns false");
}
@@ -1035,14 +976,12 @@ JPEG2000ImageIO ::Write(const void * buffer)
@@ -1037,14 +976,12 @@ JPEG2000ImageIO::Write(const void * buffer)
if (!bSuccess)
{
opj_stream_destroy(cio);
@ -510,39 +508,15 @@ index 1b1fe9526..0da4aa0c4 100644
/* free remaining compression structures */
opj_destroy_codec(cinfo);
diff --git a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
index 103eaa9dd..eb8989135 100644
--- a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
+++ b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
@@ -1,12 +1,25 @@
project(ITKOpenJPEG)
set(ITKOpenJPEG_THIRD_PARTY 1)
diff --git a/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h b/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h
index 2ad0009..77a48c5 100644
--- a/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h
+++ b/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h
@@ -25,6 +25,6 @@
#ifndef itk_openjpeg_h
#define itk_openjpeg_h
-set(ITKOpenJPEG_INCLUDE_DIRS
- ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
- ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg
- )
-set(ITKOpenJPEG_LIBRARIES itkopenjpeg)
-set(ITK_LIBRARY_PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
+if(ITK_USE_SYSTEM_OpenJPEG)
+ find_package(OpenJPEG REQUIRED)
+ if(TARGET openjp2)
+ set(ITKOpenJPEG_LIBRARIES ${OPENJPEG_LIBRARIES})
+ else()
+ message(FATAL_ERROR "OpenJPEG target openjp2 missing!")
+ endif()
+ set(ITKOpenJPEG_INCLUDE_DIRS
+ ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
+ ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg
+ )
+else()
+ set(ITKOpenJPEG_INCLUDE_DIRS
+ ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
+ ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg
+ )
+ set(ITKOpenJPEG_LIBRARIES itkopenjpeg)
+ set(ITK_LIBRARY_PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
+endif()
itk_module_impl()
-#include <itkopenjpeg/openjpeg.h>
+#include <openjpeg.h>
#endif

View File

@ -1,58 +0,0 @@
diff --git a/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/CMakeLists.txt b/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/CMakeLists.txt
index 565cc338b..c061f0721 100644
--- a/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/CMakeLists.txt
+++ b/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/CMakeLists.txt
@@ -194,7 +194,7 @@ mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
# configure name mangling to allow multiple libraries to coexist
# peacefully
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
-set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
+set(MANGLE_PREFIX)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
@ONLY)
diff --git a/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt b/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt
index c4adb91a2..89b731d88 100644
--- a/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt
+++ b/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt
@@ -3,7 +3,7 @@ include_regular_expression("^.*$")
# configure name mangling to allow multiple libraries to coexist
# peacefully
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
-set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
+set(MANGLE_PREFIX)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
@ONLY)
diff --git a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
index 3811e52f4..a41e9264e 100644
--- a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
+++ b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
@@ -8,10 +8,10 @@ if(ITK_USE_SYSTEM_OpenJPEG)
else()
message(FATAL_ERROR "OpenJPEG target openjp2 missing!")
endif()
- set(ITKOpenJPEG_INCLUDE_DIRS
- ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
- ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg
- )
+ # set(ITKOpenJPEG_INCLUDE_DIRS
+ # ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
+ # ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg
+ # )
else()
set(ITKOpenJPEG_INCLUDE_DIRS
${ITKOpenJPEG_BINARY_DIR}/src/openjpeg
diff --git a/Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeLists.txt b/Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeLists.txt
index e62e43eda..35dc89976 100644
--- a/Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeLists.txt
+++ b/Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeLists.txt
@@ -68,7 +68,7 @@ CONFIGURE_FILE(${ITK3P_OpenJPEG_SOURCE_DIR}/opj_configure.h.in
# configure name mangling to allow multiple libraries to coexist
# peacefully
if(EXISTS ${ITK3P_OpenJPEG_SOURCE_DIR}/openjpeg_mangle.h.in)
-set(MANGLE_PREFIX itk)
+#set(MANGLE_PREFIX itk)
configure_file(${ITK3P_OpenJPEG_SOURCE_DIR}/openjpeg_mangle.h.in
${ITK3P_OpenJPEG_BINARY_DIR}/openjpeg_mangle.h
@ONLY)

View File

@ -1,26 +1,75 @@
vcpkg_buildpath_length_warning(37)
vcpkg_download_distfile(PYTHON_GPU_WRAPPING_PATCH
URLS https://github.com/InsightSoftwareConsortium/ITK/commit/e9b3d24f782a42f5586169e048b8d289f869d78a.diff?full_index=1
FILENAME InsightSoftwareConsortium-ITK-python-gpu-wrapping.patch
SHA512 71526320547b0eb5d0c0e0088e92ff60ba06462b82c531c79784d766361805970d9cad550660c7c85b953ec546b32c181aeab5d9f6d4142764d6f765106982a0
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO InsightSoftwareConsortium/ITK
REF "v${VERSION}"
#[[
When updating the ITK version and SHA512, remember to update the remote module versions below.
#]]
SHA512 3a98ececf258aac545f094dd3e97918c93cc82bc623ddf793c4bf0162ab06c83fbfd4d08130bdec6e617bda85dd17225488bc1394bc91b17f1232126a5d990db
HEAD_REF master
PATCHES
double-conversion.patch
dependencies.diff
fftw.diff
openjpeg.patch
openjpeg2.patch
var_libraries.patch
wrapping.patch
opencl.patch
use-the-lrintf-intrinsic.patch
dont-build-gtest.patch
"${PYTHON_GPU_WRAPPING_PATCH}"
)
file(REMOVE_RECURSE
"${SOURCE_PATH}/CMake/FindOpenCL.cmake"
"${SOURCE_PATH}/Modules/ThirdParty/GDCM/src"
"${SOURCE_PATH}/Modules/ThirdParty/OpenJPEG/src/openjpeg"
"${SOURCE_PATH}/Modules/ThirdParty/VNL/src"
)
if("cuda" IN_LIST FEATURES)
vcpkg_from_github(
OUT_SOURCE_PATH RTK_SOURCE_PATH
REPO RTKConsortium/ITKCudaCommon
# Cf. Modules/Remote/CudaCommon.remote.cmake
REF 0c20c4ef10d81910c8b2ac4e8446a1544fce3b60
SHA512 0eb1a6fe85e695345a49887cdd65103bedab72e01ae85ed03e16a8a296c6cb69a8d889a57b22dde7fcc69df4f604c274b04234c8ece306d08361fac5db029069
HEAD_REF master
)
file(REMOVE_RECURSE "${SOURCE_PATH}/Modules/Remote/CudaCommon")
file(RENAME "${RTK_SOURCE_PATH}" "${SOURCE_PATH}/Modules/Remote/CudaCommon")
file(COPY_FILE "${SOURCE_PATH}/Modules/Remote/CudaCommon/LICENSE" "${SOURCE_PATH}/CudaCommon LICENSE")
endif()
if("rtk" IN_LIST FEATURES)
# (old hint, not verified) RTK + CUDA + PYTHON + dynamic library linkage will fail and needs upstream fixes.
# RTK's ITK module must be built with ITK.
vcpkg_from_github(
OUT_SOURCE_PATH RTK_SOURCE_PATH
REPO RTKConsortium/RTK
# Cf. Modules/Remote/RTK.remote.cmake
REF bfdca5b6b666b4f08f2f7d8039af11a15cc3f831
SHA512 10a21fb4b82aa820e507e81a6b6a3c1aaee2ea1edf39364dc1c8d54e6b11b91f22d9993c0b56c0e8e20b6d549fcd6104de4e1c5e664f9ff59f5f93935fb5225a
HEAD_REF master
PATCHES
rtk/cmp0153.diff
rtk/getopt-win32.diff
)
file(REMOVE_RECURSE "${SOURCE_PATH}/Modules/Remote/RTK")
file(RENAME "${RTK_SOURCE_PATH}" "${SOURCE_PATH}/Modules/Remote/RTK")
file(COPY_FILE "${SOURCE_PATH}/Modules/Remote/RTK/COPYRIGHT.TXT" "${SOURCE_PATH}/RTK COPYRIGHT.TXT")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"vtk" Module_ITKVtkGlue
"cuda" Module_CudaCommon # Requires RTK?
"cuda" RTK_USE_CUDA
#"cuda" CUDA_HAVE_GPU # Automatically set by FindCUDA?
"cufftw" ITK_USE_CUFFTW
"opencl" ITK_USE_GPU
@ -33,42 +82,19 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
)
if("cufftw" IN_LIST FEATURES)
# Alternativly set CUFFT_LIB and CUFFTW_LIB
if(VCPKG_TARGET_IS_WINDOWS)
file(TO_CMAKE_PATH "$ENV{CUDA_PATH}" CUDA_PATH)
set(CUDA_LIB_PATH "${CUDA_PATH}")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
string(APPEND CUDA_LIB_PATH "/lib/x64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
string(APPEND CUDA_LIB_PATH "/lib/Win32")
message(FATAL_ERROR "CUFFTW is not supported on architecture ${VCPKG_TARGET_ARCHITECTURE}")
else()
message(FATAL_ERROR "Architecture ${VCPKG_TARGET_ARCHITECTURE} not supported !")
endif()
list(APPEND ADDITIONAL_OPTIONS
"-DFFTW_LIB_SEARCHPATH=${CUDA_LIB_PATH}"
"-DFFTW_INCLUDE_PATH=${CUDA_PATH}/include"
"-DCUFFTW_INCLUDE_PATH=${CUDA_PATH}/include"
)
endif()
endif()
if("rtk" IN_LIST FEATURES)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
message(FATAL_ERROR "RTK is not supported on architecture ${VCPKG_TARGET_ARCHITECTURE}")
endif()
SET(BUILD_RTK ON)
vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT cuda_toolkit_root)
list(APPEND ADDITIONAL_OPTIONS
"-DModule_RTK_GIT_TAG=8099212f715231d093f7d6a1114daecf45d871ed" # RTK latest versions (11.05.2020)
)
if("cuda" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS "-DRTK_USE_CUDA=ON")
#RTK + CUDA + PYTHON + dynamic library linkage will fail and needs upstream fixes.
endif()
"-DCUDAToolkit_ROOT=${cuda_toolkit_root}"
)
endif()
if("fftw" IN_LIST FEATURES)
# Never set these options to OFF: dual use with feature 'cufftw'
list(APPEND ADDITIONAL_OPTIONS
-DITK_USE_FFTWD=ON
-DITK_USE_FFTWF=ON
)
endif()
file(REMOVE_RECURSE "${SOURCE_PATH}/Modules/Remote/RTK")
if("opencl" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS # Wrapping options required by OpenCL if build with Python Wrappers
@ -76,8 +102,8 @@ if("opencl" IN_LIST FEATURES)
-DITK_WRAP_signed_long_long=ON
)
endif()
if("tools" IN_LIST FEATURES)
if("tools" IN_LIST FEATURES)
if("rtk" IN_LIST FEATURES)
list(APPEND TOOL_NAMES rtkadmmtotalvariation rtkadmmwavelets rtkamsterdamshroud rtkbackprojections rtkbioscangeometry rtkcheckimagequality rtkconjugategradient
rtkdigisensgeometry rtkdrawgeometricphantom rtkdrawshepploganphantom rtkdualenergysimplexdecomposition rtkelektasynergygeometry rtkextractphasesignal
@ -90,41 +116,69 @@ if("tools" IN_LIST FEATURES)
rtkwangdisplaceddetectorweighting rtkwarpedbackprojectsequence rtkwarpedforwardprojectsequence rtkwaveletsdenoising rtkxradgeometry)
endif()
endif()
if("vtk" IN_LIST FEATURES)
vcpkg_find_acquire_program(PYTHON3)
if("vtk" IN_LIST FEATURES AND EXISTS "${CURRENT_INSTALLED_DIR}/share/vtk/VTKPython-targets.cmake")
# 'vtk[python]' is built using the installed 'python3'.
# For 'find_package(vtk)', itk needs to provide the same version of python.
# Here, it is a purely *transitive* dependency via 'vtk[python]'.
include("${CURRENT_INSTALLED_DIR}/share/python3/vcpkg-port-config.cmake")
vcpkg_get_vcpkg_installed_python(PYTHON3)
list(APPEND ADDITIONAL_OPTIONS
"-DPython3_EXECUTABLE:PATH=${PYTHON3}" # Required by mvtk if vtk[python] was build
)
"-DPython3_EXECUTABLE:PATH=${PYTHON3}"
)
endif()
if("python" IN_LIST FEATURES)
message(STATUS "${PORT} builds a long time (>1h) with python wrappers enabled!")
vcpkg_find_acquire_program(PYTHON3)
vcpkg_find_acquire_program(SWIG) # Swig is only required for wrapping!
get_filename_component(SWIG_DIR "${SWIG}" DIRECTORY)
vcpkg_get_vcpkg_installed_python(PYTHON3)
list(APPEND ADDITIONAL_OPTIONS
-DITK_WRAP_PYTHON=ON
-DITK_USE_SYSTEM_CASTXML=ON
"-DCASTXML_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/castxml/bin/castxml${VCPKG_HOST_EXECUTABLE_SUFFIX}"
-DPython3_FIND_REGISTRY=NEVER
"-DPython3_EXECUTABLE:PATH=${PYTHON3}" # Required by more than one feature
"-DSWIG_EXECUTABLE=${SWIG}"
"-DSWIG_DIR=${SWIG_DIR}"
)
)
#ITK_PYTHON_SITE_PACKAGES_SUFFIX should be set to the install dir of the site-packages within vcpkg
vcpkg_find_acquire_program(SWIG) # Swig is only required for wrapping!
vcpkg_execute_required_process(
COMMAND "${SWIG}" -version
OUTPUT_VARIABLE swig_version
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME "swig-version-${TARGET_TRIPLET}"
)
string(REGEX REPLACE ".*Version ([0-9.]*).*" "\\1" swig_version "${swig_version}")
set(swig_expected "4.2.0")
if(swig_version VERSION_GREATER_EQUAL swig_expected)
vcpkg_execute_required_process(
COMMAND "${SWIG}" -swiglib
OUTPUT_VARIABLE swiglib
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME "swiglib-${TARGET_TRIPLET}"
)
list(APPEND ADDITIONAL_OPTIONS
-DITK_USE_SYSTEM_SWIG=ON
"-DSWIG_EXECUTABLE=${SWIG}"
"-DSWIG_DIR=${swiglib}"
)
else()
message(WARNING "Found swig ${swig_version}, but TK needs ${swig_expected}. A binary will be downloaded.")
endif()
endif()
if("opencv" IN_LIST FEATURES)
message(STATUS "${PORT} includes the ITKVideoBridgeOpenCV")
list(APPEND ADDITIONAL_OPTIONS
-DModule_ITKVideoBridgeOpenCV:BOOL=ON
)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
if (VCPKG_CRT_LINKAGE STREQUAL static)
set(STATIC_CRT_LNK ON)
else()
set(STATIC_CRT_LNK OFF)
endif()
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND ADDITIONAL_OPTIONS
-DITK_MSVC_STATIC_RUNTIME_LIBRARY=${STATIC_CRT_LNK}
)
-DITK_MSVC_STATIC_RUNTIME_LIBRARY=ON
-DITK_MSVC_STATIC_CRT=ON
)
endif()
set(USE_64BITS_IDS OFF)
@ -132,15 +186,16 @@ if (VCPKG_TARGET_ARCHITECTURE STREQUAL x64 OR VCPKG_TARGET_ARCHITECTURE STREQUAL
set(USE_64BITS_IDS ON)
endif()
file(REMOVE_RECURSE "${SOURCE_PATH}/CMake/FindOpenCL.cmake")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_TESTING=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_PKGCONFIG_FILES=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON
-DITK_DOXYGEN_HTML=OFF
-DITK_FORBID_DOWNLOADS=ON
-DDO_NOT_INSTALL_ITK_TEST_DRIVER=ON
-DITK_SKIP_PATH_LENGTH_CHECKS=ON
-DITK_INSTALL_DATA_DIR=share/itk/data
@ -160,21 +215,12 @@ vcpkg_cmake_configure(
-DITK_USE_SYSTEM_HDF5=ON # HDF5 was problematic in the past and still is. ITK still has not figured out how to do it correctly!
-DITK_USE_SYSTEM_GDCM=ON
-DITK_USE_SYSTEM_OpenJPEG=ON # Added by VCPKG
-DITK_USE_SYSTEM_DCMTK=ON
-DDCMTK_USE_ICU=ON
-DITK_USE_SYSTEM_ICU=ON
#-DITK_USE_SYSTEM_VXL=ON
-DITK_USE_SYSTEM_VXL=ON
#-DITK_USE_SYSTEM_CASTXML=ON # needs to be added to vcpkg_find_acquire_program https://data.kitware.com/api/v1/file/hashsum/sha512/b8b6f0aff11fe89ab2fcd1949cc75f2c2378a7bc408827a004396deb5ff5a9976bffe8a597f8db1b74c886ea39eb905e610dce8f5bd7586a4d6c196d7349da8d/download
-DITK_USE_SYSTEM_MINC=ON
-DITK_FORBID_DOWNLOADS=OFF # This should be turned on some day, however for now ITK does download specific versions so it shouldn't spontaneously break. Remote Modules would probably break with this!
-DINSTALL_GTEST=OFF
-DITK_USE_SYSTEM_GOOGLETEST=ON
-DEXECUTABLE_OUTPUT_PATH=tools/${PORT}
# TODO
#-DVXL_USE_GEOTIFF=ON
-DVXL_USE_LFS=ON
-DITK_MINIMUM_COMPLIANCE_LEVEL:STRING=1 # To Display all remote modules within cmake-gui
#-DModule_IOSTL=ON # example how to turn on a non-default module
#-DModule_MorphologicalContourInterpolation=ON # example how to turn on a remote module
@ -189,17 +235,16 @@ vcpkg_cmake_configure(
${FEATURE_OPTIONS}
${ADDITIONAL_OPTIONS}
OPTIONS_DEBUG ${OPTIONS_DEBUG}
OPTIONS_RELEASE ${OPTIONS_RELEASE}
OPTIONS_DEBUG
-DRTK_BUILD_APPLICATIONS=OFF
MAYBE_UNUSED_VARIABLES
DCMTK_USE_ICU # Used by DCMTK
EXECUTABLE_OUTPUT_PATH
ITK_USE_SYSTEM_FFTW
ITK_USE_SYSTEM_GOOGLETEST
ITK_USE_SYSTEM_ICU # Used by DCMTK
RTK_BUILD_APPLICATIONS
RTK_USE_CUDA
)
if(BUILD_RTK) # Remote Modules are only downloaded on configure.
# TODO: In the future try to download via vcpkg_from_github and move the files. That way patching does not need this workaround
vcpkg_apply_patches(SOURCE_PATH "${SOURCE_PATH}/Modules/Remote/RTK" QUIET PATCHES rtk/already_defined.patch rtk/unresolved.patch rtk/Add-missing-include-for-Cuda.patch)
endif()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup()
@ -208,21 +253,27 @@ if(TOOL_NAMES)
vcpkg_copy_tools(TOOL_NAMES ${TOOL_NAMES} AUTO_CLEAN)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE "${CURRENT_PACKAGES_DIR}/include/ITK-5.4/vcl_where_root_dir.h")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ITK-5.4/itk_eigen.h" "include(${SOURCE_PATH}/CMake/UseITK.cmake)" "include(UseITK)")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ITK-5.4/itk_eigen.h" "message(STATUS \"From ITK: Eigen3_DIR: ${CURRENT_INSTALLED_DIR}/share/eigen3\")" "")
if("rtk" IN_LIST FEATURES)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ITK-5.4/rtkConfiguration.h" "#define RTK_BINARY_DIR \"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Modules/Remote/RTK\"" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ITK-5.4/rtkConfiguration.h" "#define RTK_DATA_ROOT \"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/ExternalData/Modules/Remote/RTK/test\"" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/itk/Modules/RTK.cmake" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" "\${ITK_INSTALL_PREFIX}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/itk/Modules/RTK.cmake" "${SOURCE_PATH}/Modules/Remote/RTK/utilities/lp_solve" "\${ITK_INSTALL_PREFIX}/include/RTK/lpsolve")
endif()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
vcpkg_list(SET file_list
"${SOURCE_PATH}/NOTICE"
"${SOURCE_PATH}/LICENSE"
)
if("cuda" IN_LIST FEATURES)
vcpkg_list(APPEND file_list
"${SOURCE_PATH}/CudaCommon LICENSE"
)
endif()
if("rtk" IN_LIST FEATURES)
vcpkg_list(APPEND file_list
"${SOURCE_PATH}/RTK COPYRIGHT.TXT"
)
endif()
vcpkg_install_copyright(FILE_LIST ${file_list})

View File

@ -1,26 +0,0 @@
diff --git a/src/rtkCudaLagCorrectionImageFilter.cu b/src/rtkCudaLagCorrectionImageFilter.cu
index 8719ee48..5f8abb23 100644
--- a/src/rtkCudaLagCorrectionImageFilter.cu
+++ b/src/rtkCudaLagCorrectionImageFilter.cu
@@ -114,7 +114,7 @@ CUDA_lag_correction(int proj_idx_in[3], // overlapping input r
cudaMalloc((void **)&d_state, state_size);
if (cudaMemcpy(d_state, h_state, state_size, cudaMemcpyHostToDevice) != cudaSuccess)
{
- std::cout << "Error allocating state" << std::endl;
+ itkGenericExceptionMacro("Error allocating state");
}
if (coefficients[8] <= 0.0)
diff --git a/src/rtkCudaPolynomialGainCorrectionImageFilter.cu b/src/rtkCudaPolynomialGainCorrectionImageFilter.cu
index fb7939dd..d0aacc23 100644
--- a/src/rtkCudaPolynomialGainCorrectionImageFilter.cu
+++ b/src/rtkCudaPolynomialGainCorrectionImageFilter.cu
@@ -111,7 +111,7 @@ CUDA_gain_correction(int proj_idx_in[3], // overlapping input
cudaMalloc((void **)&d_powerlut, lut_size);
if (cudaMemcpy(d_powerlut, h_powerlut, lut_size, cudaMemcpyHostToDevice) != cudaSuccess)
{
- std::cout << "Error allocating state" << std::endl;
+ itkGenericExceptionMacro("Error allocating state");
}
cudaMemcpyToSymbol(cst_coef, coefficients, 2 * sizeof(float));

View File

@ -1,100 +0,0 @@
diff --git a/include/rtkProjectionGeometry.h b/include/rtkProjectionGeometry.h
index e5831611f..73ed2b74f 100644
--- a/include/rtkProjectionGeometry.h
+++ b/include/rtkProjectionGeometry.h
@@ -23,6 +23,7 @@
#include <vector>
+#include "RTKExport.h"
#include "rtkMacro.h"
namespace rtk
@@ -67,25 +68,18 @@ public:
* with the i-th matrix provides the physical coordinate on
* the i-th projection.
*/
- const std::vector<MatrixType> &
- GetMatrices() const
- {
- return this->m_Matrices;
- }
+ itkGetConstReferenceMacro(Matrices,std::vector<MatrixType>)
/** Get the i-th projection matrix. */
MatrixType
- GetMatrix(const unsigned int i) const
- {
- return this->m_Matrices[i];
- }
+ GetMatrix(const unsigned int i) const;
/** Empty the geometry object. */
virtual void
Clear();
protected:
- ProjectionGeometry() = default;
+ ProjectionGeometry();
~ProjectionGeometry() override = default;
void
@@ -93,11 +87,7 @@ protected:
/** Add projection matrix */
virtual void
- AddMatrix(const MatrixType & m)
- {
- this->m_Matrices.push_back(m);
- this->Modified();
- }
+ AddMatrix(const MatrixType & m);
private:
/** Projection matrices */
@@ -105,6 +95,9 @@ private:
};
} // namespace rtk
-#include "rtkProjectionGeometry.hxx"
+#ifndef ITK_MANUAL_INSTANTIATION
+# include "rtkProjectionGeometry.hxx"
+#endif
+
#endif // rtkProjectionGeometry_h
diff --git a/include/rtkProjectionGeometry.hxx b/include/rtkProjectionGeometry.hxx
index 192265812..97dfe8c3a 100644
--- a/include/rtkProjectionGeometry.hxx
+++ b/include/rtkProjectionGeometry.hxx
@@ -23,6 +23,8 @@
namespace rtk
{
+template <unsigned int TDimension>
+ProjectionGeometry<TDimension>::ProjectionGeometry() = default;
template <unsigned int TDimension>
void
@@ -43,6 +45,21 @@ ProjectionGeometry<TDimension>::Clear()
this->Modified();
}
+template <unsigned int TDimension>
+typename ProjectionGeometry<TDimension>::MatrixType
+ProjectionGeometry<TDimension>::GetMatrix(const unsigned int i) const
+{
+ return this->m_Matrices[i];
+}
+
+template <unsigned int TDimension>
+void
+ProjectionGeometry<TDimension>::AddMatrix(const typename ProjectionGeometry<TDimension>::MatrixType & m)
+{
+ this->m_Matrices.push_back(m);
+ this->Modified();
+}
+
} // namespace rtk
#endif // rtkProjectionGeometry_hxx

View File

@ -0,0 +1,12 @@
diff --git a/cmake/FindGengetopt.cmake b/cmake/FindGengetopt.cmake
index b7bbfcc..9011e41 100644
--- a/cmake/FindGengetopt.cmake
+++ b/cmake/FindGengetopt.cmake
@@ -72,6 +72,7 @@ macro (WRAP_GGO GGO_SRCS)
set_source_files_properties(${${GGO_SRCS}} PROPERTIES GENERATED TRUE)
if(CMAKE_COMPILER_IS_GNUCXX)
find_program(DEFAULT_GCC gcc)
+ cmake_policy(SET CMP0153 OLD)
exec_program(${DEFAULT_GCC} ARGS "-dumpversion" OUTPUT_VARIABLE GCCVER)
if("${GCCVER}" VERSION_GREATER "4.5.2")
set_source_files_properties(${${GGO_SRCS}} PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")

View File

@ -0,0 +1,11 @@
diff --git a/utilities/gengetopt/CMakeLists.txt b/utilities/gengetopt/CMakeLists.txt
index e3f04b2..0f1f1b5 100755
--- a/utilities/gengetopt/CMakeLists.txt
+++ b/utilities/gengetopt/CMakeLists.txt
@@ -69,3 +69,6 @@ ADD_EXECUTABLE(gengetopt
INCLUDE_DIRECTORIES(.)
INCLUDE_DIRECTORIES(skels)
#INCLUDE_DIRECTORIES(includes)
+if(WIN32)
+ INCLUDE_DIRECTORIES(BEFORE .) # for local getopt.h
+endif()

View File

@ -1,213 +0,0 @@
diff --git a/include/rtkDCMImagXImageIO.h b/include/rtkDCMImagXImageIO.h
index 2a70ae046..69abb409e 100644
--- a/include/rtkDCMImagXImageIO.h
+++ b/include/rtkDCMImagXImageIO.h
@@ -18,7 +18,7 @@
#ifndef rtkDCMImagXImageIO_h
#define rtkDCMImagXImageIO_h
-
+#include "RTKExport.h"
#include <itkGDCMImageIO.h>
#include "rtkMacro.h"
@@ -32,7 +32,7 @@ namespace rtk
*
* \ingroup RTK
*/
-class DCMImagXImageIO : public itk::GDCMImageIO
+class RTK_EXPORT DCMImagXImageIO : public itk::GDCMImageIO
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(DCMImagXImageIO);
diff --git a/include/rtkEdfImageIO.h b/include/rtkEdfImageIO.h
index 66499c56b..7b16fbc5a 100644
--- a/include/rtkEdfImageIO.h
+++ b/include/rtkEdfImageIO.h
@@ -18,7 +18,7 @@
#ifndef rtkEdfImageIO_h
#define rtkEdfImageIO_h
-
+#include "RTKExport.h"
#include <itkImageIOBase.h>
#include <fstream>
#include <cstring>
@@ -36,7 +36,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class EdfImageIO : public itk::ImageIOBase
+class RTK_EXPORT EdfImageIO : public itk::ImageIOBase
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(EdfImageIO);
diff --git a/include/rtkHisImageIO.h b/include/rtkHisImageIO.h
index 2ef2005dd..95449b8a6 100644
--- a/include/rtkHisImageIO.h
+++ b/include/rtkHisImageIO.h
@@ -19,6 +19,8 @@
#ifndef rtkHisImageIO_h
#define rtkHisImageIO_h
+#include "RTKExport.h"
+
// itk include
#include <itkImageIOBase.h>
#include "rtkMacro.h"
@@ -35,7 +37,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class HisImageIO : public itk::ImageIOBase
+class RTK_EXPORT HisImageIO : public itk::ImageIOBase
{
public:
/** Standard class type alias. */
diff --git a/include/rtkHncImageIO.h b/include/rtkHncImageIO.h
index 7b9539bde..dc9dca759 100644
--- a/include/rtkHncImageIO.h
+++ b/include/rtkHncImageIO.h
@@ -19,9 +19,11 @@
#ifndef rtkHncImageIO_h
#define rtkHncImageIO_h
+#include "RTKExport.h"
+
// itk include
#include <itkImageIOBase.h>
-#include "itksys/SystemTools.hxx"
+//#include "itksys/SystemTools.hxx"
#if defined(_MSC_VER) && (_MSC_VER < 1600)
// SR: taken from
@@ -43,7 +45,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class HncImageIO : public itk::ImageIOBase
+class RTK_EXPORT HncImageIO : public itk::ImageIOBase
{
public:
/** Standard class type alias. */
diff --git a/include/rtkHncImageIOFactory.h b/include/rtkHncImageIOFactory.h
index 2bca8f77e..1d5a97938 100644
--- a/include/rtkHncImageIOFactory.h
+++ b/include/rtkHncImageIOFactory.h
@@ -38,7 +38,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class HncImageIOFactory : public itk::ObjectFactoryBase
+class RTK_EXPORT HncImageIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class type alias. */
diff --git a/include/rtkHndImageIO.h b/include/rtkHndImageIO.h
index 5a07897cc..5f843362a 100644
--- a/include/rtkHndImageIO.h
+++ b/include/rtkHndImageIO.h
@@ -19,6 +19,8 @@
#ifndef rtkHndImageIO_h
#define rtkHndImageIO_h
+#include "RTKExport.h"
+
// itk include
#include <itkImageIOBase.h>
@@ -43,7 +45,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class HndImageIO : public itk::ImageIOBase
+class RTK_EXPORT HndImageIO : public itk::ImageIOBase
{
public:
/** Standard class type alias. */
diff --git a/include/rtkImagXImageIO.h b/include/rtkImagXImageIO.h
index d69e9a790..d6cc8388e 100644
--- a/include/rtkImagXImageIO.h
+++ b/include/rtkImagXImageIO.h
@@ -18,7 +18,7 @@
#ifndef rtkImagXImageIO_h
#define rtkImagXImageIO_h
-
+#include "RTKExport.h"
#include <itkImageIOBase.h>
#include <fstream>
#include <cstring>
@@ -34,7 +34,7 @@ namespace rtk
*
* \ingroup RTK
*/
-class ImagXImageIO : public itk::ImageIOBase
+class RTK_EXPORT ImagXImageIO : public itk::ImageIOBase
{
public:
/** Standard class type alias. */
diff --git a/include/rtkOraImageIO.h b/include/rtkOraImageIO.h
index ece525a42..2d5332872 100644
--- a/include/rtkOraImageIO.h
+++ b/include/rtkOraImageIO.h
@@ -19,6 +19,8 @@
#ifndef rtkOraImageIO_h
#define rtkOraImageIO_h
+#include "RTKExport.h"
+
// This is done to avoid any interference with zlib
#ifdef OF
# undef OF
@@ -41,7 +43,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class OraImageIO : public itk::MetaImageIO
+class RTK_EXPORT OraImageIO : public itk::MetaImageIO
{
public:
/** Standard class type alias. */
diff --git a/include/rtkXRadImageIO.h b/include/rtkXRadImageIO.h
index a72c934e4..0a92afa22 100644
--- a/include/rtkXRadImageIO.h
+++ b/include/rtkXRadImageIO.h
@@ -19,6 +19,7 @@
#ifndef rtkXRadImageIO_h
#define rtkXRadImageIO_h
+#include "RTKExport.h"
#include <itkImageIOBase.h>
#include <fstream>
#include <cstring>
@@ -37,7 +38,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class XRadImageIO : public itk::ImageIOBase
+class RTK_EXPORT XRadImageIO : public itk::ImageIOBase
{
public:
/** Standard class type alias. */
diff --git a/include/rtkXimImageIO.h b/include/rtkXimImageIO.h
index ae789dbf9..741f05183 100644
--- a/include/rtkXimImageIO.h
+++ b/include/rtkXimImageIO.h
@@ -19,6 +19,7 @@
#ifndef rtkXimImageIO_h
#define rtkXimImageIO_h
+#include "RTKExport.h"
#include "rtkMacro.h"
// itk include
@@ -43,7 +44,7 @@ namespace rtk
*
* \ingroup RTK IOFilters
*/
-class XimImageIO : public itk::ImageIOBase
+class RTK_EXPORT XimImageIO : public itk::ImageIOBase
{
public:
/** Standard class type alias. */

View File

@ -1,6 +1,7 @@
{
"name": "itk",
"version": "5.4.0",
"port-version": 1,
"description": "Insight Segmentation and Registration Toolkit (ITK) is used for image processing and analysis.",
"homepage": "https://github.com/InsightSoftwareConsortium/ITK",
"license": "Apache-2.0",
@ -8,10 +9,6 @@
"double-conversion",
"eigen3",
"expat",
{
"name": "fftw3",
"default-features": false
},
"gdcm",
{
"name": "hdf5",
@ -20,7 +17,6 @@
"cpp"
]
},
"icu",
"libjpeg-turbo",
"libpng",
"minc",
@ -40,6 +36,7 @@
"name": "vcpkg-cmake-config",
"host": true
},
"vxl",
"zlib"
],
"features": {
@ -62,6 +59,17 @@
"cuda"
]
},
"fftw": {
"description": "Enable the FFTW backend",
"dependencies": [
{
"name": "fftw3",
"features": [
"threads"
]
}
]
},
"opencl": {
"description": "Use OpenCL",
"dependencies": [
@ -83,11 +91,17 @@
"python": {
"description": "Python functionality for ITK",
"dependencies": [
"python3"
"python3",
{
"name": "vcpkg-tool-castxml",
"host": true
}
]
},
"rtk": {
"description": "Build RTK Module"
"description": "Build RTK Module",
"supports": "!x86",
"license": null
},
"tbb": {
"description": "Build TBB Module",

View File

@ -0,0 +1,79 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
set(key NOTFOUND)
if(VCPKG_CMAKE_SYSTEM_NAME)
set(key "${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(key "Windows-${VCPKG_TARGET_ARCHITECTURE}")
endif()
set(archive_path NOTFOUND)
# For convenient updates, use
# vcpkg install vcpkg-tool-castxml --cmake-args=-DVCPKG_CASTXML_UPDATE=1
if(key STREQUAL "Linux-arm64" OR VCPKG_CASTXML_UPDATE)
set(filename "castxml-${VERSION}-linux-aarch64.tar.gz")
vcpkg_download_distfile(archive_path
URLS "https://github.com/CastXML/CastXMLSuperbuild/releases/download/v${VERSION}/castxml-linux-aarch64.tar.gz"
FILENAME "${filename}"
SHA512 229d5339e217660f09dd87e2e639d666921a8c4e6c328a754dcae4290bba6bcac9d3b8e953814314ecdbf908d5d8e0d7dacbf1fdf6040a2e20d7acb98fb32f7d
)
endif()
if(key STREQUAL "Linux-x64" OR VCPKG_CASTXML_UPDATE)
set(filename "castxml-${VERSION}-linux.tar.gz")
vcpkg_download_distfile(archive_path
URLS "https://github.com/CastXML/CastXMLSuperbuild/releases/download/v${VERSION}/castxml-linux.tar.gz"
FILENAME "${filename}"
SHA512 592fcb6c7f85b6a1670cef7e0692ec6d1c9ba2e250825032ed6dcf9581aa169540eded608510aa1208ea1174df48c16390ee7daf7a17c7114d93a83a8a8e109b
)
endif()
if(key STREQUAL "Darwin-arm64" OR VCPKG_CASTXML_UPDATE)
set(filename "castxml-${VERSION}-macos-arm.tar.gz")
vcpkg_download_distfile(archive_path
URLS "https://github.com/CastXML/CastXMLSuperbuild/releases/download/v${VERSION}/castxml-macos-arm.tar.gz"
FILENAME "${filename}"
SHA512 4c8c969f7e53cd758b516bada449b322d37ad19d6d46602660d83ece20ce07f3d55462493382a1c422048928962fd33f9704638e2e41637d1147473562a55f94
)
# Avoid breaking the code signature.
set(VCPKG_FIXUP_MACHO_RPATH OFF)
endif()
if(key STREQUAL "Darwin-x64" OR VCPKG_CASTXML_UPDATE)
set(filename "castxml-${VERSION}-macosx.tar.gz")
vcpkg_download_distfile(archive_path
URLS "https://github.com/CastXML/CastXMLSuperbuild/releases/download/v${VERSION}/castxml-macosx.tar.gz"
FILENAME "${filename}"
SHA512 c6986a796ab9a4f4deaf569534d628cc584088aa8b0e56026ea5ba19550b8ceeb41c34f46a85566a21205d6bb529717ee8944cfa9a9c7c27edb0504eece5544a
)
# Avoid breaking the code signature.
set(VCPKG_FIXUP_MACHO_RPATH OFF)
endif()
if(key STREQUAL "Windows-x64" OR VCPKG_CASTXML_UPDATE)
set(filename "castxml-${VERSION}-windows.zip")
vcpkg_download_distfile(archive_path
URLS "https://github.com/CastXML/CastXMLSuperbuild/releases/download/v${VERSION}/castxml-windows.zip"
FILENAME "${filename}"
SHA512 7c1970ad6f2e5f06a8704606db92df3400c4cd9716f88cac604924430c7e6865f8256a67282d28005714f0ed0a42f7f6e386f24ce80fb075371902d35674c6cc
)
endif()
if(NOT archive_path)
message(FATAL_ERROR "Unsupported platform '${key}'. Please implement me!")
endif()
if(VCPKG_CASTXML_UPDATE)
message(STATUS "All downloads are up-to-date.")
message(FATAL_ERROR "Stopping due to VCPKG_CASTXML_UPDATE being enabled.")
endif()
message(STATUS "archive_path: '${archive_path}'")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools")
vcpkg_execute_in_download_mode(
COMMAND "${CMAKE_COMMAND}" -E tar xzf "${archive_path}"
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools"
)
vcpkg_install_copyright(
FILE_LIST
"${CURRENT_PACKAGES_DIR}/tools/castxml/share/doc/castxml/NOTICE"
"${CURRENT_PACKAGES_DIR}/tools/castxml/share/doc/castxml/LICENSE"
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/castxml/share/doc")

View File

@ -0,0 +1,8 @@
{
"name": "vcpkg-tool-castxml",
"version": "0.6.5",
"description": "CastXML is a C-family abstract syntax tree XML output tool.",
"homepage": "https://github.com/CastXML/CastXML",
"license": "Apache-2.0",
"supports": "native"
}

View File

@ -1260,6 +1260,13 @@ vcpkg-ci-gdal:x64-windows-static-md=pass
vcpkg-ci-gdal:x64-windows-static=pass
vcpkg-ci-gdal:x64-windows=pass
vcpkg-ci-gdal:x86-windows=pass
vcpkg-ci-itk:arm64-osx=pass
vcpkg-ci-itk:x64-linux=pass
vcpkg-ci-itk:x64-osx=pass
vcpkg-ci-itk:x64-windows=pass
vcpkg-ci-itk:x64-windows-static=pass
vcpkg-ci-itk:x64-windows-static-md=pass
vcpkg-ci-itk:x86-windows=pass
vcpkg-ci-llvm:x64-linux=pass
vcpkg-ci-llvm:x64-osx=pass
vcpkg-ci-llvm:x64-windows-static-md=pass
@ -1330,6 +1337,7 @@ vcpkg-ci-sqlpp11:x64-windows=pass
vcpkg-ci-sqlpp11:x86-windows=pass
vcpkg-ci-vxl:arm-neon-android=pass
vcpkg-ci-vxl:arm64-android=pass
vcpkg-ci-vxl:arm64-osx=pass
vcpkg-ci-vxl:arm64-windows=pass
vcpkg-ci-vxl:x64-android=pass
vcpkg-ci-vxl:x64-linux=pass

View File

@ -0,0 +1,6 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
)
vcpkg_cmake_build()

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.7)
project(itk-test)
find_package(ITK CONFIG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE
$<TARGET_NAME:ITKFFT>
)

View File

@ -0,0 +1,9 @@
#include <itkImage.h>
#include <itkVnlForwardFFTImageFilter.h>
int main()
{
using FilterType = itk::VnlForwardFFTImageFilter<itk::Image<float, 2>>;
auto fftFilter = FilterType::New();
return 0;
}

View File

@ -0,0 +1,58 @@
{
"name": "vcpkg-ci-itk",
"version-string": "ci",
"description": "Validates itk; intentional permutation of features",
"homepage": "https://github.com/microsoft/vcpkg",
"license": "MIT",
"dependencies": [
{
"name": "itk",
"features": [
"opencv"
],
"platform": "arm64"
},
{
"name": "itk",
"features": [
"rtk",
"tools"
],
"platform": "arm64 | x64"
},
{
"name": "itk",
"features": [
"fftw",
"opencl"
],
"platform": "android | osx"
},
{
"name": "itk",
"features": [
"vtk"
],
"platform": "osx | windows"
},
{
"name": "itk",
"features": [
"cuda"
],
"platform": "x64 & windows & !staticcrt"
},
{
"name": "itk",
"features": [
"cufftw",
"opencl"
],
"platform": "x64 & (linux | windows) & static"
},
{
"name": "vcpkg-cmake",
"host": true
}
]
}

View File

@ -3794,7 +3794,7 @@
},
"itk": {
"baseline": "5.4.0",
"port-version": 0
"port-version": 1
},
"itpp": {
"baseline": "4.3.1",
@ -9380,6 +9380,10 @@
"baseline": "5.2.0",
"port-version": 0
},
"vcpkg-tool-castxml": {
"baseline": "0.6.5",
"port-version": 0
},
"vcpkg-tool-gn": {
"baseline": "2024-02-22",
"port-version": 0

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "857809d4b5515688a3f51ef715b2d55a81d1961c",
"version": "5.4.0",
"port-version": 1
},
{
"git-tree": "2028e1d0573208111668ee936bd89fbd0beb2ab1",
"version": "5.4.0",

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "b0d23ce726e07ded62fc14aae52c9ec0ed7cb105",
"version": "0.6.5",
"port-version": 0
}
]
}