diff options
Diffstat (limited to 'gnu/packages/image-processing.scm')
-rw-r--r-- | gnu/packages/image-processing.scm | 253 |
1 files changed, 228 insertions, 25 deletions
diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm index ab30dfa31d..6f57c3a557 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -19,7 +19,7 @@ ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com> ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net> ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru> -;;; Copyright © 2022, 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2022, 2025 Maxim Cournoyer <maxim@guixotic.coop> ;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl> ;;; Copyright © 2022 Paul A. Patience <paul@apatience.com> ;;; Copyright © 2023 Cairn <cairn@pm.me> @@ -69,6 +69,7 @@ #:use-module (gnu packages curl) #:use-module (gnu packages docbook) #:use-module (gnu packages documentation) + #:use-module (gnu packages engineering) #:use-module (gnu packages flex) #:use-module (gnu packages fontutils) #:use-module (gnu packages game-development) @@ -88,8 +89,10 @@ #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) #:use-module (gnu packages linux) + #:use-module (gnu packages lua) #:use-module (gnu packages maths) #:use-module (gnu packages mpi) + #:use-module (gnu packages nss) #:use-module (gnu packages opencl) #:use-module (gnu packages pdf) #:use-module (gnu packages perl) @@ -108,6 +111,7 @@ #:use-module (gnu packages sphinx) #:use-module (gnu packages sqlite) #:use-module (gnu packages ssh) + #:use-module (gnu packages statistics) #:use-module (gnu packages swig) #:use-module (gnu packages tbb) #:use-module (gnu packages textutils) @@ -812,7 +816,6 @@ the OpenCV-Python library.") libpng (librsvg-for-system) libtiff - libxml2 libwebp matio openexr @@ -940,17 +943,17 @@ recalculates.") (define-public paraview (package (name "paraview") - (version "5.11.1") + (version "6.0.0") (source (origin (method git-fetch) (uri (git-reference - (url "https://gitlab.kitware.com/paraview/paraview.git") + (url "https://gitlab.kitware.com/paraview/paraview") (commit (string-append "v" version)) (recursive? #t))) (file-name (git-file-name name version)) (sha256 - (base32 "0m1lgkl95f0pyhxp97gq2rf8hibv39v4c49imfj1va40z0flvard")) + (base32 "1m1c7vngrpaqdqvnjx4wj0va20hih5rb7rf0a44mp3wqgp4wgy0f")) (modules '((guix build utils))) (snippet ;; TODO: Also remove unused bundled libraries and plugins? @@ -974,7 +977,7 @@ recalculates.") (for-each (lambda (dir) (delete-file-recursively (string-append "VTK/ThirdParty/" dir "/vtk" dir))) - '(;;"cgns" + '("cgns" "cli11" ;;"diy2" "doubleconversion" @@ -982,11 +985,12 @@ recalculates.") ;;"exodusII" "expat" ;;"exprtk" + ;;"fast-float" ;;"fides" "fmt" "freetype" "gl2ps" - "glew" + ;;"glad" ;;"h5part" "hdf5" ;;"ioss" @@ -1009,13 +1013,14 @@ recalculates.") "sqlite" "theora" "tiff" + ;;"token" "utf8" ;;"verdict" + ;;"viskores" ;;"vpic" ;;"vtkm" ;;"xdmf2" ;;"xdmf3" - ;;"zfp" "zlib")))))) (build-system qt-build-system) (arguments @@ -1023,7 +1028,7 @@ recalculates.") #:build-type "Release" ; 542 MiB in release mode #:tests? #f ; Downloads test data #:configure-flags - #~(let ((doc (string-append #$output "/share/doc/" #$name "-" #$version))) + #~(let ((doc (string-append "share/doc/" #$name "-" #$version))) (list (string-append "-DCMAKE_INSTALL_DOCDIR=" doc) ; For paraview.qch @@ -1093,6 +1098,7 @@ recalculates.") ;; External libraries for ParaView and VTK "-DVTK_MODULE_USE_EXTERNAL_ParaView_protobuf=ON" + "-DVTK_MODULE_USE_EXTERNAL_VTK_cgns=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_cli11=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON" @@ -1100,7 +1106,6 @@ recalculates.") "-DVTK_MODULE_USE_EXTERNAL_VTK_fmt=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON" - "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON" "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON" @@ -1146,17 +1151,17 @@ recalculates.") python-sphinx)) (inputs (list boost + cgns cli11 curl double-conversion eigen expat ffmpeg - fmt + fmt-11 freetype gdal gl2ps - glew gmsh hdf5 nlohmann-json ;For ParFlow; build fails @@ -1286,9 +1291,20 @@ libraries designed for computer vision research and implementation.") ;; For a remote MODULE, use the commit in ;; 'Modules/Remote/MODULE.remote.cmake'. ;; MorphologicalContourInterpolation is required by itk-snap. - (let* ((module-commit "821bf9b3ef8eaaab10391ed060dc9ca5e4d37b39") - (module-file (git-file-name "ITKMorphologicalContourInterpolation" - module-commit))) + ;; SimpleITKFilters and GenericLabelInterpolator are required by simpleitk. + ;; GenericLabelInterpolator and AdaptiveDenoising are required by ants. + (let* ((module-mci-commit "821bf9b3ef8eaaab10391ed060dc9ca5e4d37b39") + (module-mci-file (git-file-name "ITKMorphologicalContourInterpolation" + module-mci-commit)) + (module-sitkf-commit "bb896868fc6480835495d0da4356d5db009592a6") + (module-sitkf-file (git-file-name "ITKSimpleITKFilters" + module-sitkf-commit)) + (module-gli-commit "ebf2436469ccf82c08fab54b7446f699ad0eae01") + (module-gli-file (git-file-name "ITKGenericLabelInterpolator" + module-gli-commit)) + (module-ad-commit "853934c352f83cb1e8f87e3051e1b8e75dbb41fe") + (module-ad-file (git-file-name "ITKAdaptiveDenoising" + module-ad-commit))) (package (name "insight-toolkit") (version "5.4.4") @@ -1309,7 +1325,11 @@ libraries designed for computer vision research and implementation.") (outputs '("out" "python")) (arguments (list - #:tests? #f ;tests require network access and external data + #:imported-modules (append %cmake-build-system-modules + %pyproject-build-system-modules) + #:modules '(((guix build pyproject-build-system) #:prefix py:) + (guix build cmake-build-system) + (guix build utils)) #:configure-flags #~(list "-DITK_USE_GPU=ON" "-DITK_USE_SYSTEM_LIBRARIES=ON" @@ -1339,6 +1359,10 @@ libraries designed for computer vision research and implementation.") ;; Python is not built with Py_LIMITED_API. "-DITK_USE_PYTHON_LIMITED_API=OFF" "-DModule_MorphologicalContourInterpolation=ON" + "-DModule_SimpleITKFilters=ON" + "-DModule_GenericLabelInterpolator=ON" + "-DModule_AdaptiveDenoising:BOOL=ON" + "-DModule_ITKReview:BOOL=ON" "-DCMAKE_CXX_STANDARD=17" "-DBUILD_TESTING=OFF") @@ -1372,12 +1396,37 @@ libraries designed for computer vision research and implementation.") (lambda _ ;; ITK module MorphologicalContourInterpolation ;; is for ITK-SNAP. - (symlink #$(this-package-native-input module-file) + (symlink #$(this-package-native-input module-mci-file) "Modules/Remote/MorphologicalContourInterpolation") (delete-file (string-append "Modules/Remote/" - "MorphologicalContourInterpolation.remote.cmake"))))))) + "MorphologicalContourInterpolation.remote.cmake")) + ;; ITK modules SimpleITKFilters and GenericLabelInterpolator + ;; are for SimpleITK. + (symlink #$(this-package-native-input module-sitkf-file) + "Modules/Remote/SimpleITKFilters") + (delete-file "Modules/Remote/SimpleITKFilters.remote.cmake") + (symlink #$(this-package-native-input module-gli-file) + "Modules/Remote/GenericLabelInterpolator") + (delete-file + "Modules/Remote/GenericLabelInterpolator.remote.cmake") + (symlink #$(this-package-native-input module-ad-file) + "Modules/Remote/AdaptiveDenoising") + (delete-file + "Modules/Remote/AdaptiveDenoising.remote.cmake"))) + (add-after 'unpack 'fix-numpy-bool + (lambda _ + ;; <https://github.com/InsightSoftwareConsortium/ITK/pull/5402> + (substitute* (string-append "Wrapping/Generators/" + "Python/itk/support/types.py") + (("np\\.bool") "np.bool_")))) + (delete 'check) ;tests require network access and external data + (add-after 'install 'python-sanity-check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (py:add-installed-pythonpath inputs outputs) + (invoke "python3" "-c" "import itk"))))))) (inputs (list eigen expat fftw @@ -1386,7 +1435,8 @@ libraries designed for computer vision research and implementation.") libjpeg-turbo libpng libtiff - mesa-opencl + opencl-headers + opencl-icd-loader perl python tbb @@ -1397,6 +1447,7 @@ libraries designed for computer vision research and implementation.") gcc-13 git-minimal pkg-config + python-numpy ;for phase 'python-sanity-check swig-next which (origin @@ -1406,11 +1457,42 @@ libraries designed for computer vision research and implementation.") (url (string-append "https://github.com/KitwareMedical/" "ITKMorphologicalContourInterpolation")) - (commit module-commit))) - (file-name module-file) + (commit module-mci-commit))) + (file-name module-mci-file) (sha256 (base32 - "00myhgvlk3n062i8bnknz1d10zkv3jlvs7f4jnk24727gd4v2n4i"))))) + "00myhgvlk3n062i8bnknz1d10zkv3jlvs7f4jnk24727gd4v2n4i"))) + (origin + (method git-fetch) + (uri (git-reference + (url (string-append + "https://github.com/InsightSoftwareConsortium/" + "ITKSimpleITKFilters")) + (commit module-sitkf-commit))) + (file-name module-sitkf-file) + (sha256 + (base32 + "13nys94wl4k77f89i8y1dm3y4pmgmw3rrc0la1rzl0vi9h1qixii"))) + (origin + (method git-fetch) + (uri (git-reference + (url (string-append + "https://github.com/InsightSoftwareConsortium/" + "ITKGenericLabelInterpolator")) + (commit module-gli-commit))) + (file-name module-gli-file) + (sha256 + (base32 + "1khakqh6pzdg6csli8jypzrhcdr9xmhnzgwz265krv8r5mbnndrg"))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ntustison/ITKAdaptiveDenoising") + (commit module-ad-commit))) + (file-name module-ad-file) + (sha256 + (base32 + "0aqvhb4byg0shgbrwmb41nq2h8sbg45xn0gsdy94iiq0v72bw307"))))) ;; The 'CMake/ITKSetStandardCompilerFlags.cmake' file normally sets ;; '-mtune=native -march=corei7', suggesting there's something to be @@ -1454,11 +1536,15 @@ combine the information contained in both.") (string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag) (string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag) (string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag)))) - #$cf)))) + #$cf)) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (delete 'python-sanity-check))))) (inputs (modify-inputs (package-inputs insight-toolkit) (delete "python"))) (native-inputs (modify-inputs (package-native-inputs insight-toolkit) (delete "castxml") + (delete "python-numpy") (delete "swig")))))) (define-public itk-snap @@ -1687,6 +1773,123 @@ Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured and Scan Tailor Enhanced versions as well as including many more bug fixes.") (license license:gpl3+)))) +(define-public simpleitk + (package + (name "simpleitk") + (version "2.5.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/SimpleITK/SimpleITK") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1ykrfrfh2012cg1122689w23pan2y731sszfpb701zhsb6fwv7j7")))) + (build-system cmake-build-system) + (outputs '("out" "python" "r")) + (arguments + (list + #:configure-flags + #~(list "-DBUILD_SHARED_LIBS=ON" + "-DWRAP_LUA=OFF" + "-DWRAP_PYTHON=ON" + "-DWRAP_R=ON" + "-DSimpleITK_PYTHON_USE_VIRTUALENV=OFF") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'early-GTest-discovery + (lambda _ + ;; Find GTest before targets link to 'GTest::GTest'. + (substitute* "Testing/Unit/CMakeLists.txt" + (("add_subdirectory\\(TestBase\\)" anchor) + (string-append "find_package(GTest REQUIRED)\n" anchor))))) + (add-after 'unpack 'extract-test-data + (lambda _ + (invoke "tar" "xvf" + #$(this-package-native-input + (string-append "SimpleITKData-" version ".tar.gz")) + "--strip-components=1"))) + (add-after 'unpack 'fix-runpath + (lambda _ + ;; The SWIG-generated shared libraries do not have SimpleITK's + ;; libraries in their RUNPATH. + (define (cmake-snippet start) + (string-append + start + "set_target_properties(${SWIG_MODULE_SimpleITK_TARGET_NAME} " + "PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE " + "INSTALL_RPATH \"" #$output "/lib\")\n")) + (substitute* "Wrapping/Python/CMakeLists.txt" + (("^set\\(SWIG_MODULE_SimpleITKPython.*" anchor) + (cmake-snippet anchor))) + (substitute* "Wrapping/R/CMakeLists.txt" + (("^set\\(SWIG_MODULE_SimpleITKR.*" anchor) + (cmake-snippet anchor))))) + (add-after 'unpack 'patch-cmake-config-itk-path + (lambda _ + ;; Allow building SimpleITK C++ projects without ITK installed + ;; in the profile. + #$(let* + ((itk (this-package-input "insight-toolkit")) + (itk-version (package-version itk)) + (itk-version-major+minor + (version-major+minor itk-version))) + #~(substitute* "SimpleITKConfig.cmake.in" + (((string-append + "find_package\\(ITK \"@ITK_VERSION@\" " + "EXACT REQUIRED\\)")) + (string-append + "find_package(ITK \"" #$itk-version + "\" EXACT REQUIRED PATHS " #$itk + "/lib/cmake/ITK-" + #$itk-version-major+minor ")")))))) + (add-after 'install 'install-language-extension-modules + (lambda _ + (with-directory-excursion "Wrapping/Python" + (invoke "python3" "setup.py" "bdist_wheel") + (apply invoke "pip" "--no-cache-dir" "--no-input" "install" + "--no-deps" "--prefix" #$output:python + (find-files "dist" "\\.whl$"))) + (let ((r-package-path + (string-append #$output:r "/site-library/SimpleITK"))) + (mkdir-p r-package-path) + (copy-recursively "Wrapping/R/R_libs/SimpleITK" + r-package-path)))) + (delete 'check) + (add-after 'install 'check-after-install + ;; Run the tests when the SimpleITK libraries are where the + ;; language extension modules expect them to be. + (assoc-ref %standard-phases 'check))))) + (home-page "https://simpleitk.org") + (inputs (list insight-toolkit python r-minimal)) + (native-inputs + (list googletest + lua + nss-certs-for-test ;for 'pip install' + python-numpy ;for tests + python-pip + python-setuptools + python-wheel + swig-next + (origin + (method url-fetch) + (uri (string-append + "https://github.com/SimpleITK/SimpleITK/releases/download/v" + version "/SimpleITKData-" version ".tar.gz")) + (sha256 + (base32 + "13y44qqsgsvbrm84073i8clhggdgk8f36i6102sjg4j3fq790gal"))))) + (synopsis "Simplified interface to @acronym{ITK, Insight Toolkit}") + (description + "SimpleITK is an image analysis toolkit built on top of @acronym{ITK, +Insight Toolkit}. It provides a simplified interface to most of the +image filters and the input/output and registration frameworks in +@acronym{ITK, Insight Toolkit}. It is written in C++ and provides +bindings for interpreted languages. This package includes the C++, +Python and R interfaces.") + (license license:asl2.0))) + (define-public stiff (package (name "stiff") @@ -1879,7 +2082,7 @@ rectangles, circles, lines, points and VOC/COCO export.") (define-public charls (package (name "charls") - (version "2.3.4") + (version "2.4.2") (source (origin (method git-fetch) (uri (git-reference @@ -1888,7 +2091,7 @@ rectangles, circles, lines, points and VOC/COCO export.") (file-name (git-file-name name version)) (sha256 (base32 - "0g3f1rfimk30rqmi7ic4i5vfphyqbbpsyyhwqq1iss9wjwaz2vs5")))) + "0vp6mjjm6hi2r1swwvbg86asvn604w58nam7yvqk1qr13aizjl71")))) (build-system cmake-build-system) (arguments `(#:configure-flags '("-DCMAKE_BUILD_TYPE:STRING=Release" |