projects/guix·blob mpd-fix-groups · refs

2160 lines · 86.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 John Darrington <[email protected]>
3;;; Copyright © 2017, 2019, 2022, 2024 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2014, 2021-2023 Ludovic Courtès <[email protected]>
5;;; Copyright © 2014 Mark H Weaver <[email protected]>
6;;; Copyright © 2016 Eric Bavier <[email protected]>
7;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <[email protected]>
8;;; Copyright © 2018 Björn Höfling <[email protected]>
9;;; Copyright © 2018 Lprndn <[email protected]>
10;;; Copyright © 2019, 2021, 2023 Efraim Flashner <[email protected]>
11;;; Copyright © 2020 Vincent Legoll <[email protected]>
12;;; Copyright © 2020, 2021, 2024, 2025 Vinicius Monego <[email protected]>
13;;; Copyright © 2020 Pierre Neidhardt <[email protected]>
14;;; Copyright © 2020 Brendan Tildesley <[email protected]>
15;;; Copyright © 2021 Oleh Malyi <[email protected]>
16;;; Copyright © 2021, 2022, 2024 Felix Gruber <[email protected]>
17;;; Copyright © 2021 Andy Tai <[email protected]>
18;;; Copyright © 2021 Ekaitz Zarraga <[email protected]>
19;;; Copyright © 2021 Paul Garlick <[email protected]>
20;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
21;;; Copyright © 2021 Ivan Gankevich <[email protected]>
22;;; Copyright © 2022, 2025 Maxim Cournoyer <[email protected]>
23;;; Copyright © 2022 Tomasz Jeneralczyk <[email protected]>
24;;; Copyright © 2022 Paul A. Patience <[email protected]>
25;;; Copyright © 2023 Cairn <[email protected]>
26;;; Copyright © 2024 Nicolas Graves <[email protected]>
27;;; Copyright © 2025 Jake Forster <[email protected]>
28;;; Copyright © 2025 Anderson Torres <[email protected]>
29;;; Copyright © 2025 Andreas Enge <[email protected]>
30;;;
31;;; This file is part of GNU Guix.
32;;;
33;;; GNU Guix is free software; you can redistribute it and/or modify it
34;;; under the terms of the GNU General Public License as published by
35;;; the Free Software Foundation; either version 3 of the License, or (at
36;;; your option) any later version.
37;;;
38;;; GNU Guix is distributed in the hope that it will be useful, but
39;;; WITHOUT ANY WARRANTY; without even the implied warranty of
40;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41;;; GNU General Public License for more details.
42;;;
43;;; You should have received a copy of the GNU General Public License
44;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
45
46(define-module (gnu packages image-processing)
47 #:use-module ((guix licenses) #:prefix license:)
48 #:use-module (guix packages)
49 #:use-module (guix gexp)
50 #:use-module (guix utils)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module (guix build-system copy)
54 #:use-module (guix build-system qt)
55 #:use-module (guix build-system cmake)
56 #:use-module (guix build-system gnu)
57 #:use-module (guix build-system meson)
58 #:use-module (guix build-system python)
59 #:use-module (guix build-system pyproject)
60 #:use-module (gnu packages)
61 #:use-module (gnu packages algebra)
62 #:use-module (gnu packages base)
63 #:use-module (gnu packages bash)
64 #:use-module (gnu packages bison)
65 #:use-module (gnu packages boost)
66 #:use-module (gnu packages check)
67 #:use-module (gnu packages compression)
68 #:use-module (gnu packages cpp)
69 #:use-module (gnu packages curl)
70 #:use-module (gnu packages docbook)
71 #:use-module (gnu packages documentation)
72 #:use-module (gnu packages engineering)
73 #:use-module (gnu packages flex)
74 #:use-module (gnu packages fontutils)
75 #:use-module (gnu packages game-development)
76 #:use-module (gnu packages gcc)
77 #:use-module (gnu packages gd)
78 #:use-module (gnu packages geo)
79 #:use-module (gnu packages ghostscript)
80 #:use-module (gnu packages gimp)
81 #:use-module (gnu packages gl)
82 #:use-module (gnu packages glib)
83 #:use-module (gnu packages gnome)
84 #:use-module (gnu packages graphics)
85 #:use-module (gnu packages graphviz)
86 #:use-module (gnu packages gstreamer)
87 #:use-module (gnu packages gtk)
88 #:use-module (gnu packages icu4c)
89 #:use-module (gnu packages image)
90 #:use-module (gnu packages imagemagick)
91 #:use-module (gnu packages linux)
92 #:use-module (gnu packages lua)
93 #:use-module (gnu packages maths)
94 #:use-module (gnu packages mpi)
95 #:use-module (gnu packages nss)
96 #:use-module (gnu packages opencl)
97 #:use-module (gnu packages pdf)
98 #:use-module (gnu packages perl)
99 #:use-module (gnu packages photo)
100 #:use-module (gnu packages pkg-config)
101 #:use-module (gnu packages pretty-print)
102 #:use-module (gnu packages protobuf)
103 #:use-module (gnu packages python)
104 #:use-module (gnu packages python-build)
105 #:use-module (gnu packages python-check)
106 #:use-module (gnu packages python-science)
107 #:use-module (gnu packages python-xyz)
108 #:use-module (gnu packages qt)
109 #:use-module (gnu packages sdl)
110 #:use-module (gnu packages serialization)
111 #:use-module (gnu packages sphinx)
112 #:use-module (gnu packages sqlite)
113 #:use-module (gnu packages ssh)
114 #:use-module (gnu packages statistics)
115 #:use-module (gnu packages swig)
116 #:use-module (gnu packages tbb)
117 #:use-module (gnu packages textutils)
118 #:use-module (gnu packages tls)
119 #:use-module (gnu packages version-control)
120 #:use-module (gnu packages video)
121 #:use-module (gnu packages xiph)
122 #:use-module (gnu packages xml)
123 #:use-module (gnu packages xorg)
124 #:use-module (ice-9 match)
125 #:use-module (srfi srfi-1))
126
127(define-public bart
128 (package
129 (name "bart")
130 (version "0.9.00")
131 (source
132 (origin
133 (method git-fetch)
134 (uri (git-reference
135 (url "https://github.com/mrirecon/bart")
136 (commit (string-append "v" version))))
137 (file-name (git-file-name name version))
138 (sha256
139 (base32 "0mj6jmw31rsnvqmpfqahhj4cy9iv5xgrhzmcsrikdz5dgd45lmjz"))))
140 (build-system gnu-build-system)
141 (arguments
142 (list
143 #:test-target "utest"
144 #:make-flags #~(list
145 (string-append "PREFIX=" #$output)
146 "PARALLEL=1"
147 "PARALLEL_NJOBS=1"
148 "OPENBLAS=1"
149 "SCALAPACK=1"
150 (string-append "BLAS_BASE=" #$(this-package-input "openblas"))
151 (string-append "CC=" #$(cc-for-target))
152 (string-append "FFTW_BASE=" #$(this-package-input "fftw")))
153 #:parallel-build? #false ;leads to non-deterministic output
154 #:phases
155 #~(modify-phases %standard-phases
156 (delete 'configure)
157 (add-after 'unpack 'patch-/bin/bash
158 (lambda _
159 (substitute* "tests/pics.mk"
160 (("/bin/bash") (which "bash"))))))))
161 (inputs
162 (list fftw
163 fftwf
164 libpng
165 openblas
166 python
167 scalapack))
168 (native-inputs
169 (list doxygen
170 util-linux)) ;for flock
171 (home-page "https://mrirecon.github.io/bart/")
172 (synopsis "Toolbox for computational magnetic resonance imaging")
173 (description "The Berkeley Advanced Reconstruction Toolbox (BART) is an
174image-reconstruction framework for Computational Magnetic Resonance Imaging.
175The tools in this software implement various reconstruction algorithms for
176Magnetic Resonance Imaging.")
177 (license license:bsd-3)))
178
179(define-public cimg
180 (package
181 (name "cimg")
182 (version "3.5.5")
183 (source
184 (origin
185 (method git-fetch)
186 (uri (git-reference
187 (url "https://github.com/GreycLab/CImg")
188 (commit (string-append "v." version))))
189 (file-name (git-file-name name version))
190 (sha256
191 (base32 "01myf3bjbc46f977r7lvr9g1hcnpfygcv2xnqvhrl2nj7955sm5x"))))
192 (build-system copy-build-system)
193 (arguments
194 (list
195 #:phases
196 #~(modify-phases %standard-phases
197 (add-before 'install 'check
198 (lambda* (#:key tests? #:allow-other-keys)
199 (when tests?
200 (with-directory-excursion "examples"
201 ;; This is from upstream CI but parallelized.
202 (invoke "make" "-j"
203 (number->string (parallel-job-count)) "mlinux")
204 (invoke "./image2ascii")
205 (invoke "./generate_loop_macros")
206 ;; Build an example that requires an external library.
207 ;; Running it requires a display.
208 (invoke "make" "use_jpeg_buffer"
209 (string-append "CONF_CFLAGS="
210 (string-join '("-Dcimg_display=0"
211 "-O3"
212 "-mtune=generic"
213 "-Dcimg_use_jpeg")
214 " "))
215 "CONF_LIBS=-ljpeg"))))))
216 #:install-plan
217 #~'(("CImg.h" "include/")
218 ("plugins" "include/CImg/plugins"))))
219 (native-inputs (list libjpeg-turbo)) ;for 'check
220 (home-page "https://cimg.eu")
221 (synopsis "Small C++ image processing library")
222 (description
223 "The @acronym{CImg, Cool Image} Library is a small C++ toolkit for
224image processing. It is made of a single header file @code{CImg.h}
225that can be compiled using a minimal set of standard C++ and system
226libraries. It includes a plugin mechanism to extend its functionality
227with external tools and libraries.")
228 ;; Dual-licensed, either license applies.
229 (license (list license:cecill-c license:cecill))))
230
231(define-public dcmtk
232 (package
233 (name "dcmtk")
234 (version "3.6.8")
235 (source
236 (origin
237 (method url-fetch)
238 (uri
239 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
240 "dcmtk" (string-join (string-split version #\.) "")
241 "/dcmtk-" version ".tar.gz"))
242 (sha256
243 (base32 "03vjv2lq5kr79ghf8v0q9wskkrcr2ygi097nybmqs4q3amjpc813"))))
244 (build-system cmake-build-system)
245 (arguments
246 ;; By default, only static archives are built.
247 (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")))
248 (inputs
249 (list icu4c
250 libjpeg-turbo
251 libpng
252 libtiff
253 libxml2
254 openssl
255 zlib))
256 (native-inputs
257 (list doxygen)) ; for HTML documentation
258 (home-page "https://dcmtk.org")
259 (synopsis "Libraries and programs implementing parts of the DICOM standard")
260 (description "DCMTK is a collection of libraries and applications
261implementing large parts the DICOM standard. It includes software for
262examining, constructing and converting DICOM image files, handling offline
263media, sending and receiving images over a network connection, as well as
264demonstrative image storage and worklist servers.")
265 (license (license:fsf-free
266 "file://COPYRIGHT"
267 "A union of the Apache 2.0 licence and various non-copyleft
268licences similar to the Modified BSD licence."))))
269
270(define-public opencolorio
271 (package
272 (name "opencolorio")
273 (version "2.4.2")
274 (source
275 (origin
276 (method git-fetch)
277 (uri (git-reference
278 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
279 (commit (string-append "v" version))))
280 (sha256
281 (base32 "1h5n1adm7hlblq4z9qdbnh5jy3f6aimlk96cn1k4ah3f8vqx7zpq"))
282 (file-name (git-file-name name version))))
283 (build-system cmake-build-system)
284 (arguments
285 ;; XXX: GPU tests are failing.
286 (list #:configure-flags #~(list "-DOCIO_BUILD_GPU_TESTS=false")
287 #:phases
288 #~(modify-phases %standard-phases
289 (add-after 'unpack 'disable-test
290 ;; The approach is somewhat desperate and removes not only
291 ;; line 1436 of the failing
292 ;; FileFormatCTF/difficult_xml_unknown_elements test,
293 ;; but also the identical line 1524 of the succeeding
294 ;; FileFormatCTF/unknown_elements test.
295 (lambda _
296 (substitute* "tests/cpu/fileformats/FileFormatCTF_tests.cpp"
297 (("OCIO_CHECK_NE.*ErrorOutputs.*")
298 ""))))
299 (add-after 'unpack 'fix-broken-test
300 (lambda _
301 ;; Replace the invalid multi-line list. It is unclear why
302 ;; this is now failing after only build system updates.
303 ;; (see https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/v2.4.2/tests/cpu/Config_tests.cpp#L6227)
304 (substitute* "tests/cpu/Config_tests.cpp"
305 (("cs1\\\\t\\\\n \\\\n, \\\\ncs2")
306 "cs1, cs2")))))))
307 (native-inputs
308 ;; XXX: OCIO has unit tests for OpenShadingLanguage, but they fail.
309 ;; They also require OIIO, but OCIO is an optional dependency to it.
310 (list pybind11-2.10 python-wrapper))
311 (inputs
312 (list expat
313 freeglut
314 glew
315 imath
316 lcms
317 libglvnd
318 ;; [email protected] fails to build with [email protected]
319 minizip-ng-4.0.9
320 openexr
321 pystring
322 yaml-cpp
323 zlib))
324 (home-page "https://opencolorio.org")
325 (synopsis "Color management for visual effects and animation")
326 (description
327 "OpenColorIO, or OCIO, is a complete color management solution geared
328towards motion picture production, with an emphasis on visual effects and
329computer animation. It provides a straightforward and consistent user
330experience across all supporting applications while allowing for sophisticated
331back-end configuration options suitable for high-end production usage.
332
333OCIO is compatible with the @acronym{ACES, Academy Color Encoding
334Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
335many popular formats.")
336 (license license:bsd-3)))
337
338(define-public vtk
339 (package
340 (name "vtk")
341 (version "9.3.1")
342 (source (origin
343 (method url-fetch)
344 (uri (string-append "https://vtk.org/files/release/"
345 (version-major+minor version)
346 "/VTK-" version ".tar.gz"))
347 (sha256
348 (base32
349 "1f6ac40db7wkb3bfh31d71qc5gy44cw29r6v4cyxrlm09q4fqm43"))
350 (modules '((guix build utils)))
351 (snippet
352 '(begin
353 (for-each
354 (lambda (dir)
355 (delete-file-recursively
356 (string-append "ThirdParty/" dir "/vtk" dir)))
357 ;; pugixml depended upon unconditionally
358 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
359 "glew" "hdf5" "jpeg" "jsoncpp" "libharu" "libproj"
360 "libxml2" "lz4" "netcdf" "ogg" "png" "sqlite" "theora"
361 "tiff" "zlib"))
362 (substitute* "IO/ExportPDF/vtkPDFContextDevice2D.cxx"
363 (("\\bHPDF_UINT16 (noPen|dash|dot|denseDot|dashDot|dashDotDot)\\b"
364 _ var)
365 (string-append "HPDF_REAL " var)))))))
366 (properties `((release-monitoring-url . "https://vtk.org/download/")))
367 (build-system cmake-build-system)
368 (arguments
369 (list #:build-type "Release" ;Build without '-g' to save space.
370 #:configure-flags
371 #~'("-DVTK_USE_EXTERNAL=OFF" ;default
372 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
373 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
374 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
375 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
376 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
377 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
378 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
379 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
380 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
381 "-DVTK_MODULE_USE_EXTERNAL_VTK_libharu=ON"
382 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
383 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
384 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
385 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
386 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
387 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
388 ;;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON" ;breaks IO/CityGML
389 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
390 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
391 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
392 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
393 "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" ;for F3D
394 "-DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES" ;for itk-snap
395 "-DVTK_WRAP_PYTHON=ON"
396 "-DVTK_PYTHON_VERSION:STRING=3"
397
398 "-DVTK_SMP_ENABLE_OPENNMP=ON"
399 "-DVTK_SMP_ENABLE_TBB=ON"
400 "-DVTK_USE_MPI=ON"
401 #$@(if (target-riscv64?)
402 '("-DCMAKE_SHARED_LINKER_FLAGS=-latomic"
403 "-DCMAKE_EXE_LINKER_FLAGS=-latomic")
404 '()))
405
406 #:phases
407 #~(modify-phases %standard-phases
408 (add-after 'unpack 'clear-reference-to-compiler
409 (lambda _
410 (define (choose . files)
411 (let loop ((files files))
412 (if (null? files)
413 #f
414 (if (file-exists? (car files))
415 (car files)
416 (loop (cdr files))))))
417
418 ;; Do not retain a reference to GCC.
419 (substitute* (choose
420 "Common/Core/vtkBuild.h.in" ;dummy >=v9.3
421 "Common/Core/vtkConfigureDeprecated.h.in" ;v9.x
422 "Common/Core/vtkConfigure.h.in") ;v7.x
423 (("@CMAKE_CXX_COMPILER@") "c++")))))
424
425 #:tests? #f)) ;XXX: test data not included
426 (inputs
427 (list double-conversion
428 eigen
429 expat
430 freetype
431 gl2ps
432 glew
433 glu
434 hdf5
435 libharu
436 libjpeg-turbo
437 jsoncpp
438 libtheora
439 libx11
440 libxml2
441 libxt
442 lz4
443 mesa
444 netcdf
445 libpng
446 libtiff
447 openmpi
448 proj
449 python
450 ;("pugixml" ,pugixml)
451 sqlite
452 xorgproto
453 qtbase
454 zlib))
455 (propagated-inputs
456 ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
457 ;; 'find_package(THEORA)', which in turns looks for libogg. Likewise for
458 ;; TBB.
459 (list libogg
460 tbb))
461 (home-page "https://vtk.org/")
462 (synopsis "Libraries for 3D computer graphics")
463 (description
464 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
465image processing and visualization. It supports a wide variety of
466visualization algorithms including: scalar, vector, tensor, texture, and
467volumetric methods; and advanced modeling techniques such as: implicit
468modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
469triangulation. VTK has an extensive information visualization framework, has
470a suite of 3D interaction widgets, supports parallel processing, and
471integrates with various databases on GUI toolkits such as Qt and Tk.")
472 (license license:bsd-3)))
473
474(define-public vktdiff
475 (package
476 (name "vtkdiff")
477 (version "1.0.0")
478 (source
479 (origin
480 (method git-fetch)
481 (uri (git-reference
482 (url "https://github.com/ufz/vtkdiff")
483 (commit version)))
484 (file-name (git-file-name name version))
485 (sha256
486 (base32 "15nwzfhgyjfvd083kw1s19xkxcds9h31hx9cr339x3bkllbj609j"))))
487 (build-system cmake-build-system)
488 (inputs (list tclap vtk))
489 (arguments
490 (list
491 #:tests? #f ;There are no tests.
492 #:configure-flags #~(list "-DGUIX_BUILD=ON")))
493 (home-page "https://github.com/ufz/vtkdiff")
494 (synopsis "Numerical difference of data arrays in vtk files")
495 (description
496 "The vtkdiff tool shall provide means of numerical comparison of
497different data arrays similar to those available in the numdiff software.")
498 (license license:bsd-3)))
499
500(define-public opencv
501 (package
502 (name "opencv")
503 (version "4.12.0")
504 (source (origin
505 (method git-fetch)
506 (uri (git-reference
507 (url "https://github.com/opencv/opencv")
508 (commit version)))
509 (file-name (git-file-name name version))
510 (modules '((guix build utils)))
511 (snippet
512 '(begin
513 ;; Remove external libraries. Almost all of them are
514 ;; available in Guix.
515 (with-directory-excursion "3rdparty"
516 (for-each delete-file-recursively
517 '("cpufeatures"
518 "flatbuffers"
519 "ffmpeg"
520 "include"
521 "ippicv"
522 "ittnotify"
523 "libjasper"
524 "libjpeg"
525 "libjpeg-turbo"
526 "libpng"
527 "libtiff"
528 "libwebp"
529 "openexr"
530 "openjpeg"
531 "protobuf"
532 ;;"quirc"
533 "tbb"
534 "zlib")))
535
536 ;; Delete any bundled .jar files.
537 (for-each delete-file (find-files "." "\\.jar$"))))
538 (sha256
539 (base32
540 "1n5qif1ispmdby1cmwf9f8isdx07phyhb19jsmgrw5bk3k23dcyy"))))
541 (build-system cmake-build-system)
542 (arguments
543 `(#:parallel-tests? #f
544 #:configure-flags
545 (list "-DWITH_ADE=OFF" ;we don't have a package for ade yet
546 "-DWITH_IPP=OFF"
547 "-DWITH_ITT=OFF"
548 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
549 "-DENABLE_PRECOMPILED_HEADERS=OFF"
550 "-DOPENCV_GENERATE_PKGCONFIG=ON"
551
552 ;; CPU-Features:
553 ;; See cmake/OpenCVCompilerOptimizations.cmake
554 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
555 ;; BASELINE is the minimum optimization all CPUs must support
556 ;;
557 ;; DISPATCH is the list of optional dispatches.
558 "-DCPU_BASELINE=SSE2"
559
560 ;; Build Python bindings.
561 "-DBUILD_opencv_python3=ON"
562
563 ,@(match (%current-system)
564 ("x86_64-linux"
565 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
566 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
567 ("armhf-linux"
568 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
569 ("aarch64-linux"
570 '("-DCPU_BASELINE=NEON"
571 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
572 (_ '()))
573
574 "-DBUILD_PERF_TESTS=OFF"
575 "-DBUILD_TESTS=ON"
576
577 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
578 "/opencv-contrib/modules")
579
580 ;;Define test data:
581 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
582 "/opencv-extra/testdata")
583
584 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
585 ;; which we had removed, which would lead to an error:
586 "-DBUILD_PROTOBUF=OFF"
587
588 ;; OpenCV tries to use flatbuffers in 3rdparty which we removed
589 ;; so for now we don't buildfor flatbuffer support
590 ;; TODO: make OpenCV use system flatbuffers which involves
591 ;; modifying CMake files
592 "-DWITH_FLATBUFFERS=OFF"
593
594 ;; Rebuild protobuf files, because we have a slightly different
595 ;; version than the included one. If we would not update, we
596 ;; would get a compile error later:
597 "-DPROTOBUF_UPDATE_FILES=ON"
598
599 ;; For xfeatures2d.
600 "-DOPENCV_SKIP_FEATURES2D_DOWNLOADING=ON")
601 #:phases
602 (modify-phases %standard-phases
603 (add-after 'unpack 'disable-broken-tests
604 (lambda _
605 ;; This test fails with "unknown file: Failure"
606 ;; But I couldn't figure out which file was missing:
607 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
608 (("\\bcan_detect_landmarks\\b" all)
609 (string-append "DISABLED_" all)))
610
611 ;; This all fails with a comparison between the expected 396 and
612 ;; the actual 440 in file size.
613 (substitute* "modules/imgcodecs/test/test_exr.impl.hpp"
614 (("\\breadWrite_32FC1\\b" all)
615 (string-append "DISABLED_" all)))
616
617 ;; These fail with protobuf parse errors that come from
618 ;; opencv-extra/alldata.
619 (substitute* "modules/dnn/test/test_layers.cpp"
620 (("\\b(Accum|DataAugmentation|Resample|Correlation|Interp)\\b" all)
621 (string-append "DISABLED_" all)))
622
623 ;; This test fails on x86-64, loosen the bounds.
624 ;; Expected: (max) < (0.1), actual: 0.2 vs 0.1
625 (substitute* "modules/photo/test/test_hdr.cpp"
626 (("0\\.1\\)") "0.222)"))
627
628 ,@(if (target-aarch64?)
629 `(;; This test fails on aarch64, loosen the bounds.
630 ;; Expected: (max) < (0.131), actual: 0.207148 vs 0.131
631 (substitute* "modules/photo/test/test_hdr.cpp"
632 (("0\\.131") "0.222"))
633 ;; These tests hang forever on aarch64.
634 (delete-file-recursively "modules/videoio/test/"))
635 '())
636
637 ,@(if (target-riscv64?)
638 `(;; This test fails on riscv64, loosen the bounds.
639 ;; Expected: (max) < (0.1), actual: 0.220829 vs 0.1
640 (substitute* "modules/photo/test/test_hdr.cpp"
641 (("0\\.1") "0.240"))
642 ;; Expected equality of these values:
643 ;; ellipses.size()
644 ;; Which is: 668
645 ;; ellipses_size
646 ;; Which is: 2449
647 (substitute* "../opencv-contrib/modules/ximgproc/test/test_fld.cpp"
648 (("\\bManySmallCircles\\b" all)
649 (string-append "DISABLED_" all))))
650 '())))
651 (add-after 'unpack 'unpack-submodule-sources
652 (lambda* (#:key inputs #:allow-other-keys)
653 (mkdir "../opencv-extra")
654 (mkdir "../opencv-contrib")
655 (copy-recursively (assoc-ref inputs "opencv-extra")
656 "../opencv-extra")
657 (copy-recursively (assoc-ref inputs "opencv-contrib")
658 "../opencv-contrib")
659
660 ;; Disable downloads of Boost and VGG descriptors as we include
661 ;; them in native inputs.
662 (substitute* "../opencv-contrib/modules/xfeatures2d/CMakeLists.txt"
663 (("download_(boost|vgg)_descriptors") "#"))
664 (copy-recursively (assoc-ref inputs "opencv-3rdparty-boost")
665 "../downloads/xfeatures2d")
666 (for-each make-file-writable
667 (find-files "../downloads/xfeatures2d" "."))
668 (copy-recursively (assoc-ref inputs "opencv-3rdparty-vgg")
669 "../downloads/xfeatures2d")))
670 (add-after 'build 'do-not-install-3rdparty-file
671 (lambda _
672 (substitute* "cmake_install.cmake"
673 (("file\\(INSTALL .*3rdparty/include/opencl/LICENSE.txt.*")
674 ""))))
675 (add-before 'check 'start-xserver
676 (lambda* (#:key inputs #:allow-other-keys)
677 (let ((xorg-server (assoc-ref inputs "xorg-server"))
678 (disp ":1"))
679 (setenv "HOME" (getcwd))
680 (setenv "DISPLAY" disp)
681 ;; There must be a running X server and make check doesn't start one.
682 ;; Therefore we must do it.
683 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
684 (native-inputs
685 `(("pkg-config" ,pkg-config)
686 ("xorg-server" ,xorg-server-for-tests) ;For running the tests
687 ;; These are files that are derived from the binary descriptors that
688 ;; are part of the BinBoost package. The BinBoost package is released
689 ;; under GPLv2+. See
690 ;; https://www.epfl.ch/labs/cvlab/research/descriptors-and-keypoints/research-detect-binboost/
691 ;; See xfeatures2d/cmake/download_boostdesc.cmake for commit hash.
692 ("opencv-3rdparty-boost"
693 ,(let ((commit "34e4206aef44d50e6bbcd0ab06354b52e7466d26"))
694 (origin
695 (method git-fetch)
696 (uri (git-reference (url "https://github.com/opencv/opencv_3rdparty")
697 (commit commit)))
698 (file-name (git-file-name "opencv_3rdparty" commit))
699 (sha256
700 (base32
701 "13yig1xhvgghvxspxmdidss5lqiikpjr0ddm83jsi0k85j92sn62")))))
702 ;; These are the Visual Geometry Group descriptors, released under
703 ;; BSD-3. They are generated files produced by the DLCO framework.
704 ;; See xfeatures2d/cmake/download_vgg.cmake for commit hash.
705 ("opencv-3rdparty-vgg"
706 ,(let ((commit "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"))
707 (origin
708 (method git-fetch)
709 (uri (git-reference (url "https://github.com/opencv/opencv_3rdparty")
710 (commit commit)))
711 (file-name (git-file-name "opencv_3rdparty" commit))
712 (sha256
713 (base32
714 "0r9fam8dplyqqsd3qgpnnfgf9l7lj44di19rxwbm8mxiw0rlcdvy")))))
715 ("opencv-extra"
716 ,(origin
717 (method git-fetch)
718 (uri (git-reference
719 (url "https://github.com/opencv/opencv_extra")
720 (commit version)))
721 (file-name (git-file-name "opencv_extra" version))
722 (sha256
723 (base32
724 "0awang2hl7z194rlnic38ry6fgxy8b7k2qqasinjqznxab4dkhvz"))))
725 ("opencv-contrib"
726 ,(origin
727 (method git-fetch)
728 (uri (git-reference (url "https://github.com/opencv/opencv_contrib")
729 (commit version)))
730 (file-name (git-file-name "opencv_contrib" version))
731 (sha256
732 (base32
733 "1ai1kanlq1wr3173q86yfj6r9h3kkvjx18cakjr31jkb25qyrmny"))))))
734 (inputs
735 (list eigen
736 ffmpeg-4
737 ;; TODO: add gstreamer
738 gtk+
739 hdf5
740 imath ;should be propagated by openexr
741 jasper
742 libgphoto2
743 libjpeg-turbo
744 libpng
745 libtiff
746 libwebp
747 openblas
748 opencl-headers
749 openexr
750 openmpi
751 openjpeg
752 protobuf
753 python
754 python-numpy
755 vtk
756 zlib))
757 ;; These three CVEs are not a problem of OpenCV, see:
758 ;; https://github.com/opencv/opencv/issues/10998
759 (properties '((lint-hidden-cve . ("CVE-2018-7712"
760 "CVE-2018-7713"
761 "CVE-2018-7714"))))
762 (synopsis "Computer vision library")
763 (description "OpenCV is a library aimed at real-time computer vision,
764including several hundred computer vision algorithms. It can be used to do
765things like:
766
767@itemize
768@item image and video input and output
769@item image and video processing
770@item displaying
771@item feature recognition
772@item segmentation
773@item facial recognition
774@item stereo vision
775@item structure from motion
776@item augmented reality
777@item machine learning
778@end itemize\n
779
780This package includes the Python bindings for OpenCV, which are also known as
781the OpenCV-Python library.")
782 (home-page "https://opencv.org/")
783 (license license:bsd-3)))
784
785(define-public vips
786 (package
787 (name "vips")
788 (version "8.17.0")
789 (source
790 (origin
791 (method git-fetch)
792 (uri (git-reference
793 (url "https://github.com/libvips/libvips")
794 (commit (string-append "v" version))))
795 (file-name (git-file-name name version))
796 (sha256
797 (base32 "1rdz2mmivr02s7cksqgbramv37yw95w6s8r20hgjqx36in2ndnbl"))))
798 (build-system meson-build-system)
799 (native-inputs
800 (list `(,glib "bin")
801 gobject-introspection
802 pkg-config))
803 (inputs
804 (list glib
805 hdf5
806 imagemagick
807 poppler))
808 ;; Propagated to satisfy vips.pc.
809 (propagated-inputs
810 (list expat
811 fftw
812 lcms
813 libexif
814 libgsf
815 libjpeg-turbo
816 libpng
817 (librsvg-for-system)
818 libtiff
819 libwebp
820 matio
821 openexr
822 orc
823 pango))
824 (home-page "https://www.libvips.org/")
825 (synopsis "Multithreaded image processing system with low memory needs")
826 (description
827 "VIPS is a demand-driven, horizontally threaded image processing library.
828It's particularly good at processing large images, working with colour,
829scientific analysis, and general research & development.
830
831Compared to most image processing libraries VIPS needs little RAM and runs
832quickly, especially on machines with more than one CPU core. This is primarily
833due to its architecture which automatically parallelises the image workflows.")
834 (license license:lgpl2.1+)))
835
836(define-public gmic
837 (package
838 (name "gmic")
839 (version "3.5.5")
840 (source
841 (origin
842 (method url-fetch)
843 (uri (string-append "https://gmic.eu/files/source/gmic_"
844 version ".tar.gz"))
845 (sha256
846 (base32 "1wyzq5g8kfnglb5l8ipzh6lhf4667vmcd88gd9vf55fdnvdrjygp"))))
847 (build-system cmake-build-system)
848 (arguments
849 (list
850 #:tests? #f ;there are no tests
851 #:configure-flags #~(list "-DBUILD_LIB_STATIC=OFF"
852 "-DENABLE_DYNAMIC_LINKING=ON"
853 (string-append "-DCMAKE_EXE_LINKER_FLAGS="
854 "-Wl,-rpath=" #$output "/lib")
855 "-DENABLE_LTO=ON")))
856 (native-inputs
857 (list pkg-config))
858 (inputs
859 (list curl
860 fftw
861 graphicsmagick
862 imath
863 libjpeg-turbo
864 libpng
865 libtiff
866 libx11
867 openexr
868 zlib))
869 (home-page "https://gmic.eu/")
870 (synopsis "Full-featured framework for digital image processing")
871 (description "G'MIC is a full-featured framework for digital image
872processing. It provides several user interfaces to convert / manipulate
873/ filter / visualize generic image datasets, ranging from 1D scalar
874signals to 3D+t sequences of multi-spectral volumetric images, hence
875including 2D color images.")
876 ;; Dual-licensed, either license applies.
877 (license (list license:cecill license:cecill-c))))
878
879(define-public gmic-qt
880 (package
881 (inherit gmic)
882 (name "gmic-qt")
883 (arguments
884 (substitute-keyword-arguments (package-arguments gmic)
885 ((#:configure-flags _)
886 #~(list "-DGMIC_QT_HOST=none"
887 "-DENABLE_DYNAMIC_LINKING=ON"))
888 ((#:phases phases '%standard-phases)
889 #~(modify-phases #$phases
890 (add-after 'unpack 'qt-chdir
891 (lambda _ (chdir "gmic-qt")))))))
892 (native-inputs
893 (list pkg-config qttools-5))
894 (inputs
895 (modify-inputs (package-inputs gmic)
896 (prepend gmic qtbase-5)))
897 (synopsis "Qt frontend for the G'MIC image processing framework")
898 (license license:gpl3+)))
899
900(define-public gmic-qt-gimp
901 (package
902 (inherit gmic-qt)
903 (name "gmic-qt-gimp")
904 (inputs
905 ;; GIMP and its dependencies.
906 (modify-inputs (package-inputs gmic-qt)
907 (prepend gexiv2 gdk-pixbuf gegl gimp pango)))
908 (arguments
909 (substitute-keyword-arguments (package-arguments gmic-qt)
910 ((#:configure-flags flags)
911 #~(list "-DGMIC_QT_HOST=gimp3"
912 "-DENABLE_DYNAMIC_LINKING=ON"))))
913 (synopsis "GIMP plugin for the G'MIC image processing framework")))
914
915(define-public nip2
916 (package
917 (name "nip2")
918 (version "8.9.1")
919 (source
920 (origin
921 (method url-fetch)
922 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
923 version "/nip2-" version ".tar.gz" ))
924 (sha256
925 (base32 "1kbndn37m0cfjvrvw25b5if9d962r8v79q78i2lzm55r7zmjcpmp"))))
926 (build-system gnu-build-system)
927 (arguments
928 `(#:phases
929 (modify-phases %standard-phases
930 (add-before 'check 'set-home
931 (lambda _
932 (setenv "HOME" "/tmp"))))))
933 (inputs (list gsl gtk+-2 vips))
934 (native-inputs (list bison flex pkg-config))
935 (home-page "https://github.com/libvips/nip2")
936 (synopsis "Spreadsheet-like GUI for libvips")
937 (description "This package provide a graphical user interface (GUI) for
938the VIPS image processing library. It's a little like a spreadsheet: you
939create a set of formula connecting your objects together, and on a change nip2
940recalculates.")
941 (license license:gpl2+)))
942
943(define-public paraview
944 (package
945 (name "paraview")
946 (version "6.0.0")
947 (source
948 (origin
949 (method git-fetch)
950 (uri (git-reference
951 (url "https://gitlab.kitware.com/paraview/paraview")
952 (commit (string-append "v" version))
953 (recursive? #t)))
954 (file-name (git-file-name name version))
955 (sha256
956 (base32 "1m1c7vngrpaqdqvnjx4wj0va20hih5rb7rf0a44mp3wqgp4wgy0f"))
957 (modules '((guix build utils)))
958 (snippet
959 ;; TODO: Also remove unused bundled libraries and plugins?
960 #~(begin
961 ;; Remove bundled ParaView libraries which are available in Guix
962 ;; or undesired.
963 (for-each (lambda (dir)
964 (delete-file-recursively
965 (string-append "ThirdParty/" dir "/vtk"
966 (string-downcase dir))))
967 '(;;"CosmoHaloFinder"
968 ;;"IceT"
969 "NvPipe" ; Don't want NvPipe support
970 ;;"QtTesting"
971 ;;"cinema"
972 ;;"cinemasci"
973 "protobuf"))
974 ;; Remove undesired ParaView plugins.
975 (delete-file-recursively "Plugins/pvNVIDIAIndeX")
976 ;; Remove bundled VTK libraries which are available in Guix.
977 (for-each (lambda (dir)
978 (delete-file-recursively
979 (string-append "VTK/ThirdParty/" dir "/vtk" dir)))
980 '("cgns"
981 "cli11"
982 ;;"diy2"
983 "doubleconversion"
984 "eigen"
985 ;;"exodusII"
986 "expat"
987 ;;"exprtk"
988 ;;"fast-float"
989 ;;"fides"
990 "fmt"
991 "freetype"
992 "gl2ps"
993 ;;"glad"
994 ;;"h5part"
995 "hdf5"
996 ;;"ioss"
997 "jpeg"
998 "jsoncpp"
999 ;;"kissfft"
1000 ;;"libharu" ; Requires some PRs applied to 2.3.0
1001 "libproj"
1002 "libxml2"
1003 ;;"loguru"
1004 "lz4"
1005 "lzma"
1006 "mpi4py"
1007 "netcdf"
1008 "nlohmannjson"
1009 "ogg"
1010 ;;"pegtl"
1011 "png"
1012 "pugixml"
1013 "sqlite"
1014 "theora"
1015 "tiff"
1016 ;;"token"
1017 "utf8"
1018 ;;"verdict"
1019 ;;"viskores"
1020 ;;"vpic"
1021 ;;"vtkm"
1022 ;;"xdmf2"
1023 ;;"xdmf3"
1024 "zlib"))))))
1025 (build-system qt-build-system)
1026 (arguments
1027 (list
1028 #:qtbase qtbase
1029 #:build-type "Release" ; 542 MiB in release mode
1030 #:tests? #f ; Downloads test data
1031 #:configure-flags
1032 #~(let ((doc (string-append "share/doc/" #$name "-" #$version)))
1033 (list
1034 (string-append "-DCMAKE_INSTALL_DOCDIR=" doc) ; For paraview.qch
1035
1036 ;; ParaView build options
1037 "-DPARAVIEW_BUILD_DEVELOPER_DOCUMENTATION=ON"
1038 (string-append "-DPARAVIEW_GENERATED_DOCUMENTATION_OUTPUT_DIRECTORY=" doc)
1039
1040 ;; ParaView capability options
1041 ;;"-DPARAVIEW_USE_EXTERNAL_VTK=ON" ; Unsupported by ParaView
1042 "-DPARAVIEW_USE_MPI=ON"
1043 "-DPARAVIEW_USE_PYTHON=ON"
1044 "-DPARAVIEW_USE_QTWEBENGINE=ON"
1045
1046 ;; ParaView features
1047 ;;
1048 ;; Enable those that are disabled by default.
1049 ;; Commented means the dependencies are missing from Guix
1050 ;; (or are otherwise described).
1051 ;;"-DPARAVIEW_ENABLE_ADIOS2=ON"
1052 ;;"-DPARAVIEW_ENABLE_COSMOTOOLS=ON"
1053 ;;"-DPARAVIEW_ENABLE_CATALYST=ON"
1054 "-DPARAVIEW_ENABLE_FFMPEG=ON"
1055 ;;"-DPARAVIEW_ENABLE_FIDES=ON"
1056 "-DPARAVIEW_ENABLE_GDAL=ON"
1057 ;;"-DPARAVIEW_ENABLE_LAS=ON"
1058 ;;"-DPARAVIEW_ENABLE_LOOKINGGLASS=ON" ; Downloads dependency
1059 ;;"-DPARAVIEW_ENABLE_MOMENTINVARIANTS=ON" ; Downloads dependency
1060 "-DPARAVIEW_ENABLE_MOTIONFX=ON"
1061 ;;"-DPARAVIEW_ENABLE_OPENTURNS=ON"
1062 ;;"-DPARAVIEW_ENABLE_OPENVDB=ON" ; Dependency not found
1063 ;;"-DPARAVIEW_ENABLE_PDAL=ON"
1064 ;;"-DPARAVIEW_ENABLE_RAYTRACING=ON"
1065 "-DPARAVIEW_ENABLE_VISITBRIDGE=ON"
1066 "-DPARAVIEW_ENABLE_XDMF3=ON"
1067
1068 ;; ParaView miscellaneous options
1069 ;;
1070 ;; Without -DPARAVIEW_DATA_EXCLUDE_FROM_ALL=OFF, test data is
1071 ;; downloaded even with tests disabled.
1072 "-DPARAVIEW_VERSIONED_INSTALL=OFF"
1073 "-DPARAVIEW_DATA_EXCLUDE_FROM_ALL=OFF"
1074
1075 ;; ParaView plugins
1076 ;;
1077 ;; Enable those that are disabled by default.
1078 ;; Commented means the dependencies are missing from Guix
1079 ;; (or are otherwise described).
1080 ;;"-DPARAVIEW_PLUGIN_ENABLE_AdiosReaderPixie=ON"
1081 ;;"-DPARAVIEW_PLUGIN_ENABLE_AdiosReaderStaging=ON"
1082 "-DPARAVIEW_PLUGIN_ENABLE_CAVEInteraction=ON"
1083 ;;"-DPARAVIEW_PLUGIN_ENABLE_CDIReader=ON"
1084 "-DPARAVIEW_PLUGIN_ENABLE_GeographicalMap=ON"
1085 "-DPARAVIEW_PLUGIN_ENABLE_GmshIO=ON"
1086 "-DPARAVIEW_PLUGIN_ENABLE_InSituExodus=ON"
1087 ;;"-DPARAVIEW_PLUGIN_ENABLE_LookingGlass=ON"
1088 "-DPARAVIEW_PLUGIN_ENABLE_NetCDFTimeAnnotationPlugin=ON"
1089 ;;"-DPARAVIEW_PLUGIN_ENABLE_ParFlow=ON" ; Build fails
1090 ;;"-DPARAVIEW_PLUGIN_ENABLE_PythonQtPlugin=ON"
1091 "-DPARAVIEW_PLUGIN_ENABLE_SpaceMouseInteractor=ON"
1092 ;;"-DPARAVIEW_PLUGIN_ENABLE_VDFReaderPlugin=ON"
1093 ;;"-DPARAVIEW_PLUGIN_ENABLE_XRInterface=ON" ; Build fails
1094 ;;"-DPARAVIEW_PLUGIN_ENABLE_zSpace=ON"
1095
1096 ;; VTK options
1097 "-DVTK_SMP_IMPLEMENTATION_TYPE=TBB"
1098 "-DVTKm_ENABLE_MPI=ON"
1099
1100 ;; External libraries for ParaView and VTK
1101 "-DVTK_MODULE_USE_EXTERNAL_ParaView_protobuf=ON"
1102 "-DVTK_MODULE_USE_EXTERNAL_VTK_cgns=ON"
1103 "-DVTK_MODULE_USE_EXTERNAL_VTK_cli11=ON"
1104 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
1105 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
1106 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
1107 "-DVTK_MODULE_USE_EXTERNAL_VTK_fmt=ON"
1108 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
1109 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
1110 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
1111 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
1112 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
1113 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
1114 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
1115 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
1116 "-DVTK_MODULE_USE_EXTERNAL_VTK_lzma=ON"
1117 "-DVTK_MODULE_USE_EXTERNAL_VTK_mpi4py=ON"
1118 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
1119 "-DVTK_MODULE_USE_EXTERNAL_VTK_nlohmannjson=ON"
1120 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
1121 ;;"-DVTK_MODULE_USE_EXTERNAL_VTK_pegtl=ON"
1122 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
1123 "-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON"
1124 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
1125 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
1126 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
1127 "-DVTK_MODULE_USE_EXTERNAL_VTK_utf8=ON"
1128 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"))
1129 #:phases
1130 #~(modify-phases %standard-phases
1131 (add-after 'set-paths 'hide-gfortran
1132 (lambda _
1133 (setenv "CPLUS_INCLUDE_PATH"
1134 (string-join
1135 (delete (string-append #$(this-package-native-input "gfortran")
1136 "/include/c++")
1137 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
1138 ":"))))
1139 (replace 'install-license-files
1140 (lambda _
1141 (let ((src (string-append #$output "/share/licenses/ParaView"))
1142 (dst (string-append #$output "/share/doc/"
1143 #$name "-" #$version "/licenses")))
1144 (copy-recursively src dst)
1145 (delete-file-recursively (dirname src))))))))
1146 (native-inputs
1147 (list gfortran
1148 ;; For the documentation
1149 doxygen
1150 graphviz
1151 perl
1152 python-sphinx))
1153 (inputs
1154 (list boost
1155 cgns
1156 cli11
1157 curl
1158 double-conversion
1159 eigen
1160 expat
1161 ffmpeg
1162 fmt-11
1163 freetype
1164 gdal
1165 gl2ps
1166 gmsh
1167 hdf5
1168 nlohmann-json ;For ParFlow; build fails
1169 jsoncpp
1170 libjpeg-turbo
1171 libogg
1172 libpng
1173 libtheora
1174 libtiff
1175 libxcursor
1176 libxml2
1177 libxslt
1178 libxt
1179 lz4
1180 lzip
1181 mesa
1182 netcdf
1183 openmpi
1184 ;;openvdb ;For OpenVDB; dependency not found
1185 ;;openvr ;For XRInterface; build fails
1186 ;;pegtl ;For VTK; build fails
1187 proj
1188 protobuf
1189 pugixml
1190 python-cftime
1191 python-matplotlib
1192 python-mpi4py
1193 python-numpy
1194 python-wrapper
1195 qt5compat
1196 qtdeclarative
1197 qtmultimedia
1198 qtsvg
1199 qttools
1200 qtwebchannel
1201 qtwebengine
1202 sdl2
1203 sqlite
1204 tbb
1205 utfcpp
1206 zlib))
1207 (home-page "https://www.paraview.org/")
1208 (synopsis "VTK-based, parallel data analyzer and visualizer")
1209 (description "ParaView is a VTK-based, parallel data analyzer and
1210visualizer which allows exploring data interactively in 3D or
1211programmatically.")
1212 (license license:bsd-3)))
1213
1214(define-public vxl
1215 (package
1216 (name "vxl")
1217 (version "3.5.0")
1218 (source
1219 (origin
1220 (method git-fetch)
1221 (uri (git-reference
1222 (url "https://github.com/vxl/vxl")
1223 (commit (string-append "v" version))))
1224 (file-name (git-file-name name version))
1225 (sha256
1226 (base32 "0iqq4lm51l5gvkax6r79ypifqmgir3p3vman9gsc2085d2agjvbs"))
1227 (modules '((guix build utils)))
1228 ;; TODO: vxl includes an old version of dcmtk. It won't build with
1229 ;; version 3.6.x.
1230 (snippet
1231 '(begin
1232 (for-each delete-file-recursively
1233 '("v3p/bzlib/"
1234 "v3p/geotiff/"
1235 "v3p/jpeg/"
1236 "v3p/png/"
1237 "v3p/tiff/"
1238 "v3p/zlib/"))
1239 (substitute* "v3p/CMakeLists.txt"
1240 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
1241 ""))
1242 #t))))
1243 (build-system cmake-build-system)
1244 (arguments
1245 ;; Not an actual test, but is incorrectly generated by the build system.
1246 (list #:test-exclude "vul_vul_test_driver"))
1247 (inputs
1248 (list libgeotiff libtiff libjpeg-turbo libpng zlib))
1249 (home-page "https://github.com/vxl/vxl/")
1250 (synopsis "Collection of C++ libraries for computer vision")
1251 (description "VXL (the Vision-something-Libraries) is a collection of C++
1252libraries designed for computer vision research and implementation.")
1253 (license license:bsd-3)))
1254
1255(define-public vxl-1
1256 (package (inherit vxl)
1257 (name "vxl")
1258 (version "1.18.0")
1259 (source
1260 (origin
1261 (method git-fetch)
1262 (uri (git-reference
1263 (url "https://github.com/vxl/vxl")
1264 (commit (string-append "v" version))))
1265 (file-name (git-file-name name version))
1266 (sha256
1267 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
1268 (modules '((guix build utils)))
1269 (snippet
1270 '(begin
1271 (for-each delete-file-recursively
1272 '("v3p/bzlib/"
1273 "v3p/geotiff/"
1274 "v3p/png/"
1275 "v3p/tiff/"
1276 "v3p/zlib/"))
1277 (substitute* "v3p/CMakeLists.txt"
1278 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
1279 ""))))))
1280 (arguments
1281 (substitute-keyword-arguments (package-arguments vxl)
1282 ((#:configure-flags flags)
1283 #~(cons* ;; Needed for itk-snap
1284 "-DVNL_CONFIG_LEGACY_METHODS=ON"
1285 "-DCMAKE_CXX_STANDARD=14"
1286 #$flags))))))
1287
1288(define-public insight-toolkit
1289 ;; For information about ITK remote modules, see:
1290 ;; https://insightsoftwareconsortium.github.io/ITKWikiArchive/Wiki/ITK/Policy_and_Procedures_for_Adding_Remote_Modules
1291 ;; For a remote MODULE, use the commit in
1292 ;; 'Modules/Remote/MODULE.remote.cmake'.
1293 ;; MorphologicalContourInterpolation is required by itk-snap.
1294 ;; SimpleITKFilters and GenericLabelInterpolator are required by simpleitk.
1295 ;; GenericLabelInterpolator and AdaptiveDenoising are required by ants.
1296 (let* ((module-mci-commit "821bf9b3ef8eaaab10391ed060dc9ca5e4d37b39")
1297 (module-mci-file (git-file-name "ITKMorphologicalContourInterpolation"
1298 module-mci-commit))
1299 (module-sitkf-commit "bb896868fc6480835495d0da4356d5db009592a6")
1300 (module-sitkf-file (git-file-name "ITKSimpleITKFilters"
1301 module-sitkf-commit))
1302 (module-gli-commit "ebf2436469ccf82c08fab54b7446f699ad0eae01")
1303 (module-gli-file (git-file-name "ITKGenericLabelInterpolator"
1304 module-gli-commit))
1305 (module-ad-commit "853934c352f83cb1e8f87e3051e1b8e75dbb41fe")
1306 (module-ad-file (git-file-name "ITKAdaptiveDenoising"
1307 module-ad-commit)))
1308 (package
1309 (name "insight-toolkit")
1310 (version "5.4.4")
1311 (source
1312 (origin
1313 (method git-fetch)
1314 (uri (git-reference
1315 (url "https://github.com/InsightSoftwareConsortium/ITK")
1316 (commit (string-append "v" version))))
1317 (file-name (git-file-name name version))
1318 (sha256
1319 (base32 "1l5rby8jj8726k380aivycmhn56cz56mr9k3r56c8hkkrfwwng50"))
1320 ;; This patch is required to build with both ITK_USE_GPU=ON and
1321 ;; ITK_WRAP_PYTHON=ON.
1322 ;; <https://github.com/InsightSoftwareConsortium/ITK/pull/4842>
1323 (patches (search-patches "insight-toolkit-fix-build.patch"))))
1324 (build-system cmake-build-system)
1325 (outputs '("out" "python"))
1326 (arguments
1327 (list
1328 #:imported-modules (append %cmake-build-system-modules
1329 %pyproject-build-system-modules)
1330 #:modules '(((guix build pyproject-build-system) #:prefix py:)
1331 (guix build cmake-build-system)
1332 (guix build utils))
1333 #:configure-flags
1334 #~(list "-DITK_USE_GPU=ON"
1335 "-DITK_USE_SYSTEM_LIBRARIES=ON"
1336 "-DITK_USE_SYSTEM_CASTXML=ON"
1337 "-DITK_USE_SYSTEM_SWIG=ON"
1338 (string-append "-DHDF5_DIR="
1339 #$(this-package-input "hdf5") "/lib/cmake")
1340 "-DBUILD_SHARED_LIBS=ON"
1341 ;; Without this flag, there are shared libraries installed
1342 ;; in PY_SITE_PACKAGES_PATH/itk instead of #$output/lib and
1343 ;; RUNPATHs contain the *build directory* of
1344 ;; PY_SITE_PACKAGES_PATH/itk.
1345 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
1346 "-DITK_WRAPPING=ON"
1347 "-DITK_WRAP_PYTHON=ON"
1348 "-DITK_DYNAMIC_LOADING=ON"
1349 (let* ((python-version
1350 #$(version-major+minor
1351 (package-version
1352 (this-package-input "python"))))
1353 (python-lib-path (string-append #$output:python
1354 "/lib/python"
1355 python-version
1356 "/site-packages")))
1357 (string-append "-DPY_SITE_PACKAGES_PATH="
1358 python-lib-path))
1359 ;; Python is not built with Py_LIMITED_API.
1360 "-DITK_USE_PYTHON_LIMITED_API=OFF"
1361 "-DModule_MorphologicalContourInterpolation=ON"
1362 "-DModule_SimpleITKFilters=ON"
1363 "-DModule_GenericLabelInterpolator=ON"
1364 "-DModule_AdaptiveDenoising:BOOL=ON"
1365 "-DModule_ITKReview:BOOL=ON"
1366 "-DCMAKE_CXX_STANDARD=17"
1367 "-DBUILD_TESTING=OFF")
1368
1369 #:phases
1370 #~(modify-phases %standard-phases
1371 (add-after 'unpack 'do-not-tune
1372 (lambda _
1373 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
1374 (("-mtune=native")
1375 ""))))
1376 (add-after 'unpack 'ignore-warnings
1377 (lambda _
1378 (substitute* "Wrapping/Generators/Python/CMakeLists.txt"
1379 (("-Werror")
1380 ""))))
1381 (add-after 'unpack 'exclude-gtest-target
1382 (lambda _
1383 ;; Prevent ITKGoogleTest from being added to
1384 ;; ITK_MODULES_ENABLED in the installed
1385 ;; ITKConfig.cmake, which in turn prevents
1386 ;; 'GTest::GTest' from being added to the
1387 ;; ITK_LIBRARIES variable. This is necessary
1388 ;; because projects that use ITK fail to configure
1389 ;; otherwise. Fixes
1390 ;; <https://codeberg.org/guix/guix/issues/776>.
1391 ;; <https://github.com/microsoft/vcpkg/pull/27187>
1392 (substitute* "Modules/ThirdParty/GoogleTest/itk-module.cmake"
1393 (("DEPENDS")
1394 "DEPENDS\n EXCLUDE_FROM_DEFAULT"))))
1395 (add-after 'unpack 'prepare-remote-modules
1396 (lambda _
1397 ;; ITK module MorphologicalContourInterpolation
1398 ;; is for ITK-SNAP.
1399 (symlink #$(this-package-native-input module-mci-file)
1400 "Modules/Remote/MorphologicalContourInterpolation")
1401 (delete-file
1402 (string-append
1403 "Modules/Remote/"
1404 "MorphologicalContourInterpolation.remote.cmake"))
1405 ;; ITK modules SimpleITKFilters and GenericLabelInterpolator
1406 ;; are for SimpleITK.
1407 (symlink #$(this-package-native-input module-sitkf-file)
1408 "Modules/Remote/SimpleITKFilters")
1409 (delete-file "Modules/Remote/SimpleITKFilters.remote.cmake")
1410 (symlink #$(this-package-native-input module-gli-file)
1411 "Modules/Remote/GenericLabelInterpolator")
1412 (delete-file
1413 "Modules/Remote/GenericLabelInterpolator.remote.cmake")
1414 (symlink #$(this-package-native-input module-ad-file)
1415 "Modules/Remote/AdaptiveDenoising")
1416 (delete-file
1417 "Modules/Remote/AdaptiveDenoising.remote.cmake")))
1418 (add-after 'unpack 'fix-numpy-bool
1419 (lambda _
1420 ;; <https://github.com/InsightSoftwareConsortium/ITK/pull/5402>
1421 (substitute* (string-append "Wrapping/Generators/"
1422 "Python/itk/support/types.py")
1423 (("np\\.bool") "np.bool_"))))
1424 (delete 'check) ;tests require network access and external data
1425 (add-after 'install 'python-sanity-check
1426 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1427 (when tests?
1428 (py:add-installed-pythonpath inputs outputs)
1429 (invoke "python3" "-c" "import itk")))))))
1430 (inputs (list eigen
1431 expat
1432 fftw
1433 fftwf
1434 hdf5
1435 libjpeg-turbo
1436 libpng
1437 libtiff
1438 opencl-headers
1439 opencl-icd-loader
1440 perl
1441 python
1442 tbb
1443 vxl-1
1444 zlib))
1445 (native-inputs
1446 (list castxml
1447 gcc-13
1448 git-minimal
1449 pkg-config
1450 python-numpy ;for phase 'python-sanity-check
1451 swig-next
1452 which
1453 (origin
1454 (method git-fetch)
1455 (uri
1456 (git-reference
1457 (url (string-append
1458 "https://github.com/KitwareMedical/"
1459 "ITKMorphologicalContourInterpolation"))
1460 (commit module-mci-commit)))
1461 (file-name module-mci-file)
1462 (sha256
1463 (base32
1464 "00myhgvlk3n062i8bnknz1d10zkv3jlvs7f4jnk24727gd4v2n4i")))
1465 (origin
1466 (method git-fetch)
1467 (uri (git-reference
1468 (url (string-append
1469 "https://github.com/InsightSoftwareConsortium/"
1470 "ITKSimpleITKFilters"))
1471 (commit module-sitkf-commit)))
1472 (file-name module-sitkf-file)
1473 (sha256
1474 (base32
1475 "13nys94wl4k77f89i8y1dm3y4pmgmw3rrc0la1rzl0vi9h1qixii")))
1476 (origin
1477 (method git-fetch)
1478 (uri (git-reference
1479 (url (string-append
1480 "https://github.com/InsightSoftwareConsortium/"
1481 "ITKGenericLabelInterpolator"))
1482 (commit module-gli-commit)))
1483 (file-name module-gli-file)
1484 (sha256
1485 (base32
1486 "1khakqh6pzdg6csli8jypzrhcdr9xmhnzgwz265krv8r5mbnndrg")))
1487 (origin
1488 (method git-fetch)
1489 (uri (git-reference
1490 (url "https://github.com/ntustison/ITKAdaptiveDenoising")
1491 (commit module-ad-commit)))
1492 (file-name module-ad-file)
1493 (sha256
1494 (base32
1495 "0aqvhb4byg0shgbrwmb41nq2h8sbg45xn0gsdy94iiq0v72bw307")))))
1496
1497 ;; The 'CMake/ITKSetStandardCompilerFlags.cmake' file normally sets
1498 ;; '-mtune=native -march=corei7', suggesting there's something to be
1499 ;; gained from CPU-specific optimizations.
1500 (properties '((tunable? . #t)))
1501
1502 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
1503 (synopsis "Scientific image processing, segmentation and registration")
1504 (description
1505 "The Insight Toolkit (ITK) is a toolkit for N-dimensional
1506scientific image processing, segmentation, and registration. Segmentation is
1507the process of identifying and classifying data found in a digitally sampled
1508representation. Typically the sampled representation is an image acquired
1509from such medical instrumentation as CT or MRI scanners. Registration is the
1510task of aligning or developing correspondences between data. For example, in
1511the medical environment, a CT scan may be aligned with a MRI scan in order to
1512combine the information contained in both.")
1513 (license license:asl2.0))))
1514
1515;; Provide variant of insight-toolkit (ITK) built with ITK_LEGACY_REMOVE=OFF.
1516;; ITK-SNAP version 4.2.2 and 4.4.0-alpha3 require ITK >= 5.4 and for ITK to
1517;; be built this way. Note that enabling Python wrapping forces this option
1518;; to ON, so Python wrapping is not enabled for this build.
1519(define insight-toolkit-legacy
1520 (hidden-package
1521 (package/inherit insight-toolkit
1522 ;; Unfortunately we cannot remove the 'python output because it is
1523 ;; referenced in #:configure-flags below.
1524 (name "insight-toolkit-legacy")
1525 (arguments
1526 (substitute-keyword-arguments (package-arguments insight-toolkit)
1527 ((#:configure-flags cf '())
1528 #~(filter (lambda (flag)
1529 (not (or
1530 ;; Remove these flags to restore the default
1531 ;; ITK_LEGACY_REMOVE=OFF.
1532 (string=? "-DITK_WRAPPING=ON" flag)
1533 (string=? "-DITK_WRAP_PYTHON=ON" flag)
1534 ;; These flags are now unused.
1535 (string-prefix? "-DPY_SITE_PACKAGES_PATH=" flag)
1536 (string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag)
1537 (string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag)
1538 (string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag))))
1539 #$cf))
1540 ((#:phases phases #~%standard-phases)
1541 #~(modify-phases #$phases
1542 (delete 'python-sanity-check)))))
1543 (inputs (modify-inputs (package-inputs insight-toolkit)
1544 (delete "python")))
1545 (native-inputs (modify-inputs (package-native-inputs insight-toolkit)
1546 (delete "castxml")
1547 (delete "python-numpy")
1548 (delete "swig"))))))
1549
1550(define-public itk-snap
1551 ;; The latest release, 4.2.2, segmentation faults on startup.
1552 ;; The commit is version 4.4.0-alpha3.
1553 (let ((commit "65251254d44d68a6c0530984169784e35de020dd")
1554 (revision "0"))
1555 (package
1556 (name "itk-snap")
1557 (version (git-version "4.2.2" revision commit))
1558 (source
1559 (origin
1560 (method git-fetch)
1561 (uri (git-reference
1562 (url "https://github.com/pyushkevich/itksnap")
1563 (commit commit)))
1564 (file-name (git-file-name name version))
1565 (sha256
1566 (base32 "07dgcfklc55yj3ldcq6fc5fil8qfrv7z6c3xhbd293kz7kpjr4yc"))))
1567 (build-system cmake-build-system)
1568 (arguments
1569 (list
1570 #:configure-flags
1571 #~(list "-DSNAP_VERSION_GIT_BRANCH=release"
1572 "-DSNAP_PACKAGE_QT_PLUGINS=OFF")
1573 #:phases
1574 #~(modify-phases %standard-phases
1575 ;; During the installation phase all libraries provided by all
1576 ;; dependencies will be copied to the lib directory. That's insane,
1577 ;; so we disable this.
1578 (add-after 'unpack 'do-not-copy-dependencies
1579 (lambda _
1580 (substitute* "CMakeLists.txt"
1581 (("install_qt5_executable\
1582\\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
1583 ""))))
1584 (add-after 'unpack 'disable-gui-tests
1585 (lambda _
1586 ;; The GUI tests just segmentation fault.
1587 (substitute* "CMakeLists.txt"
1588 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
1589|RandomForest|RandomForestBailOut|NaNs|4DContinuousRenderingD|EdgeAttraction\
1590|EchoCartesianDicomLoading|LabelSmoothing|PreferencesDialog|MeshImport\
1591|MeshWorkspace|SegmentationMesh|VolumeRendering|Reloading|4DToMC|MCTo4D\
1592|DeformationGrid)")
1593 ""))))
1594 (add-after 'unpack 'make-reproducible
1595 (lambda _
1596 (substitute* "CMakeLists.txt"
1597 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
1598 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))))
1599 (add-after 'unpack 'prepare-submodules
1600 (lambda _
1601 (rmdir "Submodules/c3d")
1602 (symlink #$(this-package-native-input "c3d-checkout")
1603 "Submodules/c3d")
1604 (rmdir "Submodules/digestible")
1605 (symlink #$(this-package-native-input "digestible-checkout")
1606 "Submodules/digestible")
1607 (rmdir "Submodules/greedy")
1608 (symlink #$(this-package-native-input "greedy-checkout")
1609 "Submodules/greedy")))
1610 (add-after 'unpack 'remove-bundled-jsoncpp
1611 (lambda _
1612 (substitute* "CMakeLists.txt"
1613 ((" Common/JSon/jsoncpp\\.cpp") ""))))
1614 (add-before 'check 'prepare-tests
1615 (lambda _
1616 ;; Needed by at least one test.
1617 (setenv "HOME" "/tmp")))
1618 (add-after 'install 'wrap-executable
1619 (lambda _
1620 (wrap-program (string-append #$output "/bin/itksnap")
1621 (list
1622 "QT_PLUGIN_PATH"
1623 'suffix
1624 (list (string-append #$(this-package-input "qtbase")
1625 "/lib/qt6/plugins")
1626 (string-append #$(this-package-input "qtdeclarative")
1627 "/lib/qt6/plugins")))))))))
1628 (inputs
1629 (list curl
1630 freetype
1631 glew
1632 glu
1633 insight-toolkit-legacy
1634 jsoncpp
1635 libssh
1636 mesa-opencl
1637 qtbase
1638 qtdeclarative
1639 vtk))
1640 (native-inputs
1641 (list
1642 doxygen
1643 ;; Use the submodule commits in this version of ITK-SNAP.
1644 (origin
1645 (method git-fetch)
1646 (uri (git-reference
1647 (url "https://github.com/pyushkevich/c3d")
1648 (commit "a86a2a32db8635c1535522332fee68bc56eacaa2")))
1649 (file-name "c3d-checkout")
1650 (sha256
1651 (base32 "0da3ikx7pqlrmvhkmzil269j6kyd84pphy1mls8v69gmzl89piis")))
1652 (origin
1653 (method git-fetch)
1654 (uri (git-reference
1655 (url "https://github.com/pyushkevich/digestible")
1656 (commit "1b66709e99c43d280bb472e1a0e36185ef2ea412")))
1657 (file-name "digestible-checkout")
1658 (sha256
1659 (base32 "1m1b954prq6l3byfdgxw2y17xsg81agd516g5n6ps60dqnxw8hqs")))
1660 (origin
1661 (method git-fetch)
1662 (uri (git-reference
1663 (url "https://github.com/pyushkevich/greedy")
1664 (commit "f10152c5374da08ee024c4c60ef8882876bd0808")))
1665 (file-name "greedy-checkout")
1666 (sha256
1667 (base32 "0xk1l0h4wis4nkfwjnvh624bdlhy7l26djibk4l00wzv0vvq21qv")))))
1668 (home-page "https://sourceforge.net/p/itk-snap/")
1669 (synopsis "Medical image segmentation")
1670 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1671medical images. It provides an automatic active contour segmentation
1672pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1673full-featured UI aimed at clinical researchers.")
1674 ;; This includes the submodules greedy, c3d and digestible.
1675 (license license:gpl3+))))
1676
1677(define-public metapixel
1678 ;; Follow stable branch.
1679 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1680 (package
1681 (name "metapixel")
1682 (version (git-version "1.0.2" "1" commit))
1683 (source
1684 (origin
1685 (method git-fetch)
1686 (uri (git-reference
1687 (url "https://github.com/schani/metapixel")
1688 (commit commit)
1689 ;; TODO: Package rwimg and lispreader?
1690 (recursive? #t)))
1691 (file-name (git-file-name name version))
1692 (sha256
1693 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1694 (build-system gnu-build-system)
1695 (arguments
1696 (list
1697 #:tests? #f ; No tests.
1698 #:make-flags
1699 #~(list
1700 (string-append "PREFIX=" #$output)
1701 (format #f "MANPAGE_XSL=~a/xml/xsl/~a-~a/manpages/docbook.xsl"
1702 #$(this-package-native-input "docbook-xsl")
1703 #$(package-name
1704 (this-package-native-input "docbook-xsl"))
1705 #$(package-version
1706 (this-package-native-input "docbook-xsl"))))
1707 #:phases
1708 #~(modify-phases %standard-phases
1709 (delete 'configure)
1710 (add-before 'install 'fix-directory-creation
1711 (lambda _
1712 (mkdir-p (string-append #$output "/share/man/man1")))))))
1713 (inputs
1714 (list giflib libjpeg-turbo libpng
1715 perl))
1716 (native-inputs
1717 (list docbook-xml-4.2 docbook-xsl
1718 libxslt pkg-config))
1719 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1720 (synopsis "Photomosaics generator")
1721 (description "Metapixel is a program for generating photomosaics. It can
1722generate classical photomosaics, in which the source image is viewed as a
1723matrix of equally sized rectangles for each of which a matching image is
1724substituted, as well as collage-style photomosaics, in which rectangular parts
1725of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1726substituted by matching images.")
1727 (license license:gpl2))))
1728
1729(define-public scantailor-advanced
1730 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1731 (package
1732 (name "scantailor-advanced")
1733 (version (string-append "1.0.16-" (string-take commit 7)))
1734 (source
1735 (origin
1736 (method git-fetch)
1737 (uri (git-reference
1738 (url "https://github.com/4lex4/scantailor-advanced")
1739 (commit commit)))
1740 (file-name (git-file-name name version))
1741 (sha256
1742 (base32
1743 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1744 (build-system qt-build-system)
1745 (native-inputs
1746 (list qttools-5))
1747 (inputs
1748 `(("boost" ,boost)
1749 ("libjpeg" ,libjpeg-turbo)
1750 ("libpng" ,libpng)
1751 ("libtiff" ,libtiff)
1752 ("qtbase" ,qtbase-5)
1753 ("qtsvg-5" ,qtsvg-5)
1754 ("zlib" ,zlib)))
1755 (arguments
1756 `(#:phases
1757 (modify-phases %standard-phases
1758 ;; Some tests require a display and fail with offscreen mode.
1759 (add-after 'unpack 'disable-failing-tests
1760 (lambda _
1761 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1762 #t)))))
1763 (home-page "https://github.com/4lex4/scantailor-advanced")
1764 (synopsis "Clean up scanned pages")
1765 (description "Scan Tailor is an interactive post-processing tool for
1766scanned pages. It performs operations such as page splitting, deskewing,
1767adding/removing borders, and others. You give it raw scans, and you get pages
1768ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1769character recognition, and assembling multi-page documents are out of scope of
1770this project.
1771
1772Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1773and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1774 (license license:gpl3+))))
1775
1776(define-public simpleitk
1777 (package
1778 (name "simpleitk")
1779 (version "2.5.2")
1780 (source
1781 (origin
1782 (method git-fetch)
1783 (uri (git-reference
1784 (url "https://github.com/SimpleITK/SimpleITK")
1785 (commit (string-append "v" version))))
1786 (file-name (git-file-name name version))
1787 (sha256
1788 (base32 "1ykrfrfh2012cg1122689w23pan2y731sszfpb701zhsb6fwv7j7"))))
1789 (build-system cmake-build-system)
1790 (outputs '("out" "python" "r"))
1791 (arguments
1792 (list
1793 #:configure-flags
1794 #~(list "-DBUILD_SHARED_LIBS=ON"
1795 "-DWRAP_LUA=OFF"
1796 "-DWRAP_PYTHON=ON"
1797 "-DWRAP_R=ON"
1798 "-DSimpleITK_PYTHON_USE_VIRTUALENV=OFF")
1799 #:phases
1800 #~(modify-phases %standard-phases
1801 (add-after 'unpack 'early-GTest-discovery
1802 (lambda _
1803 ;; Find GTest before targets link to 'GTest::GTest'.
1804 (substitute* "Testing/Unit/CMakeLists.txt"
1805 (("add_subdirectory\\(TestBase\\)" anchor)
1806 (string-append "find_package(GTest REQUIRED)\n" anchor)))))
1807 (add-after 'unpack 'extract-test-data
1808 (lambda _
1809 (invoke "tar" "xvf"
1810 #$(this-package-native-input
1811 (string-append "SimpleITKData-" version ".tar.gz"))
1812 "--strip-components=1")))
1813 (add-after 'unpack 'fix-runpath
1814 (lambda _
1815 ;; The SWIG-generated shared libraries do not have SimpleITK's
1816 ;; libraries in their RUNPATH.
1817 (define (cmake-snippet start)
1818 (string-append
1819 start
1820 "set_target_properties(${SWIG_MODULE_SimpleITK_TARGET_NAME} "
1821 "PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE "
1822 "INSTALL_RPATH \"" #$output "/lib\")\n"))
1823 (substitute* "Wrapping/Python/CMakeLists.txt"
1824 (("^set\\(SWIG_MODULE_SimpleITKPython.*" anchor)
1825 (cmake-snippet anchor)))
1826 (substitute* "Wrapping/R/CMakeLists.txt"
1827 (("^set\\(SWIG_MODULE_SimpleITKR.*" anchor)
1828 (cmake-snippet anchor)))))
1829 (add-after 'unpack 'patch-cmake-config-itk-path
1830 (lambda _
1831 ;; Allow building SimpleITK C++ projects without ITK installed
1832 ;; in the profile.
1833 #$(let*
1834 ((itk (this-package-input "insight-toolkit"))
1835 (itk-version (package-version itk))
1836 (itk-version-major+minor
1837 (version-major+minor itk-version)))
1838 #~(substitute* "SimpleITKConfig.cmake.in"
1839 (((string-append
1840 "find_package\\(ITK \"@ITK_VERSION@\" "
1841 "EXACT REQUIRED\\)"))
1842 (string-append
1843 "find_package(ITK \"" #$itk-version
1844 "\" EXACT REQUIRED PATHS " #$itk
1845 "/lib/cmake/ITK-"
1846 #$itk-version-major+minor ")"))))))
1847 (add-after 'install 'install-language-extension-modules
1848 (lambda _
1849 (with-directory-excursion "Wrapping/Python"
1850 (invoke "python3" "setup.py" "bdist_wheel")
1851 (apply invoke "pip" "--no-cache-dir" "--no-input" "install"
1852 "--no-deps" "--prefix" #$output:python
1853 (find-files "dist" "\\.whl$")))
1854 (let ((r-package-path
1855 (string-append #$output:r "/site-library/SimpleITK")))
1856 (mkdir-p r-package-path)
1857 (copy-recursively "Wrapping/R/R_libs/SimpleITK"
1858 r-package-path))))
1859 (delete 'check)
1860 (add-after 'install 'check-after-install
1861 ;; Run the tests when the SimpleITK libraries are where the
1862 ;; language extension modules expect them to be.
1863 (assoc-ref %standard-phases 'check)))))
1864 (home-page "https://simpleitk.org")
1865 (inputs (list insight-toolkit python r-minimal))
1866 (native-inputs
1867 (list googletest
1868 lua
1869 nss-certs-for-test ;for 'pip install'
1870 python-numpy ;for tests
1871 python-pip
1872 python-setuptools
1873 python-wheel
1874 swig-next
1875 (origin
1876 (method url-fetch)
1877 (uri (string-append
1878 "https://github.com/SimpleITK/SimpleITK/releases/download/v"
1879 version "/SimpleITKData-" version ".tar.gz"))
1880 (sha256
1881 (base32
1882 "13y44qqsgsvbrm84073i8clhggdgk8f36i6102sjg4j3fq790gal")))))
1883 (synopsis "Simplified interface to @acronym{ITK, Insight Toolkit}")
1884 (description
1885 "SimpleITK is an image analysis toolkit built on top of @acronym{ITK,
1886Insight Toolkit}. It provides a simplified interface to most of the
1887image filters and the input/output and registration frameworks in
1888@acronym{ITK, Insight Toolkit}. It is written in C++ and provides
1889bindings for interpreted languages. This package includes the C++,
1890Python and R interfaces.")
1891 (license license:asl2.0)))
1892
1893(define-public stiff
1894 (package
1895 (name "stiff")
1896 (version "2.4.0")
1897 (source
1898 (origin
1899 (method url-fetch)
1900 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1901 version ".tar.gz"))
1902 (sha256
1903 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1904 (build-system gnu-build-system)
1905 (inputs
1906 (list libtiff zlib libjpeg-turbo))
1907 (home-page "https://www.astromatic.net/software/stiff")
1908 (synopsis "Convert scientific FITS images to TIFF format")
1909 (description
1910 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1911Transport System} images to the more popular TIFF format for illustration
1912purposes.")
1913 (license license:gpl3+)))
1914
1915(define-public python-imgviz
1916 (package
1917 (name "python-imgviz")
1918 (version "1.7.6")
1919 (source
1920 (origin
1921 ;; PyPi tarball lacks tests.
1922 (method git-fetch)
1923 (uri (git-reference
1924 (url "https://github.com/wkentaro/imgviz")
1925 (commit (string-append "v" version))))
1926 (file-name (git-file-name name version))
1927 (sha256
1928 (base32 "0z7nwnvqh3hbbccf7v56398aiiwqs68kyrgc5vsmmh1cp4pwrgnb"))))
1929 (build-system pyproject-build-system)
1930 (arguments
1931 (list #:phases
1932 #~(modify-phases %standard-phases
1933 ;; LookupError: Error getting the version from source `vcs`:
1934 ;; setuptools-scm was unable to detect version for <...>
1935 (add-after 'unpack 'pretend-version
1936 (lambda _
1937 (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version))))))
1938 (native-inputs
1939 (list python-pytest
1940 python-hatchling
1941 python-hatch-vcs
1942 python-hatch-fancy-pypi-readme))
1943 (propagated-inputs
1944 (list python-matplotlib
1945 python-numpy
1946 python-pillow
1947 python-pyyaml))
1948 (home-page "http://github.com/wkentaro/imgviz")
1949 (synopsis "Image Visualization Tools")
1950 (description "Python library for object detection, semantic and instance
1951segmentation.")
1952 (license license:expat)))
1953
1954(define-public python-pims
1955 (package
1956 (name "python-pims")
1957 (version "0.7")
1958 (source
1959 (origin
1960 (method url-fetch)
1961 (uri (pypi-uri "pims" version))
1962 (sha256
1963 (base32 "0swlh8g4kf8p24g0ghkmwcj9y45rc59lmqx459nhhmhj6167m42m"))))
1964 (build-system pyproject-build-system)
1965 (arguments
1966 (list
1967 #:test-flags
1968 ;; We don't have all the (sometimes very large) data files, so we skip
1969 ;; these tests.
1970 '(list "--ignore=pims/tests/test_common.py"
1971 "--ignore=pims/tests/test_imseq.py"
1972 "--ignore=pims/tests/test_norpix.py")))
1973 (native-inputs
1974 (list python-pytest
1975 python-setuptools
1976 python-wheel))
1977 (propagated-inputs
1978 (list python-imageio python-numpy python-slicerator))
1979 (home-page "https://github.com/soft-matter/pims")
1980 (synopsis "Python Image Sequence")
1981 (description "Scientific video can be packaged in various ways: familiar
1982video formats like @file{.AVI} and @file{.MOV}, folders full of numbered
1983images, or \"stacks\" of TIFF images. Each of these requires a separate
1984Python module. And, once loaded, they have different methods for accessing
1985individual images, looping through the images in bulk, accessing a specific
1986range, or dealing with multidimensional files. PIMS can do all of these using
1987a consistent interface, handling the differences between different inputs
1988invisibly.")
1989 (license license:bsd-3)))
1990
1991(define-public python-spatial-image
1992 (package
1993 (name "python-spatial-image")
1994 (version "1.0.0")
1995 (source
1996 (origin
1997 (method url-fetch)
1998 (uri (pypi-uri "spatial_image" version))
1999 (sha256
2000 (base32 "0blyjwgv6bqpg7r3f4dcs7x27ysfm8n9y0zk5j7dxj74lma3wdsm"))))
2001 (build-system pyproject-build-system)
2002 (propagated-inputs (list python-numpy python-pytest python-pytest-mypy
2003 python-xarray python-xarray-dataclasses))
2004 (native-inputs (list python-flit-core python-pytest))
2005 (home-page "https://github.com/spatial-image/spatial-image")
2006 (synopsis "Multi-dimensional spatial image data structure")
2007 (description "This package implements a multi-dimensional spatial image
2008data structure for scientific Python.
2009
2010To facilitate:
2011
2012@itemize
2013@item Multi-scale processing and analysis
2014@item Registration
2015@item Resampling
2016@item Subregion parallel processing
2017@item Coupling with meshes, point sets, and annotations
2018@end itemize
2019
2020with scientific images, which are typically multi-dimensional with anisotropic
2021sampling, this package provides a spatial-image data structure. In addition
2022to an N-dimensional array of pixel values, spatial metadata defines the
2023location of the pixel sampling grid in space time. It also labels the array
2024dimensions. This metadata is easily utilized and carried through image
2025processing pipelines.")
2026 (license license:expat)))
2027
2028(define-public labelme
2029 (package
2030 (name "labelme")
2031 ;; It's the latest available version which does not require not packaged
2032 ;; <https://github.com/wkentaro/osam>.
2033 (version "5.2.1")
2034 (source
2035 (origin
2036 ;; PyPi tarball lacks tests.
2037 (method git-fetch)
2038 (uri (git-reference
2039 (url "https://github.com/wkentaro/labelme")
2040 (commit (string-append "v" version))))
2041 (file-name (git-file-name name version))
2042 (sha256
2043 (base32 "1xpyad6rlkxyx51jaai4xhdy15k1gvm62xnkjn152hc1vj1c77sr"))))
2044 (build-system pyproject-build-system)
2045 (arguments
2046 (list
2047 #:test-flags
2048 #~(list "-m" "not gpu"
2049 ;; Fails when invoking help2man for unknown reason.
2050 "--ignore=tests/docs_tests/man_tests/test_labelme_1.py")
2051 #:phases
2052 #~(modify-phases %standard-phases
2053 (add-before 'check 'start-xserver
2054 (lambda* (#:key inputs #:allow-other-keys)
2055 (let ((xorg-server #$(this-package-native-input "xorg-server")))
2056 ;; Options taken from CI workflow.
2057 (system (string-append xorg-server "/bin/Xvfb :99 -screen 0 "
2058 "1920x1200x24 -ac +extension GLX +render "
2059 "-noreset &"))
2060 (setenv "DISPLAY" ":99.0")))))))
2061 (native-inputs
2062 (list python-pytest
2063 python-pytest-qt
2064 python-setuptools
2065 xorg-server-for-tests))
2066 (propagated-inputs
2067 (list python-imgviz
2068 python-matplotlib
2069 python-natsort
2070 python-numpy
2071 python-pillow
2072 python-pyqt
2073 python-pyyaml
2074 python-qtpy
2075 python-termcolor))
2076 (home-page "https://github.com/wkentaro/labelme")
2077 (synopsis "Image Polygonal Annotation")
2078 (description
2079 "Image and video labeling tool supporting different shapes like polygons,
2080rectangles, circles, lines, points and VOC/COCO export.")
2081 (license license:gpl3+)))
2082
2083(define-public charls
2084 (package
2085 (name "charls")
2086 (version "2.4.2")
2087 (source (origin
2088 (method git-fetch)
2089 (uri (git-reference
2090 (url "https://github.com/team-charls/charls/")
2091 (commit (string-append version))))
2092 (file-name (git-file-name name version))
2093 (sha256
2094 (base32
2095 "0vp6mjjm6hi2r1swwvbg86asvn604w58nam7yvqk1qr13aizjl71"))))
2096 (build-system cmake-build-system)
2097 (arguments
2098 `(#:configure-flags '("-DCMAKE_BUILD_TYPE:STRING=Release"
2099 "-DBUILD_SHARED_LIBS=On")))
2100 (native-inputs (list git pkg-config))
2101 (home-page "https://github.com/team-charls/charls")
2102 (synopsis "Library for using JPEG-LS compliant images")
2103 (description
2104 "CharLS is a codec library that can be used to build applications that
2105can handle JPEG-LS compliant images. In the application you are writing you
2106can call the CharLS codec and pass it images (sometimes called raster bitmaps),
2107 to have them encoded to JPEG-LS, or JPEG-LS streams, which CharLS will decode
2108to images.")
2109 (license license:bsd-3)))
2110
2111(define-public libansilove
2112 (package
2113 (name "libansilove")
2114 (version "1.4.1")
2115 (source (origin
2116 (method git-fetch)
2117 (uri (git-reference
2118 (url "https://github.com/ansilove/libansilove")
2119 (commit (string-append version))))
2120 (file-name (git-file-name name version))
2121 (sha256
2122 (base32
2123 "169njlck4a2bmf1kmjas1w594hyda543ykdnwg7fwkviij39l9z6"))))
2124 (build-system cmake-build-system)
2125 (arguments
2126 (list #:tests? #f)) ; No tests included
2127 (native-inputs
2128 (list gd))
2129 (home-page "https://www.ansilove.org/")
2130 (synopsis "Library for converting ANSI, ASCII, and other formats to PNG")
2131 (description
2132 "libansilove is a library for converting artscene file types to PNG images,
2133including ANSI (.ANS) and many others. The library primarily serves to support
2134the ansilove tool.")
2135 (license license:bsd-2)))
2136
2137(define-public ansilove
2138 (package
2139 (name "ansilove")
2140 (version "4.2.0")
2141 (source (origin
2142 (method git-fetch)
2143 (uri (git-reference
2144 (url "https://github.com/ansilove/ansilove")
2145 (commit (string-append version))))
2146 (file-name (git-file-name name version))
2147 (sha256
2148 (base32
2149 "1h9r759krjl8wi68yxs1d46qfrx6v89a8vmmv3aqym8vn9x430kh"))))
2150 (build-system cmake-build-system)
2151 (native-inputs
2152 (list libansilove))
2153 (home-page "https://www.ansilove.org/")
2154 (synopsis "ANSI and ASCII art to PNG converter")
2155 (description
2156 "AnsiLove is an ANSI and ASCII art to PNG converter, allowing to convert
2157ANSI and artscene-related file formats into PNG images, supporting ANSI (.ANS),
2158PCBoard (.PCB), Binary (.BIN), Artworx (.ADF), iCE Draw (.IDF), Tundra (.TND)
2159and XBin (.XB) formats.")
2160 (license license:bsd-2)))