1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2014, 2021 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 Felix Gruber <felgru@posteo.net>
17 ;;; Copyright © 2021 Andy Tai <atai@atai.org>
18 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
20 ;;; This file is part of GNU Guix.
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35 (define-module (gnu packages image-processing)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix utils)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix build-system qt)
42 #:use-module (guix build-system cmake)
43 #:use-module (guix build-system gnu)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages algebra)
46 #:use-module (gnu packages bison)
47 #:use-module (gnu packages boost)
48 #:use-module (gnu packages check)
49 #:use-module (gnu packages compression)
50 #:use-module (gnu packages curl)
51 #:use-module (gnu packages docbook)
52 #:use-module (gnu packages documentation)
53 #:use-module (gnu packages flex)
54 #:use-module (gnu packages fontutils)
55 #:use-module (gnu packages geo)
56 #:use-module (gnu packages ghostscript)
57 #:use-module (gnu packages gl)
58 #:use-module (gnu packages glib)
59 #:use-module (gnu packages gnome)
60 #:use-module (gnu packages graphics)
61 #:use-module (gnu packages graphviz)
62 #:use-module (gnu packages gstreamer)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages icu4c)
65 #:use-module (gnu packages image)
66 #:use-module (gnu packages imagemagick)
67 #:use-module (gnu packages maths)
68 #:use-module (gnu packages pdf)
69 #:use-module (gnu packages perl)
70 #:use-module (gnu packages photo)
71 #:use-module (gnu packages pkg-config)
72 #:use-module (gnu packages protobuf)
73 #:use-module (gnu packages python)
74 #:use-module (gnu packages python-xyz)
75 #:use-module (gnu packages qt)
76 #:use-module (gnu packages serialization)
77 #:use-module (gnu packages sqlite)
78 #:use-module (gnu packages tbb)
79 #:use-module (gnu packages tls)
80 #:use-module (gnu packages version-control)
81 #:use-module (gnu packages video)
82 #:use-module (gnu packages xiph)
83 #:use-module (gnu packages xml)
84 #:use-module (gnu packages xorg)
85 #:use-module (ice-9 match)
86 #:use-module (srfi srfi-1))
96 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
97 "dcmtk" (string-join (string-split version #\.) "")
98 "/dcmtk-" version ".tar.gz"))
100 (base32 "13j5yf3p6qj3mr17d77r3kcqchf055hgvk1w15vmdr8f54mwcnb8"))))
101 (build-system cmake-build-system)
104 ("libjpeg" ,libjpeg-turbo)
111 `(("doxygen" ,doxygen))) ; for HTML documentation
112 (home-page "https://dcmtk.org")
113 (synopsis "Libraries and programs implementing parts of the DICOM standard")
114 (description "DCMTK is a collection of libraries and applications
115 implementing large parts the DICOM standard. It includes software for
116 examining, constructing and converting DICOM image files, handling offline
117 media, sending and receiving images over a network connection, as well as
118 demonstrative image storage and worklist servers.")
119 (license (license:fsf-free
121 "A union of the Apache 2.0 licence and various non-copyleft
122 licences similar to the Modified BSD licence."))))
130 (uri (string-append "mirror://sourceforge/mia/mia/"
131 (version-major+minor version)
132 "/mia-" version ".tar.xz"))
135 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
136 (build-system cmake-build-system)
139 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
140 "-DCMAKE_CXX_FLAGS=-fpermissive")))
152 ("libjpeg" ,libjpeg-turbo)
156 ("libxml++" ,libxml++)
158 ("niftilib" ,niftilib)
161 ("python-lxml" ,python2-lxml)
164 `(("pkg-config" ,pkg-config)
165 ("python" ,python-2)))
166 (home-page "http://mia.sourceforge.net")
167 (synopsis "Toolkit for gray scale medical image analysis")
168 (description "MIA provides a combination of command line tools, plug-ins,
169 and libraries that make it possible run image processing tasks interactively
170 in a command shell and to prototype using the shell's scripting language. It
171 is built around a plug-in structure that makes it easy to add functionality
172 without compromising the original code base and it makes use of a wide variety
173 of external libraries that provide additional functionality.")
174 (license license:gpl3+)))
176 (define-public opencolorio
184 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
185 (commit (string-append "v" version))))
187 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
188 (file-name (git-file-name name version))
189 (modules '((guix build utils)))
192 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
193 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
194 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
195 ;; When removing it, also remove it from the licence field comment.
196 (for-each delete-file-recursively
199 (let ((file (basename full-name)))
200 (not (or (string-prefix? "yaml-cpp-0.3" file)
201 (string=? "unittest.h" file)))))
202 (find-files "ext" ".*")))
205 (build-system cmake-build-system)
208 (list (string-append "-DCMAKE_CXX_FLAGS="
209 "-Wno-error=deprecated-declarations "
210 "-Wno-error=unused-function")
211 "-DOCIO_BUILD_STATIC=OFF"
212 ;; "-DUSE_EXTERNAL_YAML=ON"
213 "-DUSE_EXTERNAL_TINYXML=ON"
214 "-DUSE_EXTERNAL_LCMS=ON")
216 (modify-phases %standard-phases
217 (add-after 'unpack 'patch-test-suite
219 (substitute* "src/core_tests/CMakeLists.txt"
220 (("/bin/sh") (which "bash")))
224 ("pkg-config" ,pkg-config)))
226 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
227 ;; ocioconvert fails: error: conflicting declaration ?typedef void
228 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
231 ("tinyxml" ,tinyxml)))
232 (home-page "https://opencolorio.org")
233 (synopsis "Color management for visual effects and animation")
235 "OpenColorIO, or OCIO, is a complete color management solution geared
236 towards motion picture production, with an emphasis on visual effects and
237 computer animation. It provides a straightforward and consistent user
238 experience across all supporting applications while allowing for sophisticated
239 back-end configuration options suitable for high-end production usage.
241 OCIO is compatible with the @acronym{ACES, Academy Color Encoding
242 Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
243 many popular formats.")
244 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
245 license:zlib ; src/core/md5
246 license:bsd-3)))) ; the rest
254 (uri (string-append "https://vtk.org/files/release/"
255 (version-major+minor version)
256 "/VTK-" version ".tar.gz"))
259 "1ir2lq9i45ls374lcmjzw0nrm5l5hnm1w47lg8g8d0n2j7hsaf8v"))
261 (search-patches "vtk-fix-freetypetools-build-failure.patch"))
262 (modules '((guix build utils)))
267 (delete-file-recursively
268 (string-append "ThirdParty/" dir "/vtk" dir)))
269 ;; pugixml depended upon unconditionally
270 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
271 "glew" "hdf5" "jpeg" "jsoncpp" "libproj" "libxml2" "lz4"
272 "netcdf" "ogg" "png" "sqlite" "theora" "tiff" "zlib"))
274 (properties `((release-monitoring-url . "https://vtk.org/download/")))
275 (build-system cmake-build-system)
277 '(#:build-type "Release" ;Build without '-g' to save space.
278 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
280 "-DVTK_USE_EXTERNAL=OFF" ;; default
281 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
282 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
283 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
284 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
285 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
286 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
287 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
288 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
289 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
290 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
291 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
292 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
293 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
294 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
295 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
296 ;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON" ; breaks IO/CityGML
297 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
298 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
299 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
300 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
303 (modify-phases %standard-phases
304 (add-after 'unpack 'patch-sources
306 (substitute* "Common/Core/vtkFloatingPointExceptions.cxx"
307 (("<fenv.h>") "<cfenv>"))
308 (substitute* "Common/Core/CMakeLists.txt"
309 (("fenv.h") "cfenv")))))
310 #:tests? #f)) ;XXX: test data not included
312 `(("double-conversion" ,double-conversion)
315 ("freetype" ,freetype)
320 ("jpeg" ,libjpeg-turbo)
322 ("libtheora" ,libtheora)
331 ;("pugixml" ,pugixml)
334 ("xorgproto" ,xorgproto)
337 ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
338 ;; 'find_package(THEORA)', which in turns looks for libogg.
339 `(("libogg" ,libogg)))
340 (home-page "https://vtk.org/")
341 (synopsis "Libraries for 3D computer graphics")
343 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
344 image processing and visualization. It supports a wide variety of
345 visualization algorithms including: scalar, vector, tensor, texture, and
346 volumetric methods; and advanced modeling techniques such as: implicit
347 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
348 triangulation. VTK has an extensive information visualization framework, has
349 a suite of 3D interaction widgets, supports parallel processing, and
350 integrates with various databases on GUI toolkits such as Qt and Tk.")
351 (license license:bsd-3)))
353 ;; freecad needs an old version of VTK, because VTK's API changed from 8 to 9
355 (package (inherit vtk)
359 (uri (string-append "https://vtk.org/files/release/"
360 (version-major+minor version)
361 "/VTK-" version ".tar.gz"))
364 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
366 `(("jsoncpp" ,jsoncpp-for-tensorflow)
367 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
369 ;; itksnap needs an older variant of VTK.
371 (package (inherit vtk)
375 (uri (string-append "https://vtk.org/files/release/"
376 (version-major+minor version)
377 "/VTK-" version ".tar.gz"))
380 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
382 `(("jsoncpp" ,jsoncpp-for-tensorflow)
383 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
385 (define-public opencv
392 (url "https://github.com/opencv/opencv")
394 (file-name (git-file-name name version))
397 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
399 (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
400 (modules '((guix build utils)))
403 ;; Remove external libraries. We have all available in Guix:
404 (delete-file-recursively "3rdparty")
406 ;; Milky icon set is non-free:
407 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
410 (for-each delete-file
411 '("modules/java/test/pure_test/lib/junit-4.11.jar"
412 "samples/java/sbt/sbt/sbt-launch.jar"))
414 (build-system cmake-build-system)
417 (list "-DWITH_IPP=OFF"
419 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
420 "-DENABLE_PRECOMPILED_HEADERS=OFF"
423 ;; See cmake/OpenCVCompilerOptimizations.cmake
424 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
425 ;; BASELINE is the minimum optimization all CPUs must support
427 ;; DISPATCH is the list of optional dispatches.
428 "-DCPU_BASELINE=SSE2"
430 ,@(match (%current-system)
432 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
433 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
435 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
437 '("-DCPU_BASELINE=NEON"
438 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
441 "-DBUILD_PERF_TESTS=OFF"
444 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
445 "/opencv-contrib/modules")
448 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
449 "/opencv-extra/testdata")
451 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
452 ;; which we had removed, which would lead to an error:
453 "-DBUILD_PROTOBUF=OFF"
455 ;; Rebuild protobuf files, because we have a slightly different
456 ;; version than the included one. If we would not update, we
457 ;; would get a compile error later:
458 "-DPROTOBUF_UPDATE_FILES=ON"
460 ;; xfeatures2d disabled, because it downloads extra binaries from
461 ;; https://github.com/opencv/opencv_3rdparty
462 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
463 ;; Cmp this bug entry:
464 ;; https://github.com/opencv/opencv_contrib/issues/1131
465 "-DBUILD_opencv_xfeatures2d=OFF")
467 (modify-phases %standard-phases
468 (add-after 'unpack 'disable-broken-tests
470 ;; These tests fails with:
471 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
472 ;; I think we have no OpenGL support with the Xvfb.
473 (substitute* '("modules/viz/test/test_tutorial3.cpp"
474 "modules/viz/test/test_main.cpp"
475 "modules/viz/test/tests_simple.cpp"
476 "modules/viz/test/test_viz3d.cpp")
477 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
478 (string-append pre "DISABLED_" post)))
480 ;; This one fails with "unknown file: Failure"
481 ;; But I couldn't figure out which file was missing:
482 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
483 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
485 (string-append pre "DISABLED_" post)))
487 ;; Failure reason: Bad accuracy
488 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
489 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
490 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
491 (string-append pre "DISABLED_" post)))
494 (add-after 'unpack 'unpack-submodule-sources
495 (lambda* (#:key inputs #:allow-other-keys)
496 (mkdir "../opencv-extra")
497 (mkdir "../opencv-contrib")
498 (copy-recursively (assoc-ref inputs "opencv-extra")
501 (assoc-ref inputs "opencv-contrib")
502 "--strip-components=1"
503 "-C" "../opencv-contrib")))
505 (add-after 'set-paths 'add-ilmbase-include-path
506 (lambda* (#:key inputs #:allow-other-keys)
507 ;; OpenEXR propagates ilmbase, but its include files do not appear
508 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
509 ;; the CPATH to satisfy the dependency on "ImathVec.h".
511 (string-append (assoc-ref inputs "ilmbase")
513 ":" (or (getenv "CPATH") "")))
515 (add-before 'check 'start-xserver
516 (lambda* (#:key inputs #:allow-other-keys)
517 (let ((xorg-server (assoc-ref inputs "xorg-server"))
519 (setenv "HOME" (getcwd))
520 (setenv "DISPLAY" disp)
521 ;; There must be a running X server and make check doesn't start one.
522 ;; Therefore we must do it.
523 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
525 `(("pkg-config" ,pkg-config)
526 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
531 (url "https://github.com/opencv/opencv_extra")
533 (file-name (git-file-name "opencv_extra" version))
535 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
540 (url "https://github.com/opencv/opencv_contrib")
542 (file-name (git-file-name "opencv_contrib" version))
543 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
545 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
546 (inputs `(("libjpeg" ,libjpeg-turbo)
549 ;; ffmpeg 4.0 causes core dumps in tests.
550 ("ffmpeg" ,ffmpeg-3.4)
553 ("libgphoto2" ,libgphoto2)
556 ("gtkglext" ,gtkglext)
560 ("python-numpy" ,python-numpy)
561 ("protobuf" ,protobuf)
564 ;; These three CVEs are not a problem of OpenCV, see:
565 ;; https://github.com/opencv/opencv/issues/10998
566 (properties '((lint-hidden-cve . ("CVE-2018-7712"
569 (synopsis "Computer vision library")
570 (description "OpenCV is a library aimed at
571 real-time computer vision, including several hundred computer
572 vision algorithms. It can be used to do things like:
575 @item image and video input and output
576 @item image and video processing
578 @item feature recognition
580 @item facial recognition
582 @item structure from motion
583 @item augmented reality
584 @item machine learning
586 (home-page "https://opencv.org/")
587 (license license:bsd-3)))
597 "https://github.com/libvips/libvips/releases/download/v"
598 version "/vips-" version ".tar.gz"))
600 (base32 "0vjsh3i0861f6h9as3bch956cidz824zz499pvhjs3lfjn6hhs14"))))
601 (build-system gnu-build-system)
603 `(("gobject-introspection" ,gobject-introspection)
604 ("pkg-config" ,pkg-config)))
611 ("imagemagick" ,imagemagick)
615 ("libjpeg" ,libjpeg-turbo)
622 ("niftilib" ,niftilib)
626 ("poppler" ,poppler)))
627 (home-page "https://libvips.github.io/libvips/")
628 (synopsis "Multithreaded image processing system with low memory needs")
630 "VIPS is a demand-driven, horizontally threaded image processing library.
631 It's particularly good at processing large images, working with colour,
632 scientific analysis, and general research & development.
634 Compared to most image processing libraries VIPS needs little RAM and runs
635 quickly, especially on machines with more than one CPU core. This is primarily
636 due to its architecture which automatically parallelises the image workflows.")
637 (license license:lgpl2.1+)))
646 (uri (string-append "https://gmic.eu/files/source/gmic_"
649 (base32 "05kzaplsl5qvxs7v6g73q0lq8dii8g6v77ap609188m7gr43f9cl"))))
650 (build-system cmake-build-system)
652 `(#:tests? #f ;there are no tests
653 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
654 "-DENABLE_DYNAMIC_LINKING=ON"
657 (modify-phases %standard-phases
658 (add-before 'configure 'set-LDFLAGS
659 (lambda* (#:key inputs outputs #:allow-other-keys)
663 (assoc-ref outputs "out") "/lib")))))))
665 `(("pkg-config" ,pkg-config)))
669 ("graphicsmagick" ,graphicsmagick)
670 ("libjpeg-turbo" ,libjpeg-turbo)
674 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
677 (home-page "https://gmic.eu/")
678 (synopsis "Full-featured framework for digital image processing")
679 (description "G'MIC is a full-featured framework for digital image
680 processing. It provides several user interfaces to convert / manipulate
681 / filter / visualize generic image datasets, ranging from 1D scalar
682 signals to 3D+t sequences of multi-spectral volumetric images, hence
683 including 2D color images.")
684 ;; Dual-licensed, either license applies.
685 (license (list license:cecill license:cecill-c))))
687 (define-public gmic-qt
692 (substitute-keyword-arguments (package-arguments gmic)
693 ((#:configure-flags _)
694 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
695 (string-append "-DGMIC_LIB_PATH="
696 (assoc-ref %build-inputs "gmic") "/lib")))
698 `(modify-phases ,phases
699 (add-after 'unpack 'qt-chdir
700 (lambda _ (chdir "gmic-qt") #t))))))
702 `(("pkg-config" ,pkg-config)
703 ("qttools" ,qttools)))
707 ,@(package-inputs gmic)))
708 (synopsis "Qt frontend for the G'MIC image processing framework")
709 (license license:gpl3+)))
711 (define-public gmic-qt-krita
714 (name "gmic-qt-krita")
716 (substitute-keyword-arguments (package-arguments gmic-qt)
717 ((#:configure-flags flags)
718 '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
719 (string-append "-DGMIC_LIB_PATH="
720 (assoc-ref %build-inputs "gmic") "/lib")))))
721 (synopsis "Krita plugin for the G'MIC image processing framework")))
730 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
731 version "/nip2-" version ".tar.gz" ))
733 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
734 (build-system gnu-build-system)
737 (modify-phases %standard-phases
738 ;; test_conv.ws keep failing so disabling for now.
739 (add-after 'unpack 'disable-test-conv
741 (delete-file "test/workspaces/test_conv.ws")
743 (add-before 'check 'set-home
745 (setenv "HOME" "/tmp") #t)))))
753 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
757 ("imagemagick" ,imagemagick)
768 ("pkg-config" ,pkg-config)))
769 (home-page "https://github.com/libvips/nip2")
770 (synopsis "Spreadsheet-like GUI for libvips")
771 (description "This package provide a graphical user interface (GUI) for
772 the VIPS image processing library. It's a little like a spreadsheet: you
773 create a set of formula connecting your objects together, and on a change nip2
775 (license license:gpl2+)))
785 (url "https://github.com/vxl/vxl")
786 (commit (string-append "v" version))))
787 (file-name (git-file-name name version))
789 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
790 (modules '((guix build utils)))
791 ;; TODO: vxl includes an old version of dcmtk. It won't build with
795 (for-each delete-file-recursively
802 (substitute* "v3p/CMakeLists.txt"
803 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
806 (build-system cmake-build-system)
808 `(("libgeotiff" ,libgeotiff)
810 ("libjpeg" ,libjpeg-turbo)
813 (home-page "https://github.com/vxl/vxl/")
814 (synopsis "Collection of C++ libraries for computer vision")
815 (description "VXL (the Vision-something-Libraries) is a collection of C++
816 libraries designed for computer vision research and implementation.")
817 (license license:bsd-3)))
820 (package (inherit vxl)
827 (url "https://github.com/vxl/vxl")
828 (commit (string-append "v" version))))
829 (file-name (git-file-name name version))
831 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
832 (modules '((guix build utils)))
835 (for-each delete-file-recursively
841 (substitute* "v3p/CMakeLists.txt"
842 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
847 ;; Needed for itk-snap
848 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
850 (define-public insight-toolkit
852 (name "insight-toolkit")
857 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
858 "releases/download/v" version "/InsightToolkit-"
861 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
862 (build-system cmake-build-system)
864 `(#:tests? #f ; tests require network access and external data
867 "-DITK_USE_SYSTEM_LIBRARIES=ON"
868 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
869 "-DITK_BUILD_SHARED=ON"
870 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
871 ;; variable in the installed CMake files. This is necessary as other
872 ;; packages using insight-toolkit could not be configured otherwise.
873 "-DGTEST_ROOT=gtest")
875 (modify-phases %standard-phases
876 (add-after 'unpack 'do-not-tune
878 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
879 (("-mute=native") ""))
887 ("libjpeg" ,libjpeg-turbo)
890 ("mesa" ,mesa-opencl)
897 `(("googletest" ,googletest)
898 ("pkg-config" ,pkg-config)))
899 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
900 (synopsis "Scientific image processing, segmentation and registration")
901 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
902 scientific image processing, segmentation, and registration. Segmentation is
903 the process of identifying and classifying data found in a digitally sampled
904 representation. Typically the sampled representation is an image acquired
905 from such medical instrumentation as CT or MRI scanners. Registration is the
906 task of aligning or developing correspondences between data. For example, in
907 the medical environment, a CT scan may be aligned with a MRI scan in order to
908 combine the information contained in both.")
909 (license license:asl2.0)))
911 (define-public insight-toolkit-4
912 (package (inherit insight-toolkit)
917 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
918 "releases/download/v" version "/InsightToolkit-"
921 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
923 `(#:tests? #f ; tests require network access and external data
925 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
927 "-DITK_USE_SYSTEM_LIBRARIES=ON"
928 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
929 "-DITK_USE_SYSTEM_VXL=ON")))))
931 (define-public insight-toolkit-4.12
932 (package (inherit insight-toolkit-4)
937 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
938 "InsightToolkit-" version ".tar.xz"))
940 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
942 (define-public itk-snap
950 (url "https://git.code.sf.net/p/itk-snap/src")
951 (commit (string-append "v" version))))
952 (file-name (git-file-name name version))
954 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
955 (build-system cmake-build-system)
958 (list "-DSNAP_VERSION_GIT_SHA1=release"
959 "-DSNAP_VERSION_GIT_BRANCH=release"
960 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
961 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
962 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
964 (modify-phases %standard-phases
965 ;; During the installation phase all libraries provided by all
966 ;; dependencies will be copied to the lib directory. That's insane,
967 ;; so we disable this.
968 (add-after 'unpack 'do-not-copy-dependencies
970 (substitute* "CMakeLists.txt"
971 (("install_qt5_executable\
972 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
975 (add-after 'unpack 'disable-gui-tests
977 ;; The GUI tests just time out.
978 (substitute* "CMakeLists.txt"
979 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
980 |RandomForest|RandomForestBailOut)")
983 (add-after 'unpack 'make-reproducible
985 (substitute* "CMakeLists.txt"
986 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
987 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
989 (add-after 'unpack 'prepare-submodules
990 (lambda* (#:key inputs #:allow-other-keys)
991 (rmdir "Submodules/c3d")
992 (copy-recursively (assoc-ref inputs "c3d-src")
994 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
995 "Submodules/c3d/adapters/ApplyMetric.cxx")
997 (rmdir "Submodules/greedy")
998 (symlink (assoc-ref inputs "greedy-src")
1001 (add-after 'unpack 'fix-includes
1003 (substitute* "GUI/Model/RegistrationModel.cxx"
1004 (("<vnl_symmetric_eigensystem.h>")
1005 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
1007 (add-before 'check 'prepare-tests
1009 ;; Needed by at least one test.
1010 (setenv "HOME" "/tmp")
1012 (add-after 'install 'wrap-executable
1013 (lambda* (#:key inputs outputs #:allow-other-keys)
1014 (let ((out (assoc-ref outputs "out")))
1015 (wrap-program (string-append out "/bin/itksnap")
1016 `("QT_PLUGIN_PATH" ":" prefix
1017 ,(map (lambda (label)
1018 (string-append (assoc-ref inputs label)
1019 "/lib/qt5/plugins"))
1020 '("qtbase" "qtdeclarative"))))
1028 ("mesa" ,mesa-opencl)
1029 ;; This package does not build with either insight-toolkit 5.0.0 and
1030 ;; not with 4.13. It really needs to be 4.12.
1031 ("itk" ,insight-toolkit-4.12)
1034 ("qtdeclarative" ,qtdeclarative)
1038 `(("googletest" ,googletest)
1039 ("qttools" ,qttools)
1040 ("pkg-config" ,pkg-config)
1042 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1044 (version (git-version "0" revision commit)))
1048 (url "https://github.com/pyushkevich/c3d")
1050 (file-name (git-file-name "c3d" version))
1053 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1054 ;; We are using an arbitrary commit from 2017 because the latest
1055 ;; version breaks the build...
1057 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1059 (version (git-version "0" revision commit)))
1063 (url "https://github.com/pyushkevich/greedy")
1065 (file-name (git-file-name "greedy" version))
1068 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1069 (home-page "https://sourceforge.net/p/itk-snap/")
1070 (synopsis "Medical image segmentation")
1071 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1072 medical images. It provides an automatic active contour segmentation
1073 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1074 full-featured UI aimed at clinical researchers.")
1075 ;; This includes the submodules greedy and c3d.
1076 (license license:gpl3+)))
1078 (define-public metapixel
1079 ;; Follow stable branch.
1080 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1083 (version (git-version "1.0.2" "1" commit))
1088 (url "https://github.com/schani/metapixel")
1090 ;; TODO: Package rwimg and lispreader?
1092 (file-name (git-file-name name version))
1094 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1095 (build-system gnu-build-system)
1097 `(("giflib" ,giflib)
1098 ("libjpeg" ,libjpeg-turbo)
1102 `(("pkg-config" ,pkg-config)
1103 ("docbook-xml" ,docbook-xml)
1104 ("docbook-xsl" ,docbook-xsl)
1105 ("xsltproc" ,libxslt)))
1107 `(#:tests? #f ; No tests.
1109 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1110 (string-append "MANPAGE_XSL="
1111 (assoc-ref %build-inputs "docbook-xsl")
1112 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1114 (modify-phases %standard-phases
1116 (add-before 'install 'make-local-docbook-xml
1117 (lambda* (#:key inputs #:allow-other-keys)
1118 (substitute* "metapixel.xml"
1119 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1120 (string-append (assoc-ref inputs "docbook-xml")
1121 "/xml/dtd/docbook/docbookx.dtd")))
1123 (add-before 'install 'fix-directory-creation
1124 (lambda* (#:key outputs #:allow-other-keys)
1125 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1127 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1128 (synopsis "Photomosaics generator")
1129 (description "Metapixel is a program for generating photomosaics. It can
1130 generate classical photomosaics, in which the source image is viewed as a
1131 matrix of equally sized rectangles for each of which a matching image is
1132 substituted, as well as collage-style photomosaics, in which rectangular parts
1133 of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1134 substituted by matching images.")
1135 (license license:gpl2))))
1137 (define-public scantailor-advanced
1138 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1140 (name "scantailor-advanced")
1141 (version (string-append "1.0.16-" (string-take commit 7)))
1146 (url "https://github.com/4lex4/scantailor-advanced")
1148 (file-name (git-file-name name version))
1151 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1152 (build-system qt-build-system)
1154 `(("qttools" ,qttools)))
1157 ("libjpeg" ,libjpeg-turbo)
1159 ("libtiff" ,libtiff)
1165 (modify-phases %standard-phases
1166 ;; Some tests require a display and fail with offscreen mode.
1167 (add-after 'unpack 'disable-failing-tests
1169 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1171 (home-page "https://github.com/4lex4/scantailor-advanced")
1172 (synopsis "Clean up scanned pages")
1173 (description "Scan Tailor is an interactive post-processing tool for
1174 scanned pages. It performs operations such as page splitting, deskewing,
1175 adding/removing borders, and others. You give it raw scans, and you get pages
1176 ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1177 character recognition, and assembling multi-page documents are out of scope of
1180 Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1181 and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1182 (license license:gpl3+))))
1184 (define-public stiff
1191 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1194 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1195 (build-system gnu-build-system)
1197 `(("libtiff" ,libtiff)
1199 ("libjpeg-turbo" ,libjpeg-turbo)))
1200 (home-page "https://www.astromatic.net/software/stiff")
1201 (synopsis "Convert scientific FITS images to TIFF format")
1203 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1204 Transport System} images to the more popular TIFF format for illustration
1206 (license license:gpl3+)))