From 969d58090b4a3438ad4b6b7a0091cd696b3e2998 Mon Sep 17 00:00:00 2001 From: Jake Forster Date: Fri, 25 Jul 2025 23:35:31 +0930 Subject: [PATCH] gnu: Add insight-toolkit-legacy. This is a hidden variant of insight-toolkit needed for itk-snap. * gnu/packages/image-processing.scm (insight-toolkit-legacy): New variable. Change-Id: Ief18c1b4241241881b5b632121fc463db5b3c286 Signed-off-by: Andreas Enge --- gnu/packages/image-processing.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm index 6c8dc1b8c50826921f2e5dcc012b6ffa251dbd37..bbd152ed55727beb62834a5ceaae8497a96dd205 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -1406,6 +1406,37 @@ the medical environment, a CT scan may be aligned with a MRI scan in order to combine the information contained in both.") (license license:asl2.0)))) +;; Provide variant of insight-toolkit (ITK) built with ITK_LEGACY_REMOVE=OFF. +;; ITK-SNAP version 4.2.2 and 4.4.0-alpha3 require ITK >= 5.4 and for ITK to +;; be built this way. Note that enabling Python wrapping forces this option +;; to ON, so Python wrapping is not enabled for this build. +(define insight-toolkit-legacy + (hidden-package + (package/inherit insight-toolkit + ;; Unfortunately we cannot remove the 'python output because it is + ;; referenced in #:configure-flags below. + (name "insight-toolkit-legacy") + (arguments + (substitute-keyword-arguments (package-arguments insight-toolkit) + ((#:configure-flags cf '()) + #~(filter (lambda (flag) + (not (or + ;; Remove these flags to restore the default + ;; ITK_LEGACY_REMOVE=OFF. + (string=? "-DITK_WRAPPING=ON" flag) + (string=? "-DITK_WRAP_PYTHON=ON" flag) + ;; These flags are now unused. + (string-prefix? "-DPY_SITE_PACKAGES_PATH=" flag) + (string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag) + (string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag) + (string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag)))) + #$cf)))) + (inputs (modify-inputs (package-inputs insight-toolkit) + (delete "python"))) + (native-inputs (modify-inputs (package-native-inputs insight-toolkit) + (delete "castxml") + (delete "swig")))))) + (define-public insight-toolkit-4 (package (inherit insight-toolkit) (version "4.13.2")