itk_4_13: init at 4.13.3

* an old version of itk with extra configuration required for OTB 9.0.0
This commit is contained in:
daspk04 2024-11-17 12:24:41 +07:00
parent 3ea89d7b62
commit b4fadb9704
No known key found for this signature in database
GPG Key ID: 7DD39BFB3F44B346
4 changed files with 317 additions and 0 deletions

View File

@ -0,0 +1,31 @@
diff -burN InsightToolkit-4.10.0.orig/CMake/FindFFTW.cmake InsightToolkit-4.10.0/CMake/FindFFTW.cmake
--- InsightToolkit-4.10.0.orig/CMake/FindFFTW.cmake 2016-06-16 14:21:15.226203872 +0200
+++ InsightToolkit-4.10.0/CMake/FindFFTW.cmake 2016-06-16 14:23:48.966202670 +0200
@@ -35,14 +35,12 @@
set(FFTW_LIB_SEARCHPATH
${FFTW_INSTALL_BASE_PATH}/lib
${FFTW_INSTALL_BASE_PATH}/lib64
- /usr/lib/fftw
- /usr/local/lib/fftw
)
if(ITK_USE_FFTWD)
mark_as_advanced(FFTWD_LIB)
- find_library(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib
- find_library(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib only if compiled with threads support
+ find_library(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Double Precision Lib
+ find_library(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Double Precision Lib only if compiled with threads support
if(FFTWD_LIB)
set(FFTWD_FOUND 1)
@@ -55,8 +53,8 @@
if(ITK_USE_FFTWF)
mark_as_advanced(FFTWF_LIB)
- find_library(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib
- find_library(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib only if compiled with threads support
+ find_library(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Single Precision Lib
+ find_library(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH} NO_DEFAULT_PATH) #Single Precision Lib only if compiled with threads support
if(FFTWF_LIB)
set(FFTWF_FOUND 1)

View File

@ -0,0 +1,35 @@
diff -burN InsightToolkit-4.12.0.orig/Modules/ThirdParty/VNL/src/CMakeLists.txt InsightToolkit-4.12.0/Modules/ThirdParty/VNL/src/CMakeLists.txt
--- InsightToolkit-4.12.0.orig/Modules/ThirdParty/VNL/src/CMakeLists.txt 2017-08-22 11:53:55.960938649 +0200
+++ InsightToolkit-4.12.0/Modules/ThirdParty/VNL/src/CMakeLists.txt 2017-08-22 11:56:07.289820954 +0200
@@ -18,10 +18,14 @@
# Retrive the variable type to CACHE.
set(BUILD_EXAMPLES ${BUILD_EXAMPLES} CACHE BOOL "Build the examples from the ITK Software Guide." FORCE)
-foreach(lib itkvcl itkv3p_netlib itktestlib itkvnl itkvnl_algo itknetlib)
+foreach(lib itkvcl itkv3p_netlib itkvnl itkvnl_algo itknetlib)
itk_module_target(${lib} NO_INSTALL)
endforeach()
+if(BUILD_TESTING)
+ itk_module_target(itktestlib NO_INSTALL)
+endif()
+
foreach(exe
netlib_integral_test
netlib_lbfgs_example
diff -burN InsightToolkit-4.12.0.orig/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt InsightToolkit-4.12.0/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt
--- InsightToolkit-4.12.0.orig/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt 2017-08-22 11:53:55.960938649 +0200
+++ InsightToolkit-4.12.0/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt 2017-08-22 11:56:56.410150930 +0200
@@ -131,8 +131,10 @@
set(CORE_VIDEO_FOUND OFF CACHE INTERNAL "VXL core video libraries built")
endif ()
-# common test executable
-add_subdirectory(testlib)
+# common test executable if testing enabled
+if(BUILD_TESTING)
+ add_subdirectory(testlib)
+endif()
# Tests that check and output the vxl configuration
# NOTE: some external projects remove the tests directory (aka ITK)

View File

@ -0,0 +1,104 @@
--- a/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_compiler.h
+++ b/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_compiler.h
@@ -43,85 +43,7 @@
#endif
#if defined(__GNUC__) && !defined(__ICC) // icc 8.0 defines __GNUC__
-# define VCL_GCC
-# if (__GNUC__ < 4)
-# error "forget it."
-# elif (__GNUC__==4)
-# define VCL_GCC_4
-# if (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_41
-# else
-# define VCL_GCC_40
-# endif
-# elif (__GNUC__==5)
-# define VCL_GCC_5
-# if (__GNUC_MINOR__ > 2 )
-# define VCL_GCC_53
-# elif (__GNUC_MINOR__ > 1 )
-# define VCL_GCC_52
-# elif (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_51
-# else
-# define VCL_GCC_50
-# endif
-# elif (__GNUC__==6)
-# define VCL_GCC_6
-# if (__GNUC_MINOR__ > 2 )
-# define VCL_GCC_63
-# elif (__GNUC_MINOR__ > 1 )
-# define VCL_GCC_62
-# elif (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_61
-# else
-# define VCL_GCC_60
-# endif
-# elif (__GNUC__==7)
-# define VCL_GCC_7
-# if (__GNUC_MINOR__ > 2 )
-# define VCL_GCC_73
-# elif (__GNUC_MINOR__ > 1 )
-# define VCL_GCC_72
-# elif (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_71
-# else
-# define VCL_GCC_70
-# endif
-# elif (__GNUC__==8)
-# define VCL_GCC_8
-# if (__GNUC_MINOR__ > 2 )
-# define VCL_GCC_83
-# elif (__GNUC_MINOR__ > 1 )
-# define VCL_GCC_82
-# elif (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_81
-# else
-# define VCL_GCC_80
-# endif
-# elif (__GNUC__==9)
-# define VCL_GCC_9
-# if (__GNUC_MINOR__ > 2 )
-# define VCL_GCC_93
-# elif (__GNUC_MINOR__ > 1 )
-# define VCL_GCC_92
-# elif (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_91
-# else
-# define VCL_GCC_90
-# endif
-# elif (__GNUC__==10)
-# define VCL_GCC_10
-# if (__GNUC_MINOR__ > 2 )
-# define VCL_GCC_103
-# elif (__GNUC_MINOR__ > 1 )
-# define VCL_GCC_102
-# elif (__GNUC_MINOR__ > 0 )
-# define VCL_GCC_101
-# else
-# define VCL_GCC_100
-# endif
-# else
-# error "Dunno about this gcc"
-# endif
+# define VCL_GCC_73
#endif
#if defined(_WIN32) || defined(WIN32)
--- a/Modules/ThirdParty/VNL/src/vxl/vcl/tests/test_preprocessor.cxx
+++ b/Modules/ThirdParty/VNL/src/vxl/vcl/tests/test_preprocessor.cxx
@@ -64,6 +64,12 @@
++minor_count;
#endif
+#ifdef VCL_GCC_73
+ ++compiler_count;
+ ++major_count;
+ ++minor_count;
+#endif
+
#ifdef VCL_VC
++compiler_count;
#endif

View File

@ -0,0 +1,147 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
expat,
fftw,
fftwFloat,
hdf5-cpp,
libjpeg,
libtiff,
libpng,
libuuid,
xz,
vtk,
zlib,
}:
# this ITK version is old and is only required for OTB package
# https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/blob/develop/SuperBuild/CMake/External_itk.cmake?ref_type=heads#L149
stdenv.mkDerivation (finalAttrs: {
pname = "itk";
version = "4.13.3";
src = fetchFromGitHub {
owner = "InsightSoftwareConsortium";
repo = "ITK";
rev = "v${finalAttrs.version}";
hash = "sha256-lcoJ+H+nVlvleBqbmupu+yg+4iZQ4mTs9pt1mQac+xg=";
};
# https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/tree/develop/SuperBuild/patches/ITK?ref_type=heads
patches = [
./itk-1-fftw-all.diff
./itk-2-itktestlib-all.diff
./itk-3-remove-gcc-version-debian-medteam-all.diff
];
# https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/blob/develop/SuperBuild/CMake/External_itk.cmake?ref_type=heads
cmakeFlags = [
"-DBUILD_TESTING=OFF"
"-DBUILD_EXAMPLES=OFF"
"-DBUILD_SHARED_LIBS=ON"
"-DITK_BUILD_DEFAULT_MODULES=OFF"
"-DITKGroup_Core=OFF"
"-DITK_FORBID_DOWNLOADS=ON"
"-DITK_USE_SYSTEM_LIBRARIES=ON" # finds common libraries e.g. hdf5, libpng, libtiff, libjpeg, zlib etc
"-DModule_ITKCommon=ON"
"-DModule_ITKFiniteDifference=ON"
"-DModule_ITKGPUCommon=ON"
"-DModule_ITKGPUFiniteDifference=ON"
"-DModule_ITKImageAdaptors=ON"
"-DModule_ITKImageFunction=ON"
"-DModule_ITKMesh=ON"
"-DModule_ITKQuadEdgeMesh=ON"
"-DModule_ITKSpatialObjects=ON"
"-DModule_ITKTransform=ON"
"-DModule_ITKTransformFactory=ON"
"-DModule_ITKIOTransformBase=ON"
"-DModule_ITKIOTransformInsightLegacy=ON"
"-DModule_ITKIOTransformMatlab=ON"
"-DModule_ITKAnisotropicSmoothing=ON"
"-DModule_ITKAntiAlias=ON"
"-DModule_ITKBiasCorrection=ON"
"-DModule_ITKBinaryMathematicalMorphology=ON"
"-DModule_ITKColormap=ON"
"-DModule_ITKConvolution=ON"
"-DModule_ITKCurvatureFlow=ON"
"-DModule_ITKDeconvolution=ON"
"-DModule_ITKDenoising=ON"
"-DModule_ITKDisplacementField=ON"
"-DModule_ITKDistanceMap=ON"
"-DModule_ITKFastMarching=ON"
"-DModule_ITKFFT=ON"
"-DModule_ITKGPUAnisotropicSmoothing=ON"
"-DModule_ITKGPUImageFilterBase=ON"
"-DModule_ITKGPUSmoothing=ON"
"-DModule_ITKGPUThresholding=ON"
"-DModule_ITKImageCompare=ON"
"-DModule_ITKImageCompose=ON"
"-DModule_ITKImageFeature=ON"
"-DModule_ITKImageFilterBase=ON"
"-DModule_ITKImageFusion=ON"
"-DModule_ITKImageGradient=ON"
"-DModule_ITKImageGrid=ON"
"-DModule_ITKImageIntensity=ON"
"-DModule_ITKImageLabel=ON"
"-DModule_ITKImageSources=ON"
"-DModule_ITKImageStatistics=ON"
"-DModule_ITKLabelMap=ON"
"-DModule_ITKMathematicalMorphology=ON"
"-DModule_ITKPath=ON"
"-DModule_ITKQuadEdgeMeshFiltering=ON"
"-DModule_ITKSmoothing=ON"
"-DModule_ITKSpatialFunction=ON"
"-DModule_ITKThresholding=ON"
"-DModule_ITKEigen=ON"
"-DModule_ITKNarrowBand=ON"
"-DModule_ITKNeuralNetworks=ON"
"-DModule_ITKOptimizers=ON"
"-DModule_ITKOptimizersv4=ON"
"-DModule_ITKPolynomials=ON"
"-DModule_ITKStatistics=ON"
"-DModule_ITKRegistrationCommon=ON"
"-DModule_ITKGPURegistrationCommon=ON"
"-DModule_ITKGPUPDEDeformableRegistration=ON"
"-DModule_ITKMetricsv4=ON"
"-DModule_ITKPDEDeformableRegistration=ON"
"-DModule_ITKRegistrationMethodsv4=ON"
"-DModule_ITKClassifiers=ON"
"-DModule_ITKConnectedComponents=ON"
"-DModule_ITKDeformableMesh=ON"
"-DModule_ITKKLMRegionGrowing=ON"
"-DModule_ITKLabelVoting=ON"
"-DModule_ITKLevelSets=ON"
"-DModule_ITKLevelSetsv4=ON"
"-DModule_ITKMarkovRandomFieldsClassifiers=ON"
"-DModule_ITKRegionGrowing=ON"
"-DModule_ITKSignedDistanceFunction=ON"
"-DModule_ITKVoronoi=ON"
"-DModule_ITKWatersheds=ON"
];
nativeBuildInputs = [
cmake
xz
];
buildInputs = [ libuuid ];
propagatedBuildInputs = [
# similar to 5.2.x, we progagate these inputs for OTB
expat
fftw
fftwFloat
hdf5-cpp
libjpeg
libpng
libtiff
zlib
];
meta = {
description = "Insight Segmentation and Registration Toolkit";
homepage = "https://www.itk.org";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ daspk04 ];
platforms = with lib.platforms; linux;
};
})