projects/guix·blob version-1.4.0 · refs

1473 lines · 56.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 John Darrington <[email protected]>
3;;; Copyright © 2017, 2019, 2022 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2014, 2021-2022 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 Efraim Flashner <[email protected]>
11;;; Copyright © 2020 Vincent Legoll <[email protected]>
12;;; Copyright © 2020, 2021 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 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 Maxim Cournoyer <[email protected]>
23;;; Copyright © 2022 Tomasz Jeneralczyk <[email protected]>
24;;;
25;;; This file is part of GNU Guix.
26;;;
27;;; GNU Guix is free software; you can redistribute it and/or modify it
28;;; under the terms of the GNU General Public License as published by
29;;; the Free Software Foundation; either version 3 of the License, or (at
30;;; your option) any later version.
31;;;
32;;; GNU Guix is distributed in the hope that it will be useful, but
33;;; WITHOUT ANY WARRANTY; without even the implied warranty of
34;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35;;; GNU General Public License for more details.
36;;;
37;;; You should have received a copy of the GNU General Public License
38;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
39
40(define-module (gnu packages image-processing)
41 #:use-module ((guix licenses) #:prefix license:)
42 #:use-module (guix packages)
43 #:use-module (guix gexp)
44 #:use-module (guix utils)
45 #:use-module (guix download)
46 #:use-module (guix git-download)
47 #:use-module (guix build-system qt)
48 #:use-module (guix build-system cmake)
49 #:use-module (guix build-system gnu)
50 #:use-module (guix build-system python)
51 #:use-module (gnu packages)
52 #:use-module (gnu packages algebra)
53 #:use-module (gnu packages bison)
54 #:use-module (gnu packages boost)
55 #:use-module (gnu packages check)
56 #:use-module (gnu packages compression)
57 #:use-module (gnu packages cpp)
58 #:use-module (gnu packages curl)
59 #:use-module (gnu packages docbook)
60 #:use-module (gnu packages documentation)
61 #:use-module (gnu packages flex)
62 #:use-module (gnu packages fontutils)
63 #:use-module (gnu packages geo)
64 #:use-module (gnu packages ghostscript)
65 #:use-module (gnu packages gimp)
66 #:use-module (gnu packages gl)
67 #:use-module (gnu packages glib)
68 #:use-module (gnu packages gnome)
69 #:use-module (gnu packages graphics)
70 #:use-module (gnu packages graphviz)
71 #:use-module (gnu packages gstreamer)
72 #:use-module (gnu packages gtk)
73 #:use-module (gnu packages icu4c)
74 #:use-module (gnu packages image)
75 #:use-module (gnu packages imagemagick)
76 #:use-module (gnu packages linux)
77 #:use-module (gnu packages maths)
78 #:use-module (gnu packages pdf)
79 #:use-module (gnu packages perl)
80 #:use-module (gnu packages photo)
81 #:use-module (gnu packages pkg-config)
82 #:use-module (gnu packages protobuf)
83 #:use-module (gnu packages python)
84 #:use-module (gnu packages python-check)
85 #:use-module (gnu packages python-xyz)
86 #:use-module (gnu packages qt)
87 #:use-module (gnu packages serialization)
88 #:use-module (gnu packages sqlite)
89 #:use-module (gnu packages tbb)
90 #:use-module (gnu packages textutils)
91 #:use-module (gnu packages tls)
92 #:use-module (gnu packages version-control)
93 #:use-module (gnu packages video)
94 #:use-module (gnu packages xiph)
95 #:use-module (gnu packages xml)
96 #:use-module (gnu packages xorg)
97 #:use-module (ice-9 match)
98 #:use-module (srfi srfi-1))
99
100;; TODO: this is not reproducible.
101(define-public bart
102 (package
103 (name "bart")
104 (version "0.8.00")
105 (source
106 (origin
107 (method git-fetch)
108 (uri (git-reference
109 (url "https://github.com/mrirecon/bart")
110 (commit "eacc67b95cf128487ecc48f0e6541ea4dca08818")))
111 (file-name (git-file-name name version))
112 (sha256
113 (base32 "05lcf7c3g7ms5h82bw1mi4kzkdv5wpqi1zrfhqfkgbcpd3irj6aq"))))
114 (build-system gnu-build-system)
115 (arguments
116 (list
117 #:test-target "utest"
118 #:make-flags #~(list
119 (string-append "PREFIX=" #$output)
120 "PARALLEL=1"
121 "PARALLEL_NJOBS=1"
122 "OPENBLAS=1"
123 "SCALAPACK=1"
124 (string-append "BLAS_BASE=" #$(this-package-input "openblas"))
125 (string-append "FFTW_BASE=" #$(this-package-input "fftw")))
126 #:parallel-build? #false ;leads to non-deterministic output
127 #:phases
128 #~(modify-phases %standard-phases
129 (delete 'configure)
130 (add-after 'unpack 'patch-/bin/bash
131 (lambda _
132 (substitute* "tests/pics.mk"
133 (("/bin/bash") (which "bash"))))))))
134 (inputs
135 (list fftw
136 fftwf
137 libpng
138 openblas
139 python
140 scalapack))
141 (native-inputs
142 (list doxygen
143 util-linux)) ;for flock
144 (home-page "https://mrirecon.github.io/bart/")
145 (synopsis "Toolbox for computational magnetic resonance imaging")
146 (description "The Berkeley Advanced Reconstruction Toolbox (BART) is an
147image-reconstruction framework for Computational Magnetic Resonance Imaging.
148The tools in this software implement various reconstruction algorithms for
149Magnetic Resonance Imaging.")
150 (license license:bsd-3)))
151
152(define-public dcmtk
153 (package
154 (name "dcmtk")
155 (version "3.6.7")
156 (source
157 (origin
158 (method url-fetch)
159 (uri
160 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
161 "dcmtk" (string-join (string-split version #\.) "")
162 "/dcmtk-" version ".tar.gz"))
163 (sha256
164 (base32 "02kix73qhndgb56cmi5327666i6imp7hi17wwqp26q4d7s72jn3w"))))
165 (build-system cmake-build-system)
166 (arguments
167 ;; By default, only static archives are built.
168 (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")))
169 (inputs
170 (list icu4c
171 libjpeg-turbo
172 libpng
173 libtiff
174 libxml2
175 openssl
176 zlib))
177 (native-inputs
178 (list doxygen)) ; for HTML documentation
179 (home-page "https://dcmtk.org")
180 (synopsis "Libraries and programs implementing parts of the DICOM standard")
181 (description "DCMTK is a collection of libraries and applications
182implementing large parts the DICOM standard. It includes software for
183examining, constructing and converting DICOM image files, handling offline
184media, sending and receiving images over a network connection, as well as
185demonstrative image storage and worklist servers.")
186 (license (license:fsf-free
187 "file://COPYRIGHT"
188 "A union of the Apache 2.0 licence and various non-copyleft
189licences similar to the Modified BSD licence."))))
190
191(define-public mia
192 (package
193 (name "mia")
194 (version "2.4.7")
195 (source (origin
196 (method url-fetch)
197 (uri (string-append "mirror://sourceforge/mia/mia/"
198 (version-major+minor version)
199 "/mia-" version ".tar.xz"))
200 (sha256
201 (base32
202 "0qpcd3n26q52dpyibm11f5l6cgscdr54p2jish39gc3p1f5h3ws1"))
203 (patches (search-patches "mia-fix-boost-headers.patch"
204 "mia-vtk9.patch"
205 "mia-vtk92.patch"
206 "mia-vtk-version.patch"))))
207 (build-system cmake-build-system)
208 (arguments
209 `(#:configure-flags
210 (list "-DMIA_CREATE_NIPYPE_INTERFACES=OFF"
211 "-DCMAKE_CXX_FLAGS=-fpermissive")))
212 (inputs
213 (list boost
214 dcmtk
215 doxygen
216 eigen
217 fftw
218 fftwf
219 gsl
220 gts
221 hdf5
222 itpp
223 libjpeg-turbo
224 libpng
225 libtiff
226 libxml2
227 libxml++
228 maxflow
229 niftilib
230 nlopt
231 openexr-2
232 python-lxml
233 vtk))
234 (native-inputs
235 (list pkg-config
236 python-wrapper))
237 (home-page "http://mia.sourceforge.net")
238 (synopsis "Toolkit for gray scale medical image analysis")
239 (description "MIA provides a combination of command line tools, plug-ins,
240and libraries that make it possible run image processing tasks interactively
241in a command shell and to prototype using the shell's scripting language. It
242is built around a plug-in structure that makes it easy to add functionality
243without compromising the original code base and it makes use of a wide variety
244of external libraries that provide additional functionality.")
245 (license license:gpl3+)))
246
247(define-public opencolorio
248 (package
249 (name "opencolorio")
250 (version "1.1.1")
251 (source
252 (origin
253 (method git-fetch)
254 (uri (git-reference
255 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
256 (commit (string-append "v" version))))
257 (sha256
258 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
259 (file-name (git-file-name name version))
260 (modules '((guix build utils)))
261 (snippet
262 `(begin
263 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
264 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
265 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
266 ;; When removing it, also remove it from the licence field comment.
267 (for-each delete-file-recursively
268 (filter
269 (lambda (full-name)
270 (let ((file (basename full-name)))
271 (not (or (string-prefix? "yaml-cpp-0.3" file)
272 (string=? "unittest.h" file)))))
273 (find-files "ext" ".*")))
274
275 #t))))
276 (build-system cmake-build-system)
277 (arguments
278 `(#:configure-flags
279 (list (string-append "-DCMAKE_CXX_FLAGS="
280 "-Wno-error=deprecated-declarations "
281 "-Wno-error=unused-function")
282 "-DOCIO_BUILD_STATIC=OFF"
283 ;; "-DUSE_EXTERNAL_YAML=ON"
284 "-DUSE_EXTERNAL_TINYXML=ON"
285 "-DUSE_EXTERNAL_LCMS=ON")
286 #:phases
287 (modify-phases %standard-phases
288 (add-after 'unpack 'patch-test-suite
289 (lambda _
290 (substitute* "src/core_tests/CMakeLists.txt"
291 (("/bin/sh") (which "bash")))
292 #t)))))
293 (native-inputs
294 (list git pkg-config))
295 (inputs
296 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
297 ;; ocioconvert fails: error: conflicting declaration ?typedef void
298 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
299 (list lcms openexr-2 tinyxml))
300 (home-page "https://opencolorio.org")
301 (synopsis "Color management for visual effects and animation")
302 (description
303 "OpenColorIO, or OCIO, is a complete color management solution geared
304towards motion picture production, with an emphasis on visual effects and
305computer animation. It provides a straightforward and consistent user
306experience across all supporting applications while allowing for sophisticated
307back-end configuration options suitable for high-end production usage.
308
309OCIO is compatible with the @acronym{ACES, Academy Color Encoding
310Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
311many popular formats.")
312 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
313 license:zlib ; src/core/md5
314 license:bsd-3)))) ; the rest
315
316(define-public vtk
317 (package
318 (name "vtk")
319 (version "9.2.2")
320 (source (origin
321 (method url-fetch)
322 (uri (string-append "https://vtk.org/files/release/"
323 (version-major+minor version)
324 "/VTK-" version ".tar.gz"))
325 (sha256
326 (base32
327 "0x8h2bwxq2870067j7wqd0qym87pa3inkbri93zrdb0zwwmhlnqw"))
328 (modules '((guix build utils)))
329 (snippet
330 '(begin
331 (for-each
332 (lambda (dir)
333 (delete-file-recursively
334 (string-append "ThirdParty/" dir "/vtk" dir)))
335 ;; pugixml depended upon unconditionally
336 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
337 "glew" "hdf5" "jpeg" "jsoncpp" "libharu" "libproj"
338 "libxml2" "lz4" "netcdf" "ogg" "png" "sqlite" "theora"
339 "tiff" "zlib"))
340 (substitute* "IO/ExportPDF/vtkPDFContextDevice2D.cxx"
341 (("\\bHPDF_UINT16 (noPen|dash|dot|denseDot|dashDot|dashDotDot)\\b"
342 _ var)
343 (string-append "HPDF_REAL " var)))))))
344 (properties `((release-monitoring-url . "https://vtk.org/download/")))
345 (build-system cmake-build-system)
346 (arguments
347 '(#:build-type "Release" ;Build without '-g' to save space.
348 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
349 ; ; not honored
350 "-DVTK_USE_EXTERNAL=OFF" ;; default
351 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
352 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
353 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
354 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
355 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
356 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
357 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
358 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
359 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
360 "-DVTK_MODULE_USE_EXTERNAL_VTK_libharu=ON"
361 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
362 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
363 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
364 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
365 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
366 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
367 ;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON" ; breaks IO/CityGML
368 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
369 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
370 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
371 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
372 "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" ; For F3D
373 "-DVTK_WRAP_PYTHON=ON"
374 "-DVTK_PYTHON_VERSION:STRING=3"
375 )
376 #:tests? #f)) ;XXX: test data not included
377 (inputs
378 (list double-conversion
379 eigen
380 expat
381 freetype
382 gl2ps
383 glew
384 glu
385 hdf5
386 libharu
387 libjpeg-turbo
388 jsoncpp
389 libtheora
390 libx11
391 libxml2
392 libxt
393 lz4
394 mesa
395 netcdf
396 libpng
397 proj-7
398 python
399 ;("pugixml" ,pugixml)
400 sqlite
401 libtiff
402 xorgproto
403 zlib))
404 (propagated-inputs
405 ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
406 ;; 'find_package(THEORA)', which in turns looks for libogg.
407 (list libogg))
408 (home-page "https://vtk.org/")
409 (synopsis "Libraries for 3D computer graphics")
410 (description
411 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
412image processing and visualization. It supports a wide variety of
413visualization algorithms including: scalar, vector, tensor, texture, and
414volumetric methods; and advanced modeling techniques such as: implicit
415modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
416triangulation. VTK has an extensive information visualization framework, has
417a suite of 3D interaction widgets, supports parallel processing, and
418integrates with various databases on GUI toolkits such as Qt and Tk.")
419 (license license:bsd-3)))
420
421(define-public vtk-7
422 (package
423 (inherit vtk)
424 (version "7.1.1")
425 (source (origin
426 (method url-fetch)
427 (uri (string-append "https://vtk.org/files/release/"
428 (version-major+minor version)
429 "/VTK-" version ".tar.gz"))
430 (sha256
431 (base32
432 "0nm7xwwj7rnsxjdv2ssviys8nhci4n9iiiqm2y14s520hl2dsp1d"))
433 (patches (search-patches "vtk-7-python-compat.patch"
434 "vtk-7-hdf5-compat.patch"
435 "vtk-7-gcc-10-compat.patch"))))
436 (arguments
437 (substitute-keyword-arguments (package-arguments vtk)
438 ((#:configure-flags flags)
439 ;; Otherwise, the build would fail with: "error: invalid conversion
440 ;; from ‘const char*’ to ‘char*’ [-fpermissive]".
441 `(cons "-DCMAKE_CXX_FLAGS=-fpermissive" ,flags))
442 ((#:phases phases)
443 #~(modify-phases #$phases
444 (add-after 'unpack 'remove-kernel-version
445 ;; Avoid embedding the kernel version for reproducible builds
446 (lambda _
447 (substitute*
448 "ThirdParty/hdf5/vtkhdf5/config/cmake/libhdf5.settings.cmake.in"
449 (("Host system: \\@CMAKE_HOST_SYSTEM\\@")
450 "Host system: @CMAKE_SYSTEM_NAME@"))))))))))
451
452(define-public opencv
453 (package
454 (name "opencv")
455 (version "4.5.4")
456 (source (origin
457 (method git-fetch)
458 (uri (git-reference
459 (url "https://github.com/opencv/opencv")
460 (commit version)))
461 (file-name (git-file-name name version))
462 (sha256
463 (base32
464 "0gf2xs3r4s51m20mpf0wdidpk0xzp3m2w6jx72fwldhn0pshlmcj"))
465 (modules '((guix build utils)))
466 (snippet
467 '(begin
468 ;; Remove external libraries. We have almost all available
469 ;; in Guix:
470 (with-directory-excursion "3rdparty"
471 (for-each delete-file-recursively
472 '("carotene"
473 "cpufeatures"
474 "ffmpeg"
475 "include"
476 "ippicv"
477 "ittnotify"
478 "libjasper"
479 "libjpeg"
480 "libjpeg-turbo"
481 "libpng"
482 "libtengine"
483 "libtiff"
484 "libwebp"
485 "openexr"
486 "openjpeg"
487 "openvx"
488 "protobuf"
489 ;;"quirc"
490 "tbb"
491 "zlib")))
492
493 ;; Milky icon set is non-free:
494 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
495
496 ;; Some jars found:
497 (for-each delete-file
498 '("modules/java/test/pure_test/lib/junit-4.11.jar"
499 "samples/java/sbt/sbt/sbt-launch.jar"))))))
500 (build-system cmake-build-system)
501 (arguments
502 `(#:configure-flags
503 (list "-DWITH_ADE=OFF" ;we don't have a package for ade yet
504 "-DWITH_IPP=OFF"
505 "-DWITH_ITT=OFF"
506 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
507 "-DENABLE_PRECOMPILED_HEADERS=OFF"
508 "-DOPENCV_GENERATE_PKGCONFIG=ON"
509
510 ;; CPU-Features:
511 ;; See cmake/OpenCVCompilerOptimizations.cmake
512 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
513 ;; BASELINE is the minimum optimization all CPUs must support
514 ;;
515 ;; DISPATCH is the list of optional dispatches.
516 "-DCPU_BASELINE=SSE2"
517
518 ;; Build Python bindings.
519 "-DBUILD_opencv_python3=ON"
520
521 ,@(match (%current-system)
522 ("x86_64-linux"
523 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
524 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
525 ("armhf-linux"
526 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
527 ("aarch64-linux"
528 '("-DCPU_BASELINE=NEON"
529 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
530 (_ '()))
531
532 "-DBUILD_PERF_TESTS=OFF"
533 "-DBUILD_TESTS=ON"
534
535 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
536 "/opencv-contrib/modules")
537
538 ;;Define test data:
539 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
540 "/opencv-extra/testdata")
541
542 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
543 ;; which we had removed, which would lead to an error:
544 "-DBUILD_PROTOBUF=OFF"
545
546 ;; Rebuild protobuf files, because we have a slightly different
547 ;; version than the included one. If we would not update, we
548 ;; would get a compile error later:
549 "-DPROTOBUF_UPDATE_FILES=ON"
550
551 ;; xfeatures2d disabled, because it downloads extra binaries from
552 ;; https://github.com/opencv/opencv_3rdparty
553 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
554 ;; Cmp this bug entry:
555 ;; https://github.com/opencv/opencv_contrib/issues/1131
556 "-DBUILD_opencv_xfeatures2d=OFF")
557 #:phases
558 (modify-phases %standard-phases
559 (add-after 'unpack 'disable-broken-tests
560 (lambda _
561 ;; This test fails with "unknown file: Failure"
562 ;; But I couldn't figure out which file was missing:
563 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
564 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
565 all pre post)
566 (string-append pre "DISABLED_" post)))
567
568 ;; This test fails with a comparison between the expected 396 and
569 ;; the actual 440 in file size.
570 (substitute* "modules/imgcodecs/test/test_exr.impl.hpp"
571 (("(TEST\\(Imgcodecs_EXR, )(readWrite_32FC1\\).*)" all pre post)
572 (string-append pre "DISABLED_" post)))
573
574 ;; These fail with protobuf parse errors that come from
575 ;; opencv-extra/testdata.
576 (substitute* "modules/dnn/test/test_layers.cpp"
577 (("(TEST_P\\(Test_Caffe_layers, )\
578(Accum\\).*|DataAugmentation\\).*|Resample\\).*|Correlation\\).*)" all pre post)
579 (string-append pre "DISABLED_" post)))))
580 (add-after 'unpack 'unpack-submodule-sources
581 (lambda* (#:key inputs #:allow-other-keys)
582 (mkdir "../opencv-extra")
583 (mkdir "../opencv-contrib")
584 (copy-recursively (assoc-ref inputs "opencv-extra")
585 "../opencv-extra")
586 (copy-recursively (assoc-ref inputs "opencv-contrib")
587 "../opencv-contrib")))
588 (add-after 'build 'do-not-install-3rdparty-file
589 (lambda _
590 (substitute* "cmake_install.cmake"
591 (("file\\(INSTALL .*source/3rdparty/include/opencl/LICENSE.txt.*") "\n"))))
592 (add-before 'check 'start-xserver
593 (lambda* (#:key inputs #:allow-other-keys)
594 (let ((xorg-server (assoc-ref inputs "xorg-server"))
595 (disp ":1"))
596 (setenv "HOME" (getcwd))
597 (setenv "DISPLAY" disp)
598 ;; There must be a running X server and make check doesn't start one.
599 ;; Therefore we must do it.
600 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
601 (native-inputs
602 `(("pkg-config" ,pkg-config)
603 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
604 ("opencv-extra"
605 ,(origin
606 (method git-fetch)
607 (uri (git-reference
608 (url "https://github.com/opencv/opencv_extra")
609 (commit version)))
610 (file-name (git-file-name "opencv_extra" version))
611 (sha256
612 (base32 "1fg2hxdvphdvagc2fkmhqk7qql9mp7pj2bmp8kmd7vicpr72qk82"))))
613 ("opencv-contrib"
614 ,(origin
615 (method git-fetch)
616 (uri (git-reference
617 (url "https://github.com/opencv/opencv_contrib")
618 (commit version)))
619 (file-name (git-file-name "opencv_contrib" version))
620 (sha256
621 (base32 "0ga0l4ranp1834gxgp487ll1amvmssa02l2nk5ja5w0rx4d8hh26"))))))
622 (inputs
623 (list ffmpeg
624 gtk+
625 gtkglext
626 hdf5
627 ilmbase
628 imath ;should be propagated by openexr
629 jasper
630 libgphoto2
631 libjpeg-turbo
632 libpng
633 libtiff
634 libwebp
635 openblas
636 openexr
637 openjpeg
638 protobuf
639 python
640 python-numpy
641 vtk
642 zlib))
643 ;; These three CVEs are not a problem of OpenCV, see:
644 ;; https://github.com/opencv/opencv/issues/10998
645 (properties '((lint-hidden-cve . ("CVE-2018-7712"
646 "CVE-2018-7713"
647 "CVE-2018-7714"))))
648 (synopsis "Computer vision library")
649 (description "OpenCV is a library aimed at real-time computer vision,
650including several hundred computer vision algorithms. It can be used to do
651things like:
652
653@itemize
654@item image and video input and output
655@item image and video processing
656@item displaying
657@item feature recognition
658@item segmentation
659@item facial recognition
660@item stereo vision
661@item structure from motion
662@item augmented reality
663@item machine learning
664@end itemize\n")
665 (home-page "https://opencv.org/")
666 (license license:bsd-3)))
667
668(define-public vips
669 (package
670 (name "vips")
671 (version "8.13.1")
672 (source
673 (origin
674 (method url-fetch)
675 (uri (string-append
676 "https://github.com/libvips/libvips/releases/download/v"
677 version "/vips-" version ".tar.gz"))
678 (sha256
679 (base32 "00kp3439jcqv9l2gcjg88xzvlq8clv54z1m3x66i3chvarz7ndxd"))))
680 (build-system gnu-build-system)
681 (native-inputs
682 (list gobject-introspection pkg-config))
683 (inputs
684 (list expat
685 fftw
686 giflib
687 glib
688 hdf5
689 imagemagick
690 lcms
691 libexif
692 libgsf
693 libjpeg-turbo
694 libpng
695 librsvg
696 libtiff
697 libxml2
698 libwebp
699 matio
700 niftilib
701 openexr-2
702 orc
703 pango
704 poppler))
705 (home-page "https://libvips.github.io/libvips/")
706 (synopsis "Multithreaded image processing system with low memory needs")
707 (description
708 "VIPS is a demand-driven, horizontally threaded image processing library.
709It's particularly good at processing large images, working with colour,
710scientific analysis, and general research & development.
711
712Compared to most image processing libraries VIPS needs little RAM and runs
713quickly, especially on machines with more than one CPU core. This is primarily
714due to its architecture which automatically parallelises the image workflows.")
715 (license license:lgpl2.1+)))
716
717(define-public gmic
718 (package
719 (name "gmic")
720 (version "3.0.0")
721 (source
722 (origin
723 (method url-fetch)
724 (uri (string-append "https://gmic.eu/files/source/gmic_"
725 version ".tar.gz"))
726 (sha256
727 (base32 "080inz0wisv3rhvbnzrgcs3j25wq86gybp68yi56gw6vwswnn19z"))))
728 (build-system cmake-build-system)
729 (arguments
730 `(#:tests? #f ;there are no tests
731 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
732 "-DENABLE_DYNAMIC_LINKING=ON"
733 "-DENABLE_LTO=ON")
734 #:phases
735 (modify-phases %standard-phases
736 (add-before 'configure 'set-LDFLAGS
737 (lambda* (#:key inputs outputs #:allow-other-keys)
738 (setenv "LDFLAGS"
739 (string-append
740 "-Wl,-rpath="
741 (assoc-ref outputs "out") "/lib")))))))
742 (native-inputs
743 (list pkg-config))
744 (inputs
745 (list curl
746 fftw
747 graphicsmagick
748 imath
749 libjpeg-turbo
750 libpng
751 libtiff
752 libx11
753 ;;opencv ;OpenCV is currently broken in the CI
754 openexr
755 zlib))
756 (home-page "https://gmic.eu/")
757 (synopsis "Full-featured framework for digital image processing")
758 (description "G'MIC is a full-featured framework for digital image
759processing. It provides several user interfaces to convert / manipulate
760/ filter / visualize generic image datasets, ranging from 1D scalar
761signals to 3D+t sequences of multi-spectral volumetric images, hence
762including 2D color images.")
763 ;; Dual-licensed, either license applies.
764 (license (list license:cecill license:cecill-c))))
765
766(define-public gmic-qt
767 (package
768 (inherit gmic)
769 (name "gmic-qt")
770 (arguments
771 (substitute-keyword-arguments (package-arguments gmic)
772 ((#:configure-flags _)
773 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
774 (string-append "-DGMIC_LIB_PATH="
775 (assoc-ref %build-inputs "gmic") "/lib")))
776 ((#:phases phases)
777 `(modify-phases ,phases
778 (add-after 'unpack 'qt-chdir
779 (lambda _ (chdir "gmic-qt") #t))))))
780 (native-inputs
781 (list pkg-config qttools-5))
782 (inputs
783 (modify-inputs (package-inputs gmic)
784 (prepend gmic qtbase-5)))
785 (synopsis "Qt frontend for the G'MIC image processing framework")
786 (license license:gpl3+)))
787
788(define-public gmic-qt-krita
789 (package
790 (inherit gmic-qt)
791 (name "gmic-qt-krita")
792 (arguments
793 (substitute-keyword-arguments (package-arguments gmic-qt)
794 ((#:configure-flags flags)
795 '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
796 (string-append "-DGMIC_LIB_PATH="
797 (assoc-ref %build-inputs "gmic") "/lib")))))
798 (synopsis "Krita plugin for the G'MIC image processing framework")))
799
800(define-public gmic-qt-gimp
801 (package
802 (inherit gmic-qt)
803 (name "gmic-qt-gimp")
804 (inputs
805 ;; GIMP and its dependencies.
806 (modify-inputs (package-inputs gmic-qt)
807 (prepend gimp gdk-pixbuf cairo gegl)))
808 (arguments
809 (substitute-keyword-arguments (package-arguments gmic-qt)
810 ((#:configure-flags flags)
811 '(list "-DGMIC_QT_HOST=gimp" "-DENABLE_DYNAMIC_LINKING=ON"
812 (string-append "-DGMIC_LIB_PATH="
813 (assoc-ref %build-inputs "gmic") "/lib")))))
814 (synopsis "GIMP plugin for the G'MIC image processing framework")))
815
816(define-public nip2
817 (package
818 (name "nip2")
819 (version "8.7.1")
820 (source
821 (origin
822 (method url-fetch)
823 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
824 version "/nip2-" version ".tar.gz" ))
825 (sha256
826 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
827 (build-system gnu-build-system)
828 (arguments
829 `(#:phases
830 (modify-phases %standard-phases
831 ;; test_conv.ws keep failing so disabling for now.
832 (add-after 'unpack 'disable-test-conv
833 (lambda _
834 (delete-file "test/workspaces/test_conv.ws")
835 #t))
836 (add-before 'check 'set-home
837 (lambda _
838 (setenv "HOME" "/tmp") #t)))))
839 (inputs
840 `(("vips" ,vips)
841 ("glib" ,glib)
842 ("libtiff" ,libtiff)
843 ("gtk+-2" ,gtk+-2)
844 ("libxml2" ,libxml2)
845 ("libexif" ,libexif)
846 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
847 ("librsvg" ,librsvg)
848 ("fftw" ,fftw)
849 ("libgsf" ,libgsf)
850 ("imagemagick" ,imagemagick)
851 ("orc" ,orc)
852 ("matio" ,matio)
853 ("lcms" ,lcms)
854 ("libwebp" ,libwebp)
855 ("openexr" ,openexr-2)
856 ("poppler" ,poppler)
857 ("gsl" ,gsl)))
858 (native-inputs
859 (list flex bison pkg-config))
860 (home-page "https://github.com/libvips/nip2")
861 (synopsis "Spreadsheet-like GUI for libvips")
862 (description "This package provide a graphical user interface (GUI) for
863the VIPS image processing library. It's a little like a spreadsheet: you
864create a set of formula connecting your objects together, and on a change nip2
865recalculates.")
866 (license license:gpl2+)))
867
868;; This package bundles and extends VTK. It also reuses the VTK build system
869;; to some degree. Sadly, it does not seem to be possible to build with an
870;; external VTK, despite the CMake option PARAVIEW_USE_EXTERNAL_VTK.
871(define-public paraview-5.9
872 (package
873 (name "paraview")
874 (version "5.9.1")
875 (source
876 (origin
877 (method url-fetch)
878 (uri (string-append "https://www.paraview.org/files/v"
879 (version-major+minor version)
880 "/ParaView-v" version ".tar.xz"))
881 (sha256
882 (base32 "13aczmfshzia324h9r2m675yyrklz2308rf98n444ppmzfv6qj0d"))))
883 (build-system qt-build-system)
884 (arguments
885 (list
886 #:build-type "Release" ;Build without debug symbols to save space
887 #:configure-flags
888 '(list "-DPARAVIEW_BUILD_WITH_EXTERNAL=ON"
889 "-DPARAVIEW_BUILD_SHARED_LIBS=ON"
890 "-DPARAVIEW_BUILD_DEVELOPER_DOCUMENTATION=OFF"
891 "-DPARAVIEW_USE_PYTHON=ON"
892 "-DPARAVIEW_ENABLE_FFMPEG=ON"
893 "-DPARAVIEW_ENABLE_GDAL=ON"
894 "-DPARAVIEW_ENABLE_WEB=OFF"
895
896 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
897 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
898 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
899 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
900 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
901 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
902 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
903 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
904 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
905 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
906 "-DVTK_MODULE_USE_EXTERNAL_VTK_lzma=ON"
907 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
908 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
909 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
910 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
911 "-DVTK_MODULE_USE_EXTERNAL_VTK_utf8=ON"
912 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
913
914 "-DVTK_MODULE_USE_EXTERNAL_ParaView_vtkcatalyst=OFF"
915 "-DVTK_MODULE_USE_EXTERNAL_VTK_cgns=OFF"
916 "-DVTK_MODULE_USE_EXTERNAL_VTK_exprtk=OFF"
917 "-DVTK_MODULE_USE_EXTERNAL_VTK_fmt=OFF"
918 "-DVTK_MODULE_USE_EXTERNAL_VTK_ioss=OFF")))
919 (inputs
920 (list ;; XXX: We can't simply #:use-module due to a cycle somewhere.
921 (module-ref
922 (resolve-interface '(gnu packages engineering))
923 'cgns)
924 cli11
925 double-conversion
926 eigen
927 expat
928 ffmpeg
929 freetype
930 gdal
931 gl2ps
932 glew
933 hdf5
934 jsoncpp
935 libharu
936 libjpeg-turbo
937 libpng
938 libtheora
939 libtiff
940 libxml2
941 lz4
942 mesa
943 netcdf
944 protobuf
945 pugixml
946 python
947 qtbase-5
948 qtsvg-5
949 qttools-5
950 qtxmlpatterns
951 utfcpp
952 zlib))
953 (home-page "https://www.paraview.org/")
954 (synopsis "Data analysis and visualization application")
955 (description "ParaView is a data analysis and visualization application.
956Users can quickly build visualizations to analyze their data using qualitative
957and quantitative techniques. The data exploration can be done interactively
958in 3D or programmatically using ParaView’s batch processing capabilities.")
959 (license license:bsd-3)))
960
961(define-public vxl
962 (package
963 (name "vxl")
964 (version "2.0.2")
965 (source
966 (origin
967 (method git-fetch)
968 (uri (git-reference
969 (url "https://github.com/vxl/vxl")
970 (commit (string-append "v" version))))
971 (file-name (git-file-name name version))
972 (sha256
973 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
974 (modules '((guix build utils)))
975 ;; TODO: vxl includes an old version of dcmtk. It won't build with
976 ;; version 3.6.x.
977 (snippet
978 '(begin
979 (for-each delete-file-recursively
980 '("v3p/bzlib/"
981 "v3p/geotiff/"
982 "v3p/jpeg/"
983 "v3p/png/"
984 "v3p/tiff/"
985 "v3p/zlib/"))
986 (substitute* "v3p/CMakeLists.txt"
987 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
988 ""))
989 #t))))
990 (build-system cmake-build-system)
991 (inputs
992 (list libgeotiff libtiff libjpeg-turbo libpng zlib))
993 (home-page "https://github.com/vxl/vxl/")
994 (synopsis "Collection of C++ libraries for computer vision")
995 (description "VXL (the Vision-something-Libraries) is a collection of C++
996libraries designed for computer vision research and implementation.")
997 (license license:bsd-3)))
998
999(define-public vxl-1
1000 (package (inherit vxl)
1001 (name "vxl")
1002 (version "1.18.0")
1003 (source
1004 (origin
1005 (method git-fetch)
1006 (uri (git-reference
1007 (url "https://github.com/vxl/vxl")
1008 (commit (string-append "v" version))))
1009 (file-name (git-file-name name version))
1010 (sha256
1011 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
1012 (modules '((guix build utils)))
1013 (snippet
1014 '(begin
1015 (for-each delete-file-recursively
1016 '("v3p/bzlib/"
1017 "v3p/geotiff/"
1018 "v3p/png/"
1019 "v3p/tiff/"
1020 "v3p/zlib/"))
1021 (substitute* "v3p/CMakeLists.txt"
1022 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
1023 ""))
1024 #t))))
1025 (arguments
1026 `(#:configure-flags
1027 ;; Needed for itk-snap
1028 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
1029
1030(define-public insight-toolkit
1031 (package
1032 (name "insight-toolkit")
1033 (version "5.0.0")
1034 (source
1035 (origin
1036 (method url-fetch)
1037 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
1038 "releases/download/v" version "/InsightToolkit-"
1039 version ".tar.xz"))
1040 (sha256
1041 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
1042 (build-system cmake-build-system)
1043 (arguments
1044 `(#:tests? #f ; tests require network access and external data
1045 #:configure-flags
1046 '("-DITK_USE_GPU=ON"
1047 "-DITK_USE_SYSTEM_LIBRARIES=ON"
1048 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
1049 "-DITK_BUILD_SHARED=ON"
1050 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
1051 ;; variable in the installed CMake files. This is necessary as other
1052 ;; packages using insight-toolkit could not be configured otherwise.
1053 "-DGTEST_ROOT=gtest")
1054
1055 #:phases
1056 (modify-phases %standard-phases
1057 (add-after 'unpack 'do-not-tune
1058 (lambda _
1059 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
1060 (("-mute=native") ""))
1061 #t)))))
1062 (inputs
1063 `(("eigen" ,eigen)
1064 ("expat" ,expat)
1065 ("fftw" ,fftw)
1066 ("fftwf" ,fftwf)
1067 ("hdf5" ,hdf5)
1068 ("libjpeg" ,libjpeg-turbo)
1069 ("libpng" ,libpng)
1070 ("libtiff" ,libtiff)
1071 ("mesa" ,mesa-opencl)
1072 ("perl" ,perl)
1073 ("python" ,python)
1074 ("tbb" ,tbb)
1075 ("vxl" ,vxl-1)
1076 ("zlib" ,zlib)))
1077 (native-inputs
1078 (list googletest pkg-config))
1079 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
1080 (synopsis "Scientific image processing, segmentation and registration")
1081 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
1082scientific image processing, segmentation, and registration. Segmentation is
1083the process of identifying and classifying data found in a digitally sampled
1084representation. Typically the sampled representation is an image acquired
1085from such medical instrumentation as CT or MRI scanners. Registration is the
1086task of aligning or developing correspondences between data. For example, in
1087the medical environment, a CT scan may be aligned with a MRI scan in order to
1088combine the information contained in both.")
1089 (license license:asl2.0)))
1090
1091(define-public insight-toolkit-4
1092 (package (inherit insight-toolkit)
1093 (version "4.13.2")
1094 (source
1095 (origin
1096 (method url-fetch)
1097 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
1098 "releases/download/v" version "/InsightToolkit-"
1099 version ".tar.xz"))
1100 (sha256
1101 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
1102 (arguments
1103 `(#:tests? #f ; tests require network access and external data
1104 #:configure-flags
1105 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
1106 "-DITK_USE_GPU=ON"
1107 "-DITK_USE_SYSTEM_LIBRARIES=ON"
1108 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
1109 "-DITK_USE_SYSTEM_VXL=ON")))))
1110
1111(define-public insight-toolkit-4.12
1112 (package (inherit insight-toolkit-4)
1113 (version "4.12.2")
1114 (source
1115 (origin
1116 (method url-fetch)
1117 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
1118 "InsightToolkit-" version ".tar.xz"))
1119 (sha256
1120 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
1121
1122(define-public itk-snap
1123 (package
1124 (name "itk-snap")
1125 (version "3.8.0")
1126 (source
1127 (origin
1128 (method git-fetch)
1129 (uri (git-reference
1130 (url "https://git.code.sf.net/p/itk-snap/src")
1131 (commit (string-append "v" version))))
1132 (file-name (git-file-name name version))
1133 (sha256
1134 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))
1135 (patches (search-patches "itk-snap-alt-glibc-compat.patch"))))
1136 (build-system cmake-build-system)
1137 (arguments
1138 `(#:configure-flags
1139 (list "-DSNAP_VERSION_GIT_SHA1=release"
1140 "-DSNAP_VERSION_GIT_BRANCH=release"
1141 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
1142 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
1143 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
1144 #:phases
1145 (modify-phases %standard-phases
1146 ;; During the installation phase all libraries provided by all
1147 ;; dependencies will be copied to the lib directory. That's insane,
1148 ;; so we disable this.
1149 (add-after 'unpack 'do-not-copy-dependencies
1150 (lambda _
1151 (substitute* "CMakeLists.txt"
1152 (("install_qt5_executable\
1153\\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
1154 ""))))
1155 (add-after 'unpack 'disable-gui-tests
1156 (lambda _
1157 ;; The GUI tests just time out.
1158 (substitute* "CMakeLists.txt"
1159 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
1160|RandomForest|RandomForestBailOut)")
1161 ""))))
1162 (add-after 'unpack 'make-reproducible
1163 (lambda _
1164 (substitute* "CMakeLists.txt"
1165 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
1166 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))))
1167 (add-after 'unpack 'prepare-submodules
1168 (lambda* (#:key inputs #:allow-other-keys)
1169 (rmdir "Submodules/c3d")
1170 (copy-recursively (assoc-ref inputs "c3d-src")
1171 "Submodules/c3d")
1172 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
1173 "Submodules/c3d/adapters/ApplyMetric.cxx")
1174 (("vcl_") "std::"))
1175 (rmdir "Submodules/greedy")
1176 (symlink (assoc-ref inputs "greedy-src")
1177 "Submodules/greedy")))
1178 (add-after 'unpack 'fix-includes
1179 (lambda _
1180 (substitute* "GUI/Model/RegistrationModel.cxx"
1181 (("<vnl_symmetric_eigensystem.h>")
1182 "<vnl/algo/vnl_symmetric_eigensystem.h>"))))
1183 (add-before 'check 'prepare-tests
1184 (lambda _
1185 ;; Needed by at least one test.
1186 (setenv "HOME" "/tmp")))
1187 (add-after 'install 'wrap-executable
1188 (lambda* (#:key inputs outputs #:allow-other-keys)
1189 (let ((out (assoc-ref outputs "out")))
1190 (wrap-program (string-append out "/bin/itksnap")
1191 `("QT_PLUGIN_PATH" ":" prefix
1192 ,(map (lambda (label)
1193 (string-append (assoc-ref inputs label)
1194 "/lib/qt5/plugins"))
1195 '("qtbase" "qtdeclarative-5"))))))))))
1196 (inputs
1197 (list curl
1198 fftw
1199 fftwf
1200 glu
1201 hdf5
1202 mesa-opencl
1203 ;; This package does not build with either insight-toolkit 5.0.0
1204 ;; and not with 4.13. It really needs to be 4.12.
1205 insight-toolkit-4.12
1206 vtk-7
1207 qtbase-5
1208 qtdeclarative-5
1209 vxl-1
1210 zlib))
1211 (native-inputs
1212 `(("googletest" ,googletest)
1213 ("qttools-5" ,qttools-5)
1214 ("pkg-config" ,pkg-config)
1215 ("c3d-src"
1216 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1217 (revision "1")
1218 (version (git-version "0" revision commit)))
1219 (origin
1220 (method git-fetch)
1221 (uri (git-reference
1222 (url "https://github.com/pyushkevich/c3d")
1223 (commit commit)))
1224 (file-name (git-file-name "c3d" version))
1225 (sha256
1226 (base32
1227 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1228 ;; We are using an arbitrary commit from 2017 because the latest
1229 ;; version breaks the build...
1230 ("greedy-src"
1231 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1232 (revision "1")
1233 (version (git-version "0" revision commit)))
1234 (origin
1235 (method git-fetch)
1236 (uri (git-reference
1237 (url "https://github.com/pyushkevich/greedy")
1238 (commit commit)))
1239 (file-name (git-file-name "greedy" version))
1240 (sha256
1241 (base32
1242 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1243 (home-page "https://sourceforge.net/p/itk-snap/")
1244 (synopsis "Medical image segmentation")
1245 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1246medical images. It provides an automatic active contour segmentation
1247pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1248full-featured UI aimed at clinical researchers.")
1249 ;; This includes the submodules greedy and c3d.
1250 (license license:gpl3+)))
1251
1252(define-public metapixel
1253 ;; Follow stable branch.
1254 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1255 (package
1256 (name "metapixel")
1257 (version (git-version "1.0.2" "1" commit))
1258 (source
1259 (origin
1260 (method git-fetch)
1261 (uri (git-reference
1262 (url "https://github.com/schani/metapixel")
1263 (commit commit)
1264 ;; TODO: Package rwimg and lispreader?
1265 (recursive? #t)))
1266 (file-name (git-file-name name version))
1267 (sha256
1268 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1269 (build-system gnu-build-system)
1270 (inputs
1271 `(("giflib" ,giflib)
1272 ("libjpeg" ,libjpeg-turbo)
1273 ("libpng" ,libpng)
1274 ("perl" ,perl)))
1275 (native-inputs
1276 `(("pkg-config" ,pkg-config)
1277 ("docbook-xml" ,docbook-xml)
1278 ("docbook-xsl" ,docbook-xsl)
1279 ("xsltproc" ,libxslt)))
1280 (arguments
1281 `(#:tests? #f ; No tests.
1282 #:make-flags (list
1283 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1284 (string-append "MANPAGE_XSL="
1285 (assoc-ref %build-inputs "docbook-xsl")
1286 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1287 #:phases
1288 (modify-phases %standard-phases
1289 (delete 'configure)
1290 (add-before 'install 'make-local-docbook-xml
1291 (lambda* (#:key inputs #:allow-other-keys)
1292 (substitute* "metapixel.xml"
1293 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1294 (string-append (assoc-ref inputs "docbook-xml")
1295 "/xml/dtd/docbook/docbookx.dtd")))
1296 #t))
1297 (add-before 'install 'fix-directory-creation
1298 (lambda* (#:key outputs #:allow-other-keys)
1299 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1300 #t)))))
1301 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1302 (synopsis "Photomosaics generator")
1303 (description "Metapixel is a program for generating photomosaics. It can
1304generate classical photomosaics, in which the source image is viewed as a
1305matrix of equally sized rectangles for each of which a matching image is
1306substituted, as well as collage-style photomosaics, in which rectangular parts
1307of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1308substituted by matching images.")
1309 (license license:gpl2))))
1310
1311(define-public scantailor-advanced
1312 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1313 (package
1314 (name "scantailor-advanced")
1315 (version (string-append "1.0.16-" (string-take commit 7)))
1316 (source
1317 (origin
1318 (method git-fetch)
1319 (uri (git-reference
1320 (url "https://github.com/4lex4/scantailor-advanced")
1321 (commit commit)))
1322 (file-name (git-file-name name version))
1323 (sha256
1324 (base32
1325 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1326 (build-system qt-build-system)
1327 (native-inputs
1328 (list qttools-5))
1329 (inputs
1330 `(("boost" ,boost)
1331 ("libjpeg" ,libjpeg-turbo)
1332 ("libpng" ,libpng)
1333 ("libtiff" ,libtiff)
1334 ("qtbase" ,qtbase-5)
1335 ("qtsvg-5" ,qtsvg-5)
1336 ("zlib" ,zlib)))
1337 (arguments
1338 `(#:phases
1339 (modify-phases %standard-phases
1340 ;; Some tests require a display and fail with offscreen mode.
1341 (add-after 'unpack 'disable-failing-tests
1342 (lambda _
1343 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1344 #t)))))
1345 (home-page "https://github.com/4lex4/scantailor-advanced")
1346 (synopsis "Clean up scanned pages")
1347 (description "Scan Tailor is an interactive post-processing tool for
1348scanned pages. It performs operations such as page splitting, deskewing,
1349adding/removing borders, and others. You give it raw scans, and you get pages
1350ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1351character recognition, and assembling multi-page documents are out of scope of
1352this project.
1353
1354Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1355and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1356 (license license:gpl3+))))
1357
1358(define-public stiff
1359 (package
1360 (name "stiff")
1361 (version "2.4.0")
1362 (source
1363 (origin
1364 (method url-fetch)
1365 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1366 version ".tar.gz"))
1367 (sha256
1368 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1369 (build-system gnu-build-system)
1370 (inputs
1371 (list libtiff zlib libjpeg-turbo))
1372 (home-page "https://www.astromatic.net/software/stiff")
1373 (synopsis "Convert scientific FITS images to TIFF format")
1374 (description
1375 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1376Transport System} images to the more popular TIFF format for illustration
1377purposes.")
1378 (license license:gpl3+)))
1379
1380(define-public python-imgviz
1381 (package
1382 (name "python-imgviz")
1383 (version "1.2.6")
1384 (source
1385 (origin
1386 ;; PyPi tarball lacks tests.
1387 (method git-fetch)
1388 (uri (git-reference
1389 (url "https://github.com/wkentaro/imgviz.git")
1390 (commit (string-append "v" version))))
1391 (file-name (git-file-name name version))
1392 (sha256
1393 (base32 "1bm0wdv5p26i8nl4kx3145cz553v401sgbpgc96sddzjfmfiydcw"))))
1394 (build-system python-build-system)
1395 (arguments
1396 `(#:phases
1397 (modify-phases %standard-phases
1398 (replace 'check
1399 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1400 (when tests?
1401 (add-installed-pythonpath inputs outputs)
1402 (invoke "pytest" "-v" "tests"))
1403 #t)))))
1404 (propagated-inputs
1405 (list python-matplotlib python-numpy python-pillow python-pyyaml))
1406 (native-inputs (list python-pytest))
1407 (home-page "http://github.com/wkentaro/imgviz")
1408 (synopsis "Image Visualization Tools")
1409 (description "Python library for object detection, semantic and instance
1410segmentation.")
1411 (license license:expat)))
1412
1413(define-public labelme
1414 (package
1415 (name "labelme")
1416 (version "4.5.13")
1417 (source
1418 (origin
1419 ;; PyPi tarball lacks tests.
1420 (method git-fetch)
1421 (uri (git-reference
1422 (url "https://github.com/wkentaro/labelme.git")
1423 (commit (string-append "v" version))))
1424 (file-name (git-file-name name version))
1425 (sha256
1426 (base32 "0cmi2xb4dgh7738l259rgwhn9l134f0vnaaqc2gflc5yr3lqhrv2"))))
1427 (build-system python-build-system)
1428 (arguments
1429 `(#:phases
1430 (modify-phases %standard-phases
1431 (add-after 'unpack 'loosen-requirements
1432 (lambda _
1433 ;; Don't require an outdated version of matplotlib.
1434 (substitute* "setup.py"
1435 (("matplotlib<3\\.3")
1436 "matplotlib"))))
1437 (add-before 'check 'start-xserver
1438 (lambda* (#:key inputs #:allow-other-keys)
1439 (let ((xorg-server (assoc-ref inputs "xorg-server")))
1440 ;; Options taken from CI workflow.
1441 (system (string-append xorg-server "/bin/Xvfb :99 -screen 0 "
1442 "1920x1200x24 -ac +extension GLX +render "
1443 "-noreset &"))
1444 (setenv "DISPLAY" ":99.0"))))
1445 (replace 'check
1446 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1447 (when tests?
1448 (add-installed-pythonpath inputs outputs)
1449 ;; Fails when invoking help2man for unknown reason.
1450 (delete-file "tests/docs_tests/man_tests/test_labelme_1.py")
1451 ;; One test hangs.
1452 (delete-file "tests/labelme_tests/widgets_tests/test_label_dialog.py")
1453 ;; Calls incompatible function signatures.
1454 (delete-file "tests/labelme_tests/widgets_tests/test_label_list_widget.py")
1455 (setenv "MPLBACKEND" "agg")
1456 (invoke "pytest" "-v" "tests" "-m" "not gpu")))))))
1457 (propagated-inputs
1458 (list python-imgviz
1459 python-matplotlib
1460 python-numpy
1461 python-pillow
1462 python-pyyaml
1463 python-qtpy
1464 python-termcolor))
1465 (native-inputs
1466 (list python-pytest python-pytest-qt xorg-server-for-tests))
1467 (home-page "https://github.com/wkentaro/labelme")
1468 (synopsis
1469 "Image Polygonal Annotation")
1470 (description
1471 "Image and video labeling tool supporting different shapes like
1472polygons, rectangles, circles, lines, points and VOC/COCO export.")
1473 (license license:gpl3+)))