diff --git a/gnu/local.mk b/gnu/local.mk index c97bbfaac64..5b0f2b5e545 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1623,6 +1623,7 @@ dist_patch_DATA = \ %D%/packages/patches/instead-use-games-path.patch \ %D%/packages/patches/intltool-perl-compatibility.patch \ %D%/packages/patches/inetutils-hurd64.patch \ + %D%/packages/patches/insight-toolkit-fix-build.patch \ %D%/packages/patches/irrlicht-use-system-libs.patch \ %D%/packages/patches/irrlicht-link-against-needed-libs.patch \ %D%/packages/patches/isl-0.11.1-aarch64-support.patch \ diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm index c84290205df..cf6da9bbb50 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -24,6 +24,7 @@ ;;; Copyright © 2022 Paul A. Patience ;;; Copyright © 2023 Cairn ;;; Copyright © 2024 Nicolas Graves +;;; Copyright © 2025 Jake Forster ;;; ;;; This file is part of GNU Guix. ;;; @@ -1238,15 +1239,20 @@ libraries designed for computer vision research and implementation.") (define-public insight-toolkit (package (name "insight-toolkit") - (version "5.0.0") + (version "5.4.4") (source (origin - (method url-fetch) - (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" - "releases/download/v" version "/InsightToolkit-" - version ".tar.xz")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/InsightSoftwareConsortium/ITK") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 - (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi")))) + (base32 "1l5rby8jj8726k380aivycmhn56cz56mr9k3r56c8hkkrfwwng50")) + ;; This patch is required to build with both ITK_USE_GPU=ON and + ;; ITK_WRAP_PYTHON=ON. + ;; + (patches (search-patches "insight-toolkit-fix-build.patch")))) (build-system cmake-build-system) (outputs '("out" "python")) (arguments @@ -1255,7 +1261,15 @@ libraries designed for computer vision research and implementation.") #~(list "-DITK_USE_GPU=ON" "-DITK_USE_SYSTEM_LIBRARIES=ON" "-DITK_USE_SYSTEM_CASTXML=ON" + "-DITK_USE_SYSTEM_SWIG=ON" + (string-append "-DHDF5_DIR=" #$(this-package-input "hdf5") + "/lib/cmake") "-DBUILD_SHARED_LIBS=ON" + ;; Without this flag, there are shared libraries installed + ;; in PY_SITE_PACKAGES_PATH/itk instead of #$output/lib and + ;; RUNPATHs contain the *build directory* of + ;; PY_SITE_PACKAGES_PATH/itk. + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" "-DITK_WRAPPING=ON" "-DITK_WRAP_PYTHON=ON" "-DITK_DYNAMIC_LOADING=ON" @@ -1267,7 +1281,10 @@ libraries designed for computer vision research and implementation.") "/lib/python" python-version "/site-packages"))) (string-append "-DPY_SITE_PACKAGES_PATH=" python-lib-path)) - "-DCMAKE_CXX_STANDARD=17") + ;; Python is not built with Py_LIMITED_API. + "-DITK_USE_PYTHON_LIMITED_API=OFF" + "-DCMAKE_CXX_STANDARD=17" + "-DBUILD_TESTING=OFF") #:phases #~(modify-phases %standard-phases (add-after 'unpack 'do-not-tune @@ -1298,6 +1315,7 @@ libraries designed for computer vision research and implementation.") fftw fftwf hdf5 + libaec libjpeg-turbo libpng libtiff @@ -1308,7 +1326,7 @@ libraries designed for computer vision research and implementation.") vxl-1 zlib)) (native-inputs - (list castxml pkg-config swig which)) + (list castxml git-minimal pkg-config swig-next which)) ;; The 'CMake/ITKSetStandardCompilerFlags.cmake' file normally sets ;; '-mtune=native -march=corei7', suggesting there's something to be diff --git a/gnu/packages/patches/insight-toolkit-fix-build.patch b/gnu/packages/patches/insight-toolkit-fix-build.patch new file mode 100644 index 00000000000..a8a9ef3ce00 --- /dev/null +++ b/gnu/packages/patches/insight-toolkit-fix-build.patch @@ -0,0 +1,43 @@ +From 3e90110ece80124d38641b3a1d02a9127f56eb25 Mon Sep 17 00:00:00 2001 +From: David Allemang +Date: Mon, 9 Sep 2024 13:19:43 -0400 +Subject: [PATCH] COMP: Fix Python GPU Wrapping + +--- + .../GPUImageFilterBase/wrapping/itkGPUCastImageFilter.wrap | 4 ++-- + .../wrapping/itkGPUDiscreteGaussianImageFilter.wrap | 3 +++ + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Modules/Filtering/GPUImageFilterBase/wrapping/itkGPUCastImageFilter.wrap b/Modules/Filtering/GPUImageFilterBase/wrapping/itkGPUCastImageFilter.wrap +index 7c1116884d7..c70af7d8446 100644 +--- a/Modules/Filtering/GPUImageFilterBase/wrapping/itkGPUCastImageFilter.wrap ++++ b/Modules/Filtering/GPUImageFilterBase/wrapping/itkGPUCastImageFilter.wrap +@@ -23,7 +23,7 @@ foreach(from ${from_types}) + endforeach() + itk_end_wrap_class() + +-itk_wrap_class("itk::CastImageFilter" POINTER) ++itk_wrap_class("itk::CastImageFilter" POINTER_WITH_SUPERCLASS) + foreach(d ${ITK_WRAP_IMAGE_DIMS}) + # Add from == to pixel type first for preference + foreach(to ${to_types}) +@@ -183,7 +183,7 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) + endforeach() + itk_end_wrap_class() + +-itk_wrap_class("itk::GPUCastImageFilter" POINTER) ++itk_wrap_class("itk::GPUCastImageFilter" POINTER_WITH_SUPERCLASS) + foreach(d ${ITK_WRAP_IMAGE_DIMS}) + # Add from == to pixel type first for preference + foreach(to ${to_types}) +diff --git a/Modules/Filtering/GPUSmoothing/wrapping/itkGPUDiscreteGaussianImageFilter.wrap b/Modules/Filtering/GPUSmoothing/wrapping/itkGPUDiscreteGaussianImageFilter.wrap +index 2477c7876f0..0cfe9c2bd4a 100644 +--- a/Modules/Filtering/GPUSmoothing/wrapping/itkGPUDiscreteGaussianImageFilter.wrap ++++ b/Modules/Filtering/GPUSmoothing/wrapping/itkGPUDiscreteGaussianImageFilter.wrap +@@ -1,3 +1,6 @@ ++set(types "${WRAP_ITK_SCALAR}") ++itk_wrap_include("itkGPUImage.h") ++ + itk_wrap_class("itk::DiscreteGaussianImageFilter" POINTER) + foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${types})