1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2017, 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2014, 2021-2022 Ludovic Courtès <ludo@gnu.org>
5 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
7 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
9 ;;; Copyright © 2018 Lprndn <guix@lprndn.info>
10 ;;; Copyright © 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
11 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
12 ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
13 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
14 ;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
15 ;;; Copyright © 2021 Oleh Malyi <astroclubzp@gmail.com>
16 ;;; Copyright © 2021, 2022 Felix Gruber <felgru@posteo.net>
17 ;;; Copyright © 2021 Andy Tai <atai@atai.org>
18 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
19 ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
20 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
21 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
22 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
23 ;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
25 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 curl)
58 #:use-module (gnu packages docbook)
59 #:use-module (gnu packages documentation)
60 #:use-module (gnu packages flex)
61 #:use-module (gnu packages fontutils)
62 #:use-module (gnu packages geo)
63 #:use-module (gnu packages ghostscript)
64 #:use-module (gnu packages gimp)
65 #:use-module (gnu packages gl)
66 #:use-module (gnu packages glib)
67 #:use-module (gnu packages gnome)
68 #:use-module (gnu packages graphics)
69 #:use-module (gnu packages graphviz)
70 #:use-module (gnu packages gstreamer)
71 #:use-module (gnu packages gtk)
72 #:use-module (gnu packages icu4c)
73 #:use-module (gnu packages image)
74 #:use-module (gnu packages imagemagick)
75 #:use-module (gnu packages linux)
76 #:use-module (gnu packages maths)
77 #:use-module (gnu packages pdf)
78 #:use-module (gnu packages perl)
79 #:use-module (gnu packages photo)
80 #:use-module (gnu packages pkg-config)
81 #:use-module (gnu packages protobuf)
82 #:use-module (gnu packages python)
83 #:use-module (gnu packages python-check)
84 #:use-module (gnu packages python-xyz)
85 #:use-module (gnu packages qt)
86 #:use-module (gnu packages serialization)
87 #:use-module (gnu packages sqlite)
88 #:use-module (gnu packages tbb)
89 #:use-module (gnu packages tls)
90 #:use-module (gnu packages version-control)
91 #:use-module (gnu packages video)
92 #:use-module (gnu packages xiph)
93 #:use-module (gnu packages xml)
94 #:use-module (gnu packages xorg)
95 #:use-module (ice-9 match)
96 #:use-module (srfi srfi-1))
98 ;; TODO: this is not reproducible.
107 (url "https://github.com/mrirecon/bart")
108 (commit "d1b0e576c3f759089915565d5bf57832acf7b03e")))
109 (file-name (git-file-name name version))
111 (base32 "159rj3agr9pb9lg38b56rnw3d8wcbkmb2n718z26zpy4c6a6d9rn"))))
112 (build-system gnu-build-system)
115 #:test-target "utest"
117 (string-append "PREFIX=" #$output)
120 (string-append "BLAS_BASE=" #$(this-package-input "openblas"))
121 (string-append "FFTW_BASE=" #$(this-package-input "fftw")))
123 #~(modify-phases %standard-phases
125 (add-after 'unpack 'patch-/bin/bash
127 (substitute* "tests/pics.mk"
128 (("/bin/bash") (which "bash"))))))))
138 util-linux)) ;for flock
139 (home-page "https://mrirecon.github.io/bart/")
140 (synopsis "Toolbox for computational magnetic resonance imaging")
141 (description "The Berkeley Advanced Reconstruction Toolbox (BART) is an
142 image-reconstruction framework for Computational Magnetic Resonance Imaging.
143 The tools in this software implement various reconstruction algorithms for
144 Magnetic Resonance Imaging.")
145 (license license:bsd-3)))
155 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
156 "dcmtk" (string-join (string-split version #\.) "")
157 "/dcmtk-" version ".tar.gz"))
159 (base32 "02kix73qhndgb56cmi5327666i6imp7hi17wwqp26q4d7s72jn3w"))))
160 (build-system cmake-build-system)
162 ;; By default, only static archives are built.
163 (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")))
173 (list doxygen)) ; for HTML documentation
174 (home-page "https://dcmtk.org")
175 (synopsis "Libraries and programs implementing parts of the DICOM standard")
176 (description "DCMTK is a collection of libraries and applications
177 implementing large parts the DICOM standard. It includes software for
178 examining, constructing and converting DICOM image files, handling offline
179 media, sending and receiving images over a network connection, as well as
180 demonstrative image storage and worklist servers.")
181 (license (license:fsf-free
183 "A union of the Apache 2.0 licence and various non-copyleft
184 licences similar to the Modified BSD licence."))))
192 (uri (string-append "mirror://sourceforge/mia/mia/"
193 (version-major+minor version)
194 "/mia-" version ".tar.xz"))
197 "0qpcd3n26q52dpyibm11f5l6cgscdr54p2jish39gc3p1f5h3ws1"))
198 (patches (search-patches "mia-fix-boost-headers.patch"
200 (build-system cmake-build-system)
203 (list "-DMIA_CREATE_NIPYPE_INTERFACES=OFF"
204 "-DCMAKE_CXX_FLAGS=-fpermissive")))
230 (home-page "http://mia.sourceforge.net")
231 (synopsis "Toolkit for gray scale medical image analysis")
232 (description "MIA provides a combination of command line tools, plug-ins,
233 and libraries that make it possible run image processing tasks interactively
234 in a command shell and to prototype using the shell's scripting language. It
235 is built around a plug-in structure that makes it easy to add functionality
236 without compromising the original code base and it makes use of a wide variety
237 of external libraries that provide additional functionality.")
238 (license license:gpl3+)))
240 (define-public opencolorio
248 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
249 (commit (string-append "v" version))))
251 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
252 (file-name (git-file-name name version))
253 (modules '((guix build utils)))
256 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
257 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
258 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
259 ;; When removing it, also remove it from the licence field comment.
260 (for-each delete-file-recursively
263 (let ((file (basename full-name)))
264 (not (or (string-prefix? "yaml-cpp-0.3" file)
265 (string=? "unittest.h" file)))))
266 (find-files "ext" ".*")))
269 (build-system cmake-build-system)
272 (list (string-append "-DCMAKE_CXX_FLAGS="
273 "-Wno-error=deprecated-declarations "
274 "-Wno-error=unused-function")
275 "-DOCIO_BUILD_STATIC=OFF"
276 ;; "-DUSE_EXTERNAL_YAML=ON"
277 "-DUSE_EXTERNAL_TINYXML=ON"
278 "-DUSE_EXTERNAL_LCMS=ON")
280 (modify-phases %standard-phases
281 (add-after 'unpack 'patch-test-suite
283 (substitute* "src/core_tests/CMakeLists.txt"
284 (("/bin/sh") (which "bash")))
287 (list git pkg-config))
289 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
290 ;; ocioconvert fails: error: conflicting declaration ?typedef void
291 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
292 (list lcms openexr-2 tinyxml))
293 (home-page "https://opencolorio.org")
294 (synopsis "Color management for visual effects and animation")
296 "OpenColorIO, or OCIO, is a complete color management solution geared
297 towards motion picture production, with an emphasis on visual effects and
298 computer animation. It provides a straightforward and consistent user
299 experience across all supporting applications while allowing for sophisticated
300 back-end configuration options suitable for high-end production usage.
302 OCIO is compatible with the @acronym{ACES, Academy Color Encoding
303 Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
304 many popular formats.")
305 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
306 license:zlib ; src/core/md5
307 license:bsd-3)))) ; the rest
315 (uri (string-append "https://vtk.org/files/release/"
316 (version-major+minor version)
317 "/VTK-" version ".tar.gz"))
320 "1ir2lq9i45ls374lcmjzw0nrm5l5hnm1w47lg8g8d0n2j7hsaf8v"))
322 (search-patches "vtk-fix-freetypetools-build-failure.patch"))
323 (modules '((guix build utils)))
328 (delete-file-recursively
329 (string-append "ThirdParty/" dir "/vtk" dir)))
330 ;; pugixml depended upon unconditionally
331 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
332 "glew" "hdf5" "jpeg" "jsoncpp" "libharu" "libproj"
333 "libxml2" "lz4" "netcdf" "ogg" "png" "sqlite" "theora"
335 (substitute* "IO/ExportPDF/vtkPDFContextDevice2D.cxx"
336 (("\\bHPDF_UINT16 (noPen|dash|dot|denseDot|dashDot|dashDotDot)\\b"
338 (string-append "HPDF_REAL " var)))))))
339 (properties `((release-monitoring-url . "https://vtk.org/download/")))
340 (build-system cmake-build-system)
342 '(#:build-type "Release" ;Build without '-g' to save space.
343 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
345 "-DVTK_USE_EXTERNAL=OFF" ;; default
346 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
347 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
348 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
349 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
350 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
351 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
352 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
353 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
354 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
355 "-DVTK_MODULE_USE_EXTERNAL_VTK_libharu=ON"
356 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
357 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
358 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
359 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
360 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
361 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
362 ;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON" ; breaks IO/CityGML
363 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
364 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
365 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
366 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
367 "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" ; For F3D
368 "-DVTK_WRAP_PYTHON=ON"
369 "-DVTK_PYTHON_VERSION:STRING=3"
372 (modify-phases %standard-phases
373 (add-after 'unpack 'patch-sources
375 (substitute* "Common/Core/vtkFloatingPointExceptions.cxx"
376 (("<fenv.h>") "<cfenv>"))
377 (substitute* "Common/Core/CMakeLists.txt"
378 (("fenv.h") "cfenv")))))
379 #:tests? #f)) ;XXX: test data not included
381 (list double-conversion
402 ;("pugixml" ,pugixml)
408 ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
409 ;; 'find_package(THEORA)', which in turns looks for libogg.
411 (home-page "https://vtk.org/")
412 (synopsis "Libraries for 3D computer graphics")
414 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
415 image processing and visualization. It supports a wide variety of
416 visualization algorithms including: scalar, vector, tensor, texture, and
417 volumetric methods; and advanced modeling techniques such as: implicit
418 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
419 triangulation. VTK has an extensive information visualization framework, has
420 a suite of 3D interaction widgets, supports parallel processing, and
421 integrates with various databases on GUI toolkits such as Qt and Tk.")
422 (license license:bsd-3)))
430 (uri (string-append "https://vtk.org/files/release/"
431 (version-major+minor version)
432 "/VTK-" version ".tar.gz"))
435 "0nm7xwwj7rnsxjdv2ssviys8nhci4n9iiiqm2y14s520hl2dsp1d"))
436 (patches (search-patches "vtk-7-python-compat.patch"
437 "vtk-7-hdf5-compat.patch"
438 "vtk-7-gcc-10-compat.patch"))))
440 (substitute-keyword-arguments (package-arguments vtk)
441 ((#:configure-flags flags)
442 ;; Otherwise, the build would fail with: "error: invalid conversion
443 ;; from ‘const char*’ to ‘char*’ [-fpermissive]".
444 `(cons "-DCMAKE_CXX_FLAGS=-fpermissive" ,flags))
446 #~(modify-phases #$phases
447 (add-after 'unpack 'remove-kernel-version
448 ;; Avoid embedding the kernel version for reproducible builds
451 "ThirdParty/hdf5/vtkhdf5/config/cmake/libhdf5.settings.cmake.in"
452 (("Host system: \\@CMAKE_HOST_SYSTEM\\@")
453 "Host system: @CMAKE_SYSTEM_NAME@"))))))))))
455 (define-public opencv
462 (url "https://github.com/opencv/opencv")
464 (file-name (git-file-name name version))
467 "0gf2xs3r4s51m20mpf0wdidpk0xzp3m2w6jx72fwldhn0pshlmcj"))
468 (modules '((guix build utils)))
471 ;; Remove external libraries. We have almost all available
473 (with-directory-excursion "3rdparty"
474 (for-each delete-file-recursively
496 ;; Milky icon set is non-free:
497 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
500 (for-each delete-file
501 '("modules/java/test/pure_test/lib/junit-4.11.jar"
502 "samples/java/sbt/sbt/sbt-launch.jar"))))))
503 (build-system cmake-build-system)
506 (list "-DWITH_ADE=OFF" ;we don't have a package for ade yet
509 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
510 "-DENABLE_PRECOMPILED_HEADERS=OFF"
511 "-DOPENCV_GENERATE_PKGCONFIG=ON"
514 ;; See cmake/OpenCVCompilerOptimizations.cmake
515 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
516 ;; BASELINE is the minimum optimization all CPUs must support
518 ;; DISPATCH is the list of optional dispatches.
519 "-DCPU_BASELINE=SSE2"
521 ;; Build Python bindings.
522 "-DBUILD_opencv_python3=ON"
524 ,@(match (%current-system)
526 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
527 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
529 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
531 '("-DCPU_BASELINE=NEON"
532 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
535 "-DBUILD_PERF_TESTS=OFF"
538 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
539 "/opencv-contrib/modules")
542 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
543 "/opencv-extra/testdata")
545 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
546 ;; which we had removed, which would lead to an error:
547 "-DBUILD_PROTOBUF=OFF"
549 ;; Rebuild protobuf files, because we have a slightly different
550 ;; version than the included one. If we would not update, we
551 ;; would get a compile error later:
552 "-DPROTOBUF_UPDATE_FILES=ON"
554 ;; xfeatures2d disabled, because it downloads extra binaries from
555 ;; https://github.com/opencv/opencv_3rdparty
556 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
557 ;; Cmp this bug entry:
558 ;; https://github.com/opencv/opencv_contrib/issues/1131
559 "-DBUILD_opencv_xfeatures2d=OFF")
561 (modify-phases %standard-phases
562 (add-after 'unpack 'disable-broken-tests
564 ;; This test fails with "unknown file: Failure"
565 ;; But I couldn't figure out which file was missing:
566 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
567 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
569 (string-append pre "DISABLED_" post)))
571 ;; This test fails with a comparison between the expected 396 and
572 ;; the actual 440 in file size.
573 (substitute* "modules/imgcodecs/test/test_exr.impl.hpp"
574 (("(TEST\\(Imgcodecs_EXR, )(readWrite_32FC1\\).*)" all pre post)
575 (string-append pre "DISABLED_" post)))
577 ;; These fail with protobuf parse errors that come from
578 ;; opencv-extra/testdata.
579 (substitute* "modules/dnn/test/test_layers.cpp"
580 (("(TEST_P\\(Test_Caffe_layers, )\
581 (Accum\\).*|DataAugmentation\\).*|Resample\\).*|Correlation\\).*)" all pre post)
582 (string-append pre "DISABLED_" post)))))
583 (add-after 'unpack 'unpack-submodule-sources
584 (lambda* (#:key inputs #:allow-other-keys)
585 (mkdir "../opencv-extra")
586 (mkdir "../opencv-contrib")
587 (copy-recursively (assoc-ref inputs "opencv-extra")
589 (copy-recursively (assoc-ref inputs "opencv-contrib")
590 "../opencv-contrib")))
591 (add-after 'build 'do-not-install-3rdparty-file
593 (substitute* "cmake_install.cmake"
594 (("file\\(INSTALL .*source/3rdparty/include/opencl/LICENSE.txt.*") "\n"))))
595 (add-before 'check 'start-xserver
596 (lambda* (#:key inputs #:allow-other-keys)
597 (let ((xorg-server (assoc-ref inputs "xorg-server"))
599 (setenv "HOME" (getcwd))
600 (setenv "DISPLAY" disp)
601 ;; There must be a running X server and make check doesn't start one.
602 ;; Therefore we must do it.
603 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
605 `(("pkg-config" ,pkg-config)
606 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
611 (url "https://github.com/opencv/opencv_extra")
613 (file-name (git-file-name "opencv_extra" version))
615 (base32 "1fg2hxdvphdvagc2fkmhqk7qql9mp7pj2bmp8kmd7vicpr72qk82"))))
620 (url "https://github.com/opencv/opencv_contrib")
622 (file-name (git-file-name "opencv_contrib" version))
624 (base32 "0ga0l4ranp1834gxgp487ll1amvmssa02l2nk5ja5w0rx4d8hh26"))))))
631 imath ;should be propagated by openexr
646 ;; These three CVEs are not a problem of OpenCV, see:
647 ;; https://github.com/opencv/opencv/issues/10998
648 (properties '((lint-hidden-cve . ("CVE-2018-7712"
651 (synopsis "Computer vision library")
652 (description "OpenCV is a library aimed at real-time computer vision,
653 including several hundred computer vision algorithms. It can be used to do
657 @item image and video input and output
658 @item image and video processing
660 @item feature recognition
662 @item facial recognition
664 @item structure from motion
665 @item augmented reality
666 @item machine learning
668 (home-page "https://opencv.org/")
669 (license license:bsd-3)))
679 "https://github.com/libvips/libvips/releases/download/v"
680 version "/vips-" version ".tar.gz"))
682 (base32 "00kp3439jcqv9l2gcjg88xzvlq8clv54z1m3x66i3chvarz7ndxd"))))
683 (build-system gnu-build-system)
685 (list gobject-introspection pkg-config))
708 (home-page "https://libvips.github.io/libvips/")
709 (synopsis "Multithreaded image processing system with low memory needs")
711 "VIPS is a demand-driven, horizontally threaded image processing library.
712 It's particularly good at processing large images, working with colour,
713 scientific analysis, and general research & development.
715 Compared to most image processing libraries VIPS needs little RAM and runs
716 quickly, especially on machines with more than one CPU core. This is primarily
717 due to its architecture which automatically parallelises the image workflows.")
718 (license license:lgpl2.1+)))
727 (uri (string-append "https://gmic.eu/files/source/gmic_"
730 (base32 "080inz0wisv3rhvbnzrgcs3j25wq86gybp68yi56gw6vwswnn19z"))))
731 (build-system cmake-build-system)
733 `(#:tests? #f ;there are no tests
734 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
735 "-DENABLE_DYNAMIC_LINKING=ON"
738 (modify-phases %standard-phases
739 (add-before 'configure 'set-LDFLAGS
740 (lambda* (#:key inputs outputs #:allow-other-keys)
744 (assoc-ref outputs "out") "/lib")))))))
756 ;;opencv ;OpenCV is currently broken in the CI
759 (home-page "https://gmic.eu/")
760 (synopsis "Full-featured framework for digital image processing")
761 (description "G'MIC is a full-featured framework for digital image
762 processing. It provides several user interfaces to convert / manipulate
763 / filter / visualize generic image datasets, ranging from 1D scalar
764 signals to 3D+t sequences of multi-spectral volumetric images, hence
765 including 2D color images.")
766 ;; Dual-licensed, either license applies.
767 (license (list license:cecill license:cecill-c))))
769 (define-public gmic-qt
774 (substitute-keyword-arguments (package-arguments gmic)
775 ((#:configure-flags _)
776 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
777 (string-append "-DGMIC_LIB_PATH="
778 (assoc-ref %build-inputs "gmic") "/lib")))
780 `(modify-phases ,phases
781 (add-after 'unpack 'qt-chdir
782 (lambda _ (chdir "gmic-qt") #t))))))
784 (list pkg-config qttools-5))
786 (modify-inputs (package-inputs gmic)
787 (prepend gmic qtbase-5)))
788 (synopsis "Qt frontend for the G'MIC image processing framework")
789 (license license:gpl3+)))
791 (define-public gmic-qt-krita
794 (name "gmic-qt-krita")
796 (substitute-keyword-arguments (package-arguments gmic-qt)
797 ((#:configure-flags flags)
798 '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
799 (string-append "-DGMIC_LIB_PATH="
800 (assoc-ref %build-inputs "gmic") "/lib")))))
801 (synopsis "Krita plugin for the G'MIC image processing framework")))
803 (define-public gmic-qt-gimp
806 (name "gmic-qt-gimp")
808 ;; GIMP and its dependencies.
809 (modify-inputs (package-inputs gmic-qt)
810 (prepend gimp gdk-pixbuf cairo gegl)))
812 (substitute-keyword-arguments (package-arguments gmic-qt)
813 ((#:configure-flags flags)
814 '(list "-DGMIC_QT_HOST=gimp" "-DENABLE_DYNAMIC_LINKING=ON"
815 (string-append "-DGMIC_LIB_PATH="
816 (assoc-ref %build-inputs "gmic") "/lib")))))
817 (synopsis "GIMP plugin for the G'MIC image processing framework")))
826 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
827 version "/nip2-" version ".tar.gz" ))
829 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
830 (build-system gnu-build-system)
833 (modify-phases %standard-phases
834 ;; test_conv.ws keep failing so disabling for now.
835 (add-after 'unpack 'disable-test-conv
837 (delete-file "test/workspaces/test_conv.ws")
839 (add-before 'check 'set-home
841 (setenv "HOME" "/tmp") #t)))))
849 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
853 ("imagemagick" ,imagemagick)
858 ("openexr" ,openexr-2)
862 (list flex bison pkg-config))
863 (home-page "https://github.com/libvips/nip2")
864 (synopsis "Spreadsheet-like GUI for libvips")
865 (description "This package provide a graphical user interface (GUI) for
866 the VIPS image processing library. It's a little like a spreadsheet: you
867 create a set of formula connecting your objects together, and on a change nip2
869 (license license:gpl2+)))
879 (url "https://github.com/vxl/vxl")
880 (commit (string-append "v" version))))
881 (file-name (git-file-name name version))
883 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
884 (modules '((guix build utils)))
885 ;; TODO: vxl includes an old version of dcmtk. It won't build with
889 (for-each delete-file-recursively
896 (substitute* "v3p/CMakeLists.txt"
897 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
900 (build-system cmake-build-system)
902 (list libgeotiff libtiff libjpeg-turbo libpng zlib))
903 (home-page "https://github.com/vxl/vxl/")
904 (synopsis "Collection of C++ libraries for computer vision")
905 (description "VXL (the Vision-something-Libraries) is a collection of C++
906 libraries designed for computer vision research and implementation.")
907 (license license:bsd-3)))
910 (package (inherit vxl)
917 (url "https://github.com/vxl/vxl")
918 (commit (string-append "v" version))))
919 (file-name (git-file-name name version))
921 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
922 (modules '((guix build utils)))
925 (for-each delete-file-recursively
931 (substitute* "v3p/CMakeLists.txt"
932 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
937 ;; Needed for itk-snap
938 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
940 (define-public insight-toolkit
942 (name "insight-toolkit")
947 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
948 "releases/download/v" version "/InsightToolkit-"
951 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
952 (build-system cmake-build-system)
954 `(#:tests? #f ; tests require network access and external data
957 "-DITK_USE_SYSTEM_LIBRARIES=ON"
958 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
959 "-DITK_BUILD_SHARED=ON"
960 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
961 ;; variable in the installed CMake files. This is necessary as other
962 ;; packages using insight-toolkit could not be configured otherwise.
963 "-DGTEST_ROOT=gtest")
966 (modify-phases %standard-phases
967 (add-after 'unpack 'do-not-tune
969 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
970 (("-mute=native") ""))
978 ("libjpeg" ,libjpeg-turbo)
981 ("mesa" ,mesa-opencl)
988 (list googletest pkg-config))
989 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
990 (synopsis "Scientific image processing, segmentation and registration")
991 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
992 scientific image processing, segmentation, and registration. Segmentation is
993 the process of identifying and classifying data found in a digitally sampled
994 representation. Typically the sampled representation is an image acquired
995 from such medical instrumentation as CT or MRI scanners. Registration is the
996 task of aligning or developing correspondences between data. For example, in
997 the medical environment, a CT scan may be aligned with a MRI scan in order to
998 combine the information contained in both.")
999 (license license:asl2.0)))
1001 (define-public insight-toolkit-4
1002 (package (inherit insight-toolkit)
1007 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
1008 "releases/download/v" version "/InsightToolkit-"
1011 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
1013 `(#:tests? #f ; tests require network access and external data
1015 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
1017 "-DITK_USE_SYSTEM_LIBRARIES=ON"
1018 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
1019 "-DITK_USE_SYSTEM_VXL=ON")))))
1021 (define-public insight-toolkit-4.12
1022 (package (inherit insight-toolkit-4)
1027 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
1028 "InsightToolkit-" version ".tar.xz"))
1030 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
1032 (define-public itk-snap
1040 (url "https://git.code.sf.net/p/itk-snap/src")
1041 (commit (string-append "v" version))))
1042 (file-name (git-file-name name version))
1044 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))
1045 (patches (search-patches "itk-snap-alt-glibc-compat.patch"))))
1046 (build-system cmake-build-system)
1049 (list "-DSNAP_VERSION_GIT_SHA1=release"
1050 "-DSNAP_VERSION_GIT_BRANCH=release"
1051 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
1052 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
1053 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
1055 (modify-phases %standard-phases
1056 ;; During the installation phase all libraries provided by all
1057 ;; dependencies will be copied to the lib directory. That's insane,
1058 ;; so we disable this.
1059 (add-after 'unpack 'do-not-copy-dependencies
1061 (substitute* "CMakeLists.txt"
1062 (("install_qt5_executable\
1063 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
1065 (add-after 'unpack 'disable-gui-tests
1067 ;; The GUI tests just time out.
1068 (substitute* "CMakeLists.txt"
1069 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
1070 |RandomForest|RandomForestBailOut)")
1072 (add-after 'unpack 'make-reproducible
1074 (substitute* "CMakeLists.txt"
1075 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
1076 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))))
1077 (add-after 'unpack 'prepare-submodules
1078 (lambda* (#:key inputs #:allow-other-keys)
1079 (rmdir "Submodules/c3d")
1080 (copy-recursively (assoc-ref inputs "c3d-src")
1082 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
1083 "Submodules/c3d/adapters/ApplyMetric.cxx")
1085 (rmdir "Submodules/greedy")
1086 (symlink (assoc-ref inputs "greedy-src")
1087 "Submodules/greedy")))
1088 (add-after 'unpack 'fix-includes
1090 (substitute* "GUI/Model/RegistrationModel.cxx"
1091 (("<vnl_symmetric_eigensystem.h>")
1092 "<vnl/algo/vnl_symmetric_eigensystem.h>"))))
1093 (add-before 'check 'prepare-tests
1095 ;; Needed by at least one test.
1096 (setenv "HOME" "/tmp")))
1097 (add-after 'install 'wrap-executable
1098 (lambda* (#:key inputs outputs #:allow-other-keys)
1099 (let ((out (assoc-ref outputs "out")))
1100 (wrap-program (string-append out "/bin/itksnap")
1101 `("QT_PLUGIN_PATH" ":" prefix
1102 ,(map (lambda (label)
1103 (string-append (assoc-ref inputs label)
1104 "/lib/qt5/plugins"))
1105 '("qtbase" "qtdeclarative-5"))))))))))
1113 ;; This package does not build with either insight-toolkit 5.0.0
1114 ;; and not with 4.13. It really needs to be 4.12.
1115 insight-toolkit-4.12
1122 `(("googletest" ,googletest)
1123 ("qttools-5" ,qttools-5)
1124 ("pkg-config" ,pkg-config)
1126 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1128 (version (git-version "0" revision commit)))
1132 (url "https://github.com/pyushkevich/c3d")
1134 (file-name (git-file-name "c3d" version))
1137 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1138 ;; We are using an arbitrary commit from 2017 because the latest
1139 ;; version breaks the build...
1141 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1143 (version (git-version "0" revision commit)))
1147 (url "https://github.com/pyushkevich/greedy")
1149 (file-name (git-file-name "greedy" version))
1152 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1153 (home-page "https://sourceforge.net/p/itk-snap/")
1154 (synopsis "Medical image segmentation")
1155 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1156 medical images. It provides an automatic active contour segmentation
1157 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1158 full-featured UI aimed at clinical researchers.")
1159 ;; This includes the submodules greedy and c3d.
1160 (license license:gpl3+)))
1162 (define-public metapixel
1163 ;; Follow stable branch.
1164 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1167 (version (git-version "1.0.2" "1" commit))
1172 (url "https://github.com/schani/metapixel")
1174 ;; TODO: Package rwimg and lispreader?
1176 (file-name (git-file-name name version))
1178 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1179 (build-system gnu-build-system)
1181 `(("giflib" ,giflib)
1182 ("libjpeg" ,libjpeg-turbo)
1186 `(("pkg-config" ,pkg-config)
1187 ("docbook-xml" ,docbook-xml)
1188 ("docbook-xsl" ,docbook-xsl)
1189 ("xsltproc" ,libxslt)))
1191 `(#:tests? #f ; No tests.
1193 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1194 (string-append "MANPAGE_XSL="
1195 (assoc-ref %build-inputs "docbook-xsl")
1196 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1198 (modify-phases %standard-phases
1200 (add-before 'install 'make-local-docbook-xml
1201 (lambda* (#:key inputs #:allow-other-keys)
1202 (substitute* "metapixel.xml"
1203 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1204 (string-append (assoc-ref inputs "docbook-xml")
1205 "/xml/dtd/docbook/docbookx.dtd")))
1207 (add-before 'install 'fix-directory-creation
1208 (lambda* (#:key outputs #:allow-other-keys)
1209 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1211 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1212 (synopsis "Photomosaics generator")
1213 (description "Metapixel is a program for generating photomosaics. It can
1214 generate classical photomosaics, in which the source image is viewed as a
1215 matrix of equally sized rectangles for each of which a matching image is
1216 substituted, as well as collage-style photomosaics, in which rectangular parts
1217 of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1218 substituted by matching images.")
1219 (license license:gpl2))))
1221 (define-public scantailor-advanced
1222 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1224 (name "scantailor-advanced")
1225 (version (string-append "1.0.16-" (string-take commit 7)))
1230 (url "https://github.com/4lex4/scantailor-advanced")
1232 (file-name (git-file-name name version))
1235 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1236 (build-system qt-build-system)
1241 ("libjpeg" ,libjpeg-turbo)
1243 ("libtiff" ,libtiff)
1244 ("qtbase" ,qtbase-5)
1245 ("qtsvg-5" ,qtsvg-5)
1249 (modify-phases %standard-phases
1250 ;; Some tests require a display and fail with offscreen mode.
1251 (add-after 'unpack 'disable-failing-tests
1253 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1255 (home-page "https://github.com/4lex4/scantailor-advanced")
1256 (synopsis "Clean up scanned pages")
1257 (description "Scan Tailor is an interactive post-processing tool for
1258 scanned pages. It performs operations such as page splitting, deskewing,
1259 adding/removing borders, and others. You give it raw scans, and you get pages
1260 ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1261 character recognition, and assembling multi-page documents are out of scope of
1264 Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1265 and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1266 (license license:gpl3+))))
1268 (define-public stiff
1275 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1278 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1279 (build-system gnu-build-system)
1281 (list libtiff zlib libjpeg-turbo))
1282 (home-page "https://www.astromatic.net/software/stiff")
1283 (synopsis "Convert scientific FITS images to TIFF format")
1285 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1286 Transport System} images to the more popular TIFF format for illustration
1288 (license license:gpl3+)))
1290 (define-public python-imgviz
1292 (name "python-imgviz")
1296 ;; PyPi tarball lacks tests.
1299 (url "https://github.com/wkentaro/imgviz.git")
1300 (commit (string-append "v" version))))
1301 (file-name (git-file-name name version))
1303 (base32 "1bm0wdv5p26i8nl4kx3145cz553v401sgbpgc96sddzjfmfiydcw"))))
1304 (build-system python-build-system)
1307 (modify-phases %standard-phases
1309 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1311 (add-installed-pythonpath inputs outputs)
1312 (invoke "pytest" "-v" "tests"))
1315 (list python-matplotlib python-numpy python-pillow python-pyyaml))
1316 (native-inputs (list python-pytest))
1317 (home-page "http://github.com/wkentaro/imgviz")
1318 (synopsis "Image Visualization Tools")
1319 (description "Python library for object detection, semantic and instance
1321 (license license:expat)))
1323 (define-public labelme
1329 ;; PyPi tarball lacks tests.
1332 (url "https://github.com/wkentaro/labelme.git")
1333 (commit (string-append "v" version))))
1334 (file-name (git-file-name name version))
1336 (base32 "0cmi2xb4dgh7738l259rgwhn9l134f0vnaaqc2gflc5yr3lqhrv2"))))
1337 (build-system python-build-system)
1340 (modify-phases %standard-phases
1341 (add-after 'unpack 'loosen-requirements
1343 ;; Don't require an outdated version of matplotlib.
1344 (substitute* "setup.py"
1345 (("matplotlib<3\\.3")
1347 (add-before 'check 'start-xserver
1348 (lambda* (#:key inputs #:allow-other-keys)
1349 (let ((xorg-server (assoc-ref inputs "xorg-server")))
1350 ;; Options taken from CI workflow.
1351 (system (string-append xorg-server "/bin/Xvfb :99 -screen 0 "
1352 "1920x1200x24 -ac +extension GLX +render "
1354 (setenv "DISPLAY" ":99.0"))))
1356 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1358 (add-installed-pythonpath inputs outputs)
1359 ;; Fails when invoking help2man for unknown reason.
1360 (delete-file "tests/docs_tests/man_tests/test_labelme_1.py")
1362 (delete-file "tests/labelme_tests/widgets_tests/test_label_dialog.py")
1363 ;; Calls incompatible function signatures.
1364 (delete-file "tests/labelme_tests/widgets_tests/test_label_list_widget.py")
1365 (setenv "MPLBACKEND" "agg")
1366 (invoke "pytest" "-v" "tests" "-m" "not gpu")))))))
1376 (list python-pytest python-pytest-qt xorg-server-for-tests))
1377 (home-page "https://github.com/wkentaro/labelme")
1379 "Image Polygonal Annotation")
1381 "Image and video labeling tool supporting different shapes like
1382 polygons, rectangles, circles, lines, points and VOC/COCO export.")
1383 (license license:gpl3+)))