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 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>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages image-processing)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix packages)
37 #:use-module (guix utils)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix build-system qt)
41 #:use-module (guix build-system cmake)
42 #:use-module (guix build-system gnu)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages algebra)
45 #:use-module (gnu packages bison)
46 #:use-module (gnu packages boost)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages curl)
50 #:use-module (gnu packages docbook)
51 #:use-module (gnu packages documentation)
52 #:use-module (gnu packages flex)
53 #:use-module (gnu packages fontutils)
54 #:use-module (gnu packages geo)
55 #:use-module (gnu packages ghostscript)
56 #:use-module (gnu packages gl)
57 #:use-module (gnu packages glib)
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages graphics)
60 #:use-module (gnu packages graphviz)
61 #:use-module (gnu packages gstreamer)
62 #:use-module (gnu packages gtk)
63 #:use-module (gnu packages icu4c)
64 #:use-module (gnu packages image)
65 #:use-module (gnu packages imagemagick)
66 #:use-module (gnu packages maths)
67 #:use-module (gnu packages pdf)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages photo)
70 #:use-module (gnu packages pkg-config)
71 #:use-module (gnu packages protobuf)
72 #:use-module (gnu packages python)
73 #:use-module (gnu packages python-xyz)
74 #:use-module (gnu packages qt)
75 #:use-module (gnu packages serialization)
76 #:use-module (gnu packages sqlite)
77 #:use-module (gnu packages tbb)
78 #:use-module (gnu packages tls)
79 #:use-module (gnu packages version-control)
80 #:use-module (gnu packages video)
81 #:use-module (gnu packages xiph)
82 #:use-module (gnu packages xml)
83 #:use-module (gnu packages xorg)
84 #:use-module (ice-9 match)
85 #:use-module (srfi srfi-1))
95 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
96 "dcmtk" (string-join (string-split version #\.) "")
97 "/dcmtk-" version ".tar.gz"))
99 (base32 "13j5yf3p6qj3mr17d77r3kcqchf055hgvk1w15vmdr8f54mwcnb8"))))
100 (build-system cmake-build-system)
103 ("libjpeg" ,libjpeg-turbo)
110 `(("doxygen" ,doxygen))) ; for HTML documentation
111 (home-page "https://dcmtk.org")
112 (synopsis "Libraries and programs implementing parts of the DICOM standard")
113 (description "DCMTK is a collection of libraries and applications
114 implementing large parts the DICOM standard. It includes software for
115 examining, constructing and converting DICOM image files, handling offline
116 media, sending and receiving images over a network connection, as well as
117 demonstrative image storage and worklist servers.")
118 (license (license:fsf-free
120 "A union of the Apache 2.0 licence and various non-copyleft
121 licences similar to the Modified BSD licence."))))
129 (uri (string-append "mirror://sourceforge/mia/mia/"
130 (version-major+minor version)
131 "/mia-" version ".tar.xz"))
134 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
135 (build-system cmake-build-system)
138 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
139 "-DCMAKE_CXX_FLAGS=-fpermissive")))
151 ("libjpeg" ,libjpeg-turbo)
155 ("libxml++" ,libxml++)
157 ("niftilib" ,niftilib)
160 ("python-lxml" ,python2-lxml)
163 `(("pkg-config" ,pkg-config)
164 ("python" ,python-2)))
165 (home-page "http://mia.sourceforge.net")
166 (synopsis "Toolkit for gray scale medical image analysis")
167 (description "MIA provides a combination of command line tools, plug-ins,
168 and libraries that make it possible run image processing tasks interactively
169 in a command shell and to prototype using the shell's scripting language. It
170 is built around a plug-in structure that makes it easy to add functionality
171 without compromising the original code base and it makes use of a wide variety
172 of external libraries that provide additional functionality.")
173 (license license:gpl3+)))
175 (define-public opencolorio
183 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
184 (commit (string-append "v" version))))
186 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
187 (file-name (git-file-name name version))
188 (modules '((guix build utils)))
191 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
192 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
193 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
194 ;; When removing it, also remove it from the licence field comment.
195 (for-each delete-file-recursively
198 (let ((file (basename full-name)))
199 (not (or (string-prefix? "yaml-cpp-0.3" file)
200 (string=? "unittest.h" file)))))
201 (find-files "ext" ".*")))
204 (build-system cmake-build-system)
207 (list (string-append "-DCMAKE_CXX_FLAGS="
208 "-Wno-error=deprecated-declarations "
209 "-Wno-error=unused-function")
210 "-DOCIO_BUILD_STATIC=OFF"
211 ;; "-DUSE_EXTERNAL_YAML=ON"
212 "-DUSE_EXTERNAL_TINYXML=ON"
213 "-DUSE_EXTERNAL_LCMS=ON")
215 (modify-phases %standard-phases
216 (add-after 'unpack 'patch-test-suite
218 (substitute* "src/core_tests/CMakeLists.txt"
219 (("/bin/sh") (which "bash")))
223 ("pkg-config" ,pkg-config)))
225 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
226 ;; ocioconvert fails: error: conflicting declaration ?typedef void
227 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
230 ("tinyxml" ,tinyxml)))
231 (home-page "https://opencolorio.org")
232 (synopsis "Color management for visual effects and animation")
234 "OpenColorIO, or OCIO, is a complete color management solution geared
235 towards motion picture production, with an emphasis on visual effects and
236 computer animation. It provides a straightforward and consistent user
237 experience across all supporting applications while allowing for sophisticated
238 back-end configuration options suitable for high-end production usage.
240 OCIO is compatible with the @acronym{ACES, Academy Color Encoding
241 Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
242 many popular formats.")
243 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
244 license:zlib ; src/core/md5
245 license:bsd-3)))) ; the rest
253 (uri (string-append "https://vtk.org/files/release/"
254 (version-major+minor version)
255 "/VTK-" version ".tar.gz"))
258 "1ir2lq9i45ls374lcmjzw0nrm5l5hnm1w47lg8g8d0n2j7hsaf8v"))
260 (search-patches "vtk-fix-freetypetools-build-failure.patch"))
261 (modules '((guix build utils)))
266 (delete-file-recursively
267 (string-append "ThirdParty/" dir "/vtk" dir)))
268 ;; pugixml depended upon unconditionally
269 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
270 "glew" "hdf5" "jpeg" "jsoncpp" "libproj" "libxml2" "lz4"
271 "netcdf" "ogg" "png" "sqlite" "theora" "tiff" "zlib"))
273 (build-system cmake-build-system)
275 '(#:build-type "Release" ;Build without '-g' to save space.
276 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
278 "-DVTK_USE_EXTERNAL=OFF" ;; default
279 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
280 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
281 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
282 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
283 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
284 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
285 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
286 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
287 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
288 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
289 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
290 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
291 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
292 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
293 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
294 ;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON" ; breaks IO/CityGML
295 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
296 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
297 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
298 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
301 (modify-phases %standard-phases
302 (add-after 'unpack 'patch-sources
304 (substitute* "Common/Core/vtkFloatingPointExceptions.cxx"
305 (("<fenv.h>") "<cfenv>"))
306 (substitute* "Common/Core/CMakeLists.txt"
307 (("fenv.h") "cfenv")))))
308 #:tests? #f)) ;XXX: test data not included
310 `(("double-conversion" ,double-conversion)
313 ("freetype" ,freetype)
318 ("jpeg" ,libjpeg-turbo)
320 ("libtheora" ,libtheora)
329 ;("pugixml" ,pugixml)
332 ("xorgproto" ,xorgproto)
335 ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
336 ;; 'find_package(THEORA)', which in turns looks for libogg.
337 `(("libogg" ,libogg)))
338 (home-page "https://vtk.org/")
339 (synopsis "Libraries for 3D computer graphics")
341 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
342 image processing and visualization. It supports a wide variety of
343 visualization algorithms including: scalar, vector, tensor, texture, and
344 volumetric methods; and advanced modeling techniques such as: implicit
345 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
346 triangulation. VTK has an extensive information visualization framework, has
347 a suite of 3D interaction widgets, supports parallel processing, and
348 integrates with various databases on GUI toolkits such as Qt and Tk.")
349 (license license:bsd-3)))
351 ;; itksnap needs an older variant of VTK.
353 (package (inherit vtk)
357 (uri (string-append "https://vtk.org/files/release/"
358 (version-major+minor version)
359 "/VTK-" version ".tar.gz"))
362 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
364 `(("jsoncpp" ,jsoncpp-for-tensorflow)
365 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
367 (define-public opencv
374 (url "https://github.com/opencv/opencv")
376 (file-name (git-file-name name version))
379 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
381 (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
382 (modules '((guix build utils)))
385 ;; Remove external libraries. We have all available in Guix:
386 (delete-file-recursively "3rdparty")
388 ;; Milky icon set is non-free:
389 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
392 (for-each delete-file
393 '("modules/java/test/pure_test/lib/junit-4.11.jar"
394 "samples/java/sbt/sbt/sbt-launch.jar"))
396 (build-system cmake-build-system)
399 (list "-DWITH_IPP=OFF"
401 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
402 "-DENABLE_PRECOMPILED_HEADERS=OFF"
405 ;; See cmake/OpenCVCompilerOptimizations.cmake
406 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
407 ;; BASELINE is the minimum optimization all CPUs must support
409 ;; DISPATCH is the list of optional dispatches.
410 "-DCPU_BASELINE=SSE2"
412 ,@(match (%current-system)
414 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
415 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
417 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
419 '("-DCPU_BASELINE=NEON"
420 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
423 "-DBUILD_PERF_TESTS=OFF"
426 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
427 "/opencv-contrib/modules")
430 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
431 "/opencv-extra/testdata")
433 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
434 ;; which we had removed, which would lead to an error:
435 "-DBUILD_PROTOBUF=OFF"
437 ;; Rebuild protobuf files, because we have a slightly different
438 ;; version than the included one. If we would not update, we
439 ;; would get a compile error later:
440 "-DPROTOBUF_UPDATE_FILES=ON"
442 ;; xfeatures2d disabled, because it downloads extra binaries from
443 ;; https://github.com/opencv/opencv_3rdparty
444 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
445 ;; Cmp this bug entry:
446 ;; https://github.com/opencv/opencv_contrib/issues/1131
447 "-DBUILD_opencv_xfeatures2d=OFF")
449 (modify-phases %standard-phases
450 (add-after 'unpack 'disable-broken-tests
452 ;; These tests fails with:
453 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
454 ;; I think we have no OpenGL support with the Xvfb.
455 (substitute* '("modules/viz/test/test_tutorial3.cpp"
456 "modules/viz/test/test_main.cpp"
457 "modules/viz/test/tests_simple.cpp"
458 "modules/viz/test/test_viz3d.cpp")
459 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
460 (string-append pre "DISABLED_" post)))
462 ;; This one fails with "unknown file: Failure"
463 ;; But I couldn't figure out which file was missing:
464 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
465 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
467 (string-append pre "DISABLED_" post)))
469 ;; Failure reason: Bad accuracy
470 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
471 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
472 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
473 (string-append pre "DISABLED_" post)))
476 (add-after 'unpack 'unpack-submodule-sources
477 (lambda* (#:key inputs #:allow-other-keys)
478 (mkdir "../opencv-extra")
479 (mkdir "../opencv-contrib")
480 (copy-recursively (assoc-ref inputs "opencv-extra")
483 (assoc-ref inputs "opencv-contrib")
484 "--strip-components=1"
485 "-C" "../opencv-contrib")))
487 (add-after 'set-paths 'add-ilmbase-include-path
488 (lambda* (#:key inputs #:allow-other-keys)
489 ;; OpenEXR propagates ilmbase, but its include files do not appear
490 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
491 ;; the CPATH to satisfy the dependency on "ImathVec.h".
493 (string-append (assoc-ref inputs "ilmbase")
495 ":" (or (getenv "CPATH") "")))
497 (add-before 'check 'start-xserver
498 (lambda* (#:key inputs #:allow-other-keys)
499 (let ((xorg-server (assoc-ref inputs "xorg-server"))
501 (setenv "HOME" (getcwd))
502 (setenv "DISPLAY" disp)
503 ;; There must be a running X server and make check doesn't start one.
504 ;; Therefore we must do it.
505 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
507 `(("pkg-config" ,pkg-config)
508 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
513 (url "https://github.com/opencv/opencv_extra")
515 (file-name (git-file-name "opencv_extra" version))
517 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
522 (url "https://github.com/opencv/opencv_contrib")
524 (file-name (git-file-name "opencv_contrib" version))
525 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
527 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
528 (inputs `(("libjpeg" ,libjpeg-turbo)
531 ;; ffmpeg 4.0 causes core dumps in tests.
532 ("ffmpeg" ,ffmpeg-3.4)
535 ("libgphoto2" ,libgphoto2)
538 ("gtkglext" ,gtkglext)
542 ("python-numpy" ,python-numpy)
543 ("protobuf" ,protobuf)
546 ;; These three CVEs are not a problem of OpenCV, see:
547 ;; https://github.com/opencv/opencv/issues/10998
548 (properties '((lint-hidden-cve . ("CVE-2018-7712"
551 (synopsis "Computer vision library")
552 (description "OpenCV is a library aimed at
553 real-time computer vision, including several hundred computer
554 vision algorithms. It can be used to do things like:
557 @item image and video input and output
558 @item image and video processing
560 @item feature recognition
562 @item facial recognition
564 @item structure from motion
565 @item augmented reality
566 @item machine learning
568 (home-page "https://opencv.org/")
569 (license license:bsd-3)))
579 "https://github.com/libvips/libvips/releases/download/v"
580 version "/vips-" version ".tar.gz"))
582 (base32 "0vjsh3i0861f6h9as3bch956cidz824zz499pvhjs3lfjn6hhs14"))))
583 (build-system gnu-build-system)
585 `(("gobject-introspection" ,gobject-introspection)
586 ("pkg-config" ,pkg-config)))
593 ("imagemagick" ,imagemagick)
597 ("libjpeg" ,libjpeg-turbo)
604 ("niftilib" ,niftilib)
608 ("poppler" ,poppler)))
609 (home-page "https://libvips.github.io/libvips/")
610 (synopsis "Multithreaded image processing system with low memory needs")
612 "VIPS is a demand-driven, horizontally threaded image processing library.
613 It's particularly good at processing large images, working with colour,
614 scientific analysis, and general research & development.
616 Compared to most image processing libraries VIPS needs little RAM and runs
617 quickly, especially on machines with more than one CPU core. This is primarily
618 due to its architecture which automatically parallelises the image workflows.")
619 (license license:lgpl2.1+)))
628 (uri (string-append "https://gmic.eu/files/source/gmic_"
631 (base32 "06n1dcskky7aqg3a0cp7biwz8agc4xqvr8091l2wsvgib98yhbyj"))))
632 (build-system cmake-build-system)
634 `(#:tests? #f ;there are no tests
635 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
636 "-DENABLE_DYNAMIC_LINKING=ON"
639 (modify-phases %standard-phases
640 (add-before 'configure 'set-LDFLAGS
641 (lambda* (#:key inputs outputs #:allow-other-keys)
645 (assoc-ref outputs "out") "/lib")))))))
647 `(("pkg-config" ,pkg-config)))
651 ("graphicsmagick" ,graphicsmagick)
652 ("libjpeg-turbo" ,libjpeg-turbo)
656 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
659 (home-page "https://gmic.eu/")
660 (synopsis "Full-featured framework for digital image processing")
661 (description "G'MIC is a full-featured framework for digital image
662 processing. It provides several user interfaces to convert / manipulate
663 / filter / visualize generic image datasets, ranging from 1D scalar
664 signals to 3D+t sequences of multi-spectral volumetric images, hence
665 including 2D color images.")
666 ;; Dual-licensed, either license applies.
667 (license (list license:cecill license:cecill-c))))
669 (define-public gmic-qt
674 (substitute-keyword-arguments (package-arguments gmic)
675 ((#:configure-flags _)
676 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
677 (string-append "-DGMIC_LIB_PATH="
678 (assoc-ref %build-inputs "gmic") "/lib")))
680 `(modify-phases ,phases
681 (add-after 'unpack 'qt-chdir
682 (lambda _ (chdir "gmic-qt") #t))))))
684 `(("pkg-config" ,pkg-config)
685 ("qttools" ,qttools)))
689 ,@(package-inputs gmic)))
690 (synopsis "Qt frontend for the G'MIC image processing framework")
691 (license license:gpl3+)))
693 (define-public gmic-qt-krita
696 (name "gmic-qt-krita")
698 (substitute-keyword-arguments (package-arguments gmic-qt)
699 ((#:configure-flags flags)
700 '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
701 (string-append "-DGMIC_LIB_PATH="
702 (assoc-ref %build-inputs "gmic") "/lib")))))
703 (synopsis "Krita plugin for the G'MIC image processing framework")))
712 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
713 version "/nip2-" version ".tar.gz" ))
715 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
716 (build-system gnu-build-system)
719 (modify-phases %standard-phases
720 ;; test_conv.ws keep failing so disabling for now.
721 (add-after 'unpack 'disable-test-conv
723 (delete-file "test/workspaces/test_conv.ws")
725 (add-before 'check 'set-home
727 (setenv "HOME" "/tmp") #t)))))
735 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
739 ("imagemagick" ,imagemagick)
750 ("pkg-config" ,pkg-config)))
751 (home-page "https://github.com/libvips/nip2")
752 (synopsis "Spreadsheet-like GUI for libvips")
753 (description "This package provide a graphical user interface (GUI) for
754 the VIPS image processing library. It's a little like a spreadsheet: you
755 create a set of formula connecting your objects together, and on a change nip2
757 (license license:gpl2+)))
767 (url "https://github.com/vxl/vxl")
768 (commit (string-append "v" version))))
769 (file-name (git-file-name name version))
771 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
772 (modules '((guix build utils)))
773 ;; TODO: vxl includes an old version of dcmtk. It won't build with
777 (for-each delete-file-recursively
784 (substitute* "v3p/CMakeLists.txt"
785 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
788 (build-system cmake-build-system)
790 `(("libgeotiff" ,libgeotiff)
792 ("libjpeg" ,libjpeg-turbo)
795 (home-page "https://github.com/vxl/vxl/")
796 (synopsis "Collection of C++ libraries for computer vision")
797 (description "VXL (the Vision-something-Libraries) is a collection of C++
798 libraries designed for computer vision research and implementation.")
799 (license license:bsd-3)))
802 (package (inherit vxl)
809 (url "https://github.com/vxl/vxl")
810 (commit (string-append "v" version))))
811 (file-name (git-file-name name version))
813 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
814 (modules '((guix build utils)))
817 (for-each delete-file-recursively
823 (substitute* "v3p/CMakeLists.txt"
824 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
829 ;; Needed for itk-snap
830 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
832 (define-public insight-toolkit
834 (name "insight-toolkit")
839 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
840 "releases/download/v" version "/InsightToolkit-"
843 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
844 (build-system cmake-build-system)
846 `(#:tests? #f ; tests require network access and external data
849 "-DITK_USE_SYSTEM_LIBRARIES=ON"
850 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
851 "-DITK_BUILD_SHARED=ON"
852 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
853 ;; variable in the installed CMake files. This is necessary as other
854 ;; packages using insight-toolkit could not be configured otherwise.
855 "-DGTEST_ROOT=gtest")
857 (modify-phases %standard-phases
858 (add-after 'unpack 'do-not-tune
860 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
861 (("-mute=native") ""))
869 ("libjpeg" ,libjpeg-turbo)
872 ("mesa" ,mesa-opencl)
879 `(("googletest" ,googletest)
880 ("pkg-config" ,pkg-config)))
881 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
882 (synopsis "Scientific image processing, segmentation and registration")
883 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
884 scientific image processing, segmentation, and registration. Segmentation is
885 the process of identifying and classifying data found in a digitally sampled
886 representation. Typically the sampled representation is an image acquired
887 from such medical instrumentation as CT or MRI scanners. Registration is the
888 task of aligning or developing correspondences between data. For example, in
889 the medical environment, a CT scan may be aligned with a MRI scan in order to
890 combine the information contained in both.")
891 (license license:asl2.0)))
893 (define-public insight-toolkit-4
894 (package (inherit insight-toolkit)
899 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
900 "releases/download/v" version "/InsightToolkit-"
903 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
905 `(#:tests? #f ; tests require network access and external data
907 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
909 "-DITK_USE_SYSTEM_LIBRARIES=ON"
910 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
911 "-DITK_USE_SYSTEM_VXL=ON")))))
913 (define-public insight-toolkit-4.12
914 (package (inherit insight-toolkit-4)
919 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
920 "InsightToolkit-" version ".tar.xz"))
922 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
924 (define-public itk-snap
932 (url "https://git.code.sf.net/p/itk-snap/src")
933 (commit (string-append "v" version))))
934 (file-name (git-file-name name version))
936 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
937 (build-system cmake-build-system)
940 (list "-DSNAP_VERSION_GIT_SHA1=release"
941 "-DSNAP_VERSION_GIT_BRANCH=release"
942 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
943 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
944 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
946 (modify-phases %standard-phases
947 ;; During the installation phase all libraries provided by all
948 ;; dependencies will be copied to the lib directory. That's insane,
949 ;; so we disable this.
950 (add-after 'unpack 'do-not-copy-dependencies
952 (substitute* "CMakeLists.txt"
953 (("install_qt5_executable\
954 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
957 (add-after 'unpack 'disable-gui-tests
959 ;; The GUI tests just time out.
960 (substitute* "CMakeLists.txt"
961 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
962 |RandomForest|RandomForestBailOut)")
965 (add-after 'unpack 'make-reproducible
967 (substitute* "CMakeLists.txt"
968 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
969 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
971 (add-after 'unpack 'prepare-submodules
972 (lambda* (#:key inputs #:allow-other-keys)
973 (rmdir "Submodules/c3d")
974 (copy-recursively (assoc-ref inputs "c3d-src")
976 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
977 "Submodules/c3d/adapters/ApplyMetric.cxx")
979 (rmdir "Submodules/greedy")
980 (symlink (assoc-ref inputs "greedy-src")
983 (add-after 'unpack 'fix-includes
985 (substitute* "GUI/Model/RegistrationModel.cxx"
986 (("<vnl_symmetric_eigensystem.h>")
987 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
989 (add-before 'check 'prepare-tests
991 ;; Needed by at least one test.
992 (setenv "HOME" "/tmp")
994 (add-after 'install 'wrap-executable
995 (lambda* (#:key inputs outputs #:allow-other-keys)
996 (let ((out (assoc-ref outputs "out")))
997 (wrap-program (string-append out "/bin/itksnap")
998 `("QT_PLUGIN_PATH" ":" prefix
999 ,(map (lambda (label)
1000 (string-append (assoc-ref inputs label)
1001 "/lib/qt5/plugins"))
1002 '("qtbase" "qtdeclarative"))))
1010 ("mesa" ,mesa-opencl)
1011 ;; This package does not build with either insight-toolkit 5.0.0 and
1012 ;; not with 4.13. It really needs to be 4.12.
1013 ("itk" ,insight-toolkit-4.12)
1016 ("qtdeclarative" ,qtdeclarative)
1020 `(("googletest" ,googletest)
1021 ("qttools" ,qttools)
1022 ("pkg-config" ,pkg-config)
1024 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1026 (version (git-version "0" revision commit)))
1030 (url "https://github.com/pyushkevich/c3d")
1032 (file-name (git-file-name "c3d" version))
1035 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1036 ;; We are using an arbitrary commit from 2017 because the latest
1037 ;; version breaks the build...
1039 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1041 (version (git-version "0" revision commit)))
1045 (url "https://github.com/pyushkevich/greedy")
1047 (file-name (git-file-name "greedy" version))
1050 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1051 (home-page "https://sourceforge.net/p/itk-snap/")
1052 (synopsis "Medical image segmentation")
1053 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1054 medical images. It provides an automatic active contour segmentation
1055 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1056 full-featured UI aimed at clinical researchers.")
1057 ;; This includes the submodules greedy and c3d.
1058 (license license:gpl3+)))
1060 (define-public metapixel
1061 ;; Follow stable branch.
1062 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1065 (version (git-version "1.0.2" "1" commit))
1070 (url "https://github.com/schani/metapixel")
1072 ;; TODO: Package rwimg and lispreader?
1074 (file-name (git-file-name name version))
1076 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1077 (build-system gnu-build-system)
1079 `(("giflib" ,giflib)
1080 ("libjpeg" ,libjpeg-turbo)
1084 `(("pkg-config" ,pkg-config)
1085 ("docbook-xml" ,docbook-xml)
1086 ("docbook-xsl" ,docbook-xsl)
1087 ("xsltproc" ,libxslt)))
1089 `(#:tests? #f ; No tests.
1091 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1092 (string-append "MANPAGE_XSL="
1093 (assoc-ref %build-inputs "docbook-xsl")
1094 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1096 (modify-phases %standard-phases
1098 (add-before 'install 'make-local-docbook-xml
1099 (lambda* (#:key inputs #:allow-other-keys)
1100 (substitute* "metapixel.xml"
1101 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1102 (string-append (assoc-ref inputs "docbook-xml")
1103 "/xml/dtd/docbook/docbookx.dtd")))
1105 (add-before 'install 'fix-directory-creation
1106 (lambda* (#:key outputs #:allow-other-keys)
1107 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1109 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1110 (synopsis "Photomosaics generator")
1111 (description "Metapixel is a program for generating photomosaics. It can
1112 generate classical photomosaics, in which the source image is viewed as a
1113 matrix of equally sized rectangles for each of which a matching image is
1114 substituted, as well as collage-style photomosaics, in which rectangular parts
1115 of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1116 substituted by matching images.")
1117 (license license:gpl2))))
1119 (define-public scantailor-advanced
1120 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1122 (name "scantailor-advanced")
1123 (version (string-append "1.0.16-" (string-take commit 7)))
1128 (url "https://github.com/4lex4/scantailor-advanced")
1130 (file-name (git-file-name name version))
1133 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1134 (build-system qt-build-system)
1136 `(("qttools" ,qttools)))
1139 ("libjpeg" ,libjpeg-turbo)
1141 ("libtiff" ,libtiff)
1147 (modify-phases %standard-phases
1148 ;; Some tests require a display and fail with offscreen mode.
1149 (add-after 'unpack 'disable-failing-tests
1151 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1153 (home-page "https://github.com/4lex4/scantailor-advanced")
1154 (synopsis "Clean up scanned pages")
1155 (description "Scan Tailor is an interactive post-processing tool for
1156 scanned pages. It performs operations such as page splitting, deskewing,
1157 adding/removing borders, and others. You give it raw scans, and you get pages
1158 ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1159 character recognition, and assembling multi-page documents are out of scope of
1162 Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1163 and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1164 (license license:gpl3+))))
1166 (define-public stiff
1173 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1176 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1177 (build-system gnu-build-system)
1179 `(("libtiff" ,libtiff)
1181 ("libjpeg-turbo" ,libjpeg-turbo)))
1182 (home-page "https://www.astromatic.net/software/stiff")
1183 (synopsis "Convert scientific FITS images to TIFF format")
1185 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1186 Transport System} images to the more popular TIFF format for illustration
1188 (license license:gpl3+)))