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>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages image-processing)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix utils)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix build-system qt)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system gnu)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages algebra)
44 #:use-module (gnu packages bison)
45 #:use-module (gnu packages boost)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages curl)
49 #:use-module (gnu packages docbook)
50 #:use-module (gnu packages documentation)
51 #:use-module (gnu packages flex)
52 #:use-module (gnu packages fontutils)
53 #:use-module (gnu packages geo)
54 #:use-module (gnu packages ghostscript)
55 #:use-module (gnu packages gl)
56 #:use-module (gnu packages glib)
57 #:use-module (gnu packages gnome)
58 #:use-module (gnu packages graphics)
59 #:use-module (gnu packages graphviz)
60 #:use-module (gnu packages gstreamer)
61 #:use-module (gnu packages gtk)
62 #:use-module (gnu packages icu4c)
63 #:use-module (gnu packages image)
64 #:use-module (gnu packages imagemagick)
65 #:use-module (gnu packages maths)
66 #:use-module (gnu packages pdf)
67 #:use-module (gnu packages perl)
68 #:use-module (gnu packages photo)
69 #:use-module (gnu packages pkg-config)
70 #:use-module (gnu packages protobuf)
71 #:use-module (gnu packages python)
72 #:use-module (gnu packages python-xyz)
73 #:use-module (gnu packages qt)
74 #:use-module (gnu packages serialization)
75 #:use-module (gnu packages sqlite)
76 #:use-module (gnu packages tbb)
77 #:use-module (gnu packages tls)
78 #:use-module (gnu packages version-control)
79 #:use-module (gnu packages video)
80 #:use-module (gnu packages xiph)
81 #:use-module (gnu packages xml)
82 #:use-module (gnu packages xorg)
83 #:use-module (ice-9 match)
84 #:use-module (srfi srfi-1))
94 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
95 "dcmtk" (string-join (string-split version #\.) "")
96 "/dcmtk-" version ".tar.gz"))
98 (base32 "13j5yf3p6qj3mr17d77r3kcqchf055hgvk1w15vmdr8f54mwcnb8"))))
99 (build-system cmake-build-system)
102 ("libjpeg" ,libjpeg-turbo)
109 `(("doxygen" ,doxygen))) ; for HTML documentation
110 (home-page "https://dcmtk.org")
111 (synopsis "Libraries and programs implementing parts of the DICOM standard")
112 (description "DCMTK is a collection of libraries and applications
113 implementing large parts the DICOM standard. It includes software for
114 examining, constructing and converting DICOM image files, handling offline
115 media, sending and receiving images over a network connection, as well as
116 demonstrative image storage and worklist servers.")
117 (license (license:fsf-free
119 "A union of the Apache 2.0 licence and various non-copyleft
120 licences similar to the Modified BSD licence."))))
128 (uri (string-append "mirror://sourceforge/mia/mia/"
129 (version-major+minor version)
130 "/mia-" version ".tar.xz"))
133 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
134 (build-system cmake-build-system)
137 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
138 "-DCMAKE_CXX_FLAGS=-fpermissive")))
150 ("libjpeg" ,libjpeg-turbo)
154 ("libxml++" ,libxml++)
156 ("niftilib" ,niftilib)
159 ("python-lxml" ,python2-lxml)
162 `(("pkg-config" ,pkg-config)
163 ("python" ,python-2)))
164 (home-page "http://mia.sourceforge.net")
165 (synopsis "Toolkit for gray scale medical image analysis")
166 (description "MIA provides a combination of command line tools, plug-ins,
167 and libraries that make it possible run image processing tasks interactively
168 in a command shell and to prototype using the shell's scripting language. It
169 is built around a plug-in structure that makes it easy to add functionality
170 without compromising the original code base and it makes use of a wide variety
171 of external libraries that provide additional functionality.")
172 (license license:gpl3+)))
174 (define-public opencolorio
182 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
183 (commit (string-append "v" version))))
185 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
186 (file-name (git-file-name name version))
187 (modules '((guix build utils)))
190 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
191 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
192 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
193 ;; When removing it, also remove it from the licence field comment.
194 (for-each delete-file-recursively
197 (let ((file (basename full-name)))
198 (not (or (string-prefix? "yaml-cpp-0.3" file)
199 (string=? "unittest.h" file)))))
200 (find-files "ext" ".*")))
203 (build-system cmake-build-system)
206 (list (string-append "-DCMAKE_CXX_FLAGS="
207 "-Wno-error=deprecated-declarations "
208 "-Wno-error=unused-function")
209 "-DOCIO_BUILD_STATIC=OFF"
210 ;; "-DUSE_EXTERNAL_YAML=ON"
211 "-DUSE_EXTERNAL_TINYXML=ON"
212 "-DUSE_EXTERNAL_LCMS=ON")
214 (modify-phases %standard-phases
215 (add-after 'unpack 'patch-test-suite
217 (substitute* "src/core_tests/CMakeLists.txt"
218 (("/bin/sh") (which "bash")))
222 ("pkg-config" ,pkg-config)))
224 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
225 ;; ocioconvert fails: error: conflicting declaration ?typedef void
226 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
229 ("tinyxml" ,tinyxml)))
230 (home-page "https://opencolorio.org")
231 (synopsis "Color management for visual effects and animation")
233 "OpenColorIO, or OCIO, is a complete color management solution geared
234 towards motion picture production, with an emphasis on visual effects and
235 computer animation. It provides a straightforward and consistent user
236 experience across all supporting applications while allowing for sophisticated
237 back-end configuration options suitable for high-end production usage.
239 OCIO is compatible with the @acronym{ACES, Academy Color Encoding
240 Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
241 many popular formats.")
242 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
243 license:zlib ; src/core/md5
244 license:bsd-3)))) ; the rest
252 (uri (string-append "https://vtk.org/files/release/"
253 (version-major+minor version)
254 "/VTK-" version ".tar.gz"))
257 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))
259 (search-patches "vtk-fix-freetypetools-build-failure.patch"))
260 (modules '((guix build utils)))
265 (delete-file-recursively
266 (string-append "ThirdParty/" dir "/vtk" dir)))
267 ;; ogg, pugixml depended upon unconditionally
268 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
269 "glew" "hdf5" "jpeg" "jsoncpp" "libproj" "libxml2" "lz4"
270 "netcdf" "png" "sqlite" "theora" "tiff" "zlib"))
272 (build-system cmake-build-system)
274 '(#:build-type "Release" ;Build without '-g' to save space.
275 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
276 ;"-DVTK_MODULE_USE_EXTERNAL_vtkogg:BOOL=TRUE" ; not honored
277 "-DVTK_USE_SYSTEM_DOUBLECONVERSION:BOOL=TRUE"
278 "-DVTK_USE_SYSTEM_EIGEN:BOOL=TRUE"
279 "-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
280 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
281 "-DVTK_USE_SYSTEM_GL2PS:BOOL=TRUE"
282 "-DVTK_USE_SYSTEM_GLEW:BOOL=TRUE"
283 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
284 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
285 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
286 "-DVTK_USE_SYSTEM_LIBPROJ:BOOL=TRUE"
287 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
288 "-DVTK_USE_SYSTEM_LZ4:BOOL=TRUE"
289 "-DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE"
290 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
291 ;"-DVTK_USE_SYSTEM_PUGIXML:BOOL=TRUE" ; breaks IO/CityGML
292 "-DVTK_USE_SYSTEM_SQLITE:BOOL=TRUE"
293 "-DVTK_USE_SYSTEM_THEORA:BOOL=TRUE"
294 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
295 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
296 #:tests? #f)) ;XXX: test data not included
298 `(("double-conversion" ,double-conversion)
301 ("freetype" ,freetype)
306 ("jpeg" ,libjpeg-turbo)
309 ("libtheora" ,libtheora)
318 ;("pugixml" ,pugixml)
321 ("xorgproto" ,xorgproto)
323 (home-page "https://vtk.org/")
324 (synopsis "Libraries for 3D computer graphics")
326 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
327 image processing and visualization. It supports a wide variety of
328 visualization algorithms including: scalar, vector, tensor, texture, and
329 volumetric methods; and advanced modeling techniques such as: implicit
330 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
331 triangulation. VTK has an extensive information visualization framework, has
332 a suite of 3D interaction widgets, supports parallel processing, and
333 integrates with various databases on GUI toolkits such as Qt and Tk.")
334 (license license:bsd-3)))
336 ;; itksnap needs an older variant of VTK.
338 (package (inherit vtk)
342 (uri (string-append "https://vtk.org/files/release/"
343 (version-major+minor version)
344 "/VTK-" version ".tar.gz"))
347 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
349 `(("jsoncpp" ,jsoncpp-for-tensorflow)
350 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
352 (define-public opencv
359 (url "https://github.com/opencv/opencv")
361 (file-name (git-file-name name version))
364 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
366 (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
367 (modules '((guix build utils)))
370 ;; Remove external libraries. We have all available in Guix:
371 (delete-file-recursively "3rdparty")
373 ;; Milky icon set is non-free:
374 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
377 (for-each delete-file
378 '("modules/java/test/pure_test/lib/junit-4.11.jar"
379 "samples/java/sbt/sbt/sbt-launch.jar"))
381 (build-system cmake-build-system)
384 (list "-DWITH_IPP=OFF"
386 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
387 "-DENABLE_PRECOMPILED_HEADERS=OFF"
390 ;; See cmake/OpenCVCompilerOptimizations.cmake
391 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
392 ;; BASELINE is the minimum optimization all CPUs must support
394 ;; DISPATCH is the list of optional dispatches.
395 "-DCPU_BASELINE=SSE2"
397 ,@(match (%current-system)
399 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
400 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
402 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
404 '("-DCPU_BASELINE=NEON"
405 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
408 "-DBUILD_PERF_TESTS=OFF"
411 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
412 "/opencv-contrib/modules")
415 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
416 "/opencv-extra/testdata")
418 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
419 ;; which we had removed, which would lead to an error:
420 "-DBUILD_PROTOBUF=OFF"
422 ;; Rebuild protobuf files, because we have a slightly different
423 ;; version than the included one. If we would not update, we
424 ;; would get a compile error later:
425 "-DPROTOBUF_UPDATE_FILES=ON"
427 ;; xfeatures2d disabled, because it downloads extra binaries from
428 ;; https://github.com/opencv/opencv_3rdparty
429 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
430 ;; Cmp this bug entry:
431 ;; https://github.com/opencv/opencv_contrib/issues/1131
432 "-DBUILD_opencv_xfeatures2d=OFF")
434 (modify-phases %standard-phases
435 (add-after 'unpack 'disable-broken-tests
437 ;; These tests fails with:
438 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
439 ;; I think we have no OpenGL support with the Xvfb.
440 (substitute* '("modules/viz/test/test_tutorial3.cpp"
441 "modules/viz/test/test_main.cpp"
442 "modules/viz/test/tests_simple.cpp"
443 "modules/viz/test/test_viz3d.cpp")
444 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
445 (string-append pre "DISABLED_" post)))
447 ;; This one fails with "unknown file: Failure"
448 ;; But I couldn't figure out which file was missing:
449 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
450 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
452 (string-append pre "DISABLED_" post)))
454 ;; Failure reason: Bad accuracy
455 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
456 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
457 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
458 (string-append pre "DISABLED_" post)))
461 (add-after 'unpack 'unpack-submodule-sources
462 (lambda* (#:key inputs #:allow-other-keys)
463 (mkdir "../opencv-extra")
464 (mkdir "../opencv-contrib")
465 (copy-recursively (assoc-ref inputs "opencv-extra")
468 (assoc-ref inputs "opencv-contrib")
469 "--strip-components=1"
470 "-C" "../opencv-contrib")))
472 (add-after 'set-paths 'add-ilmbase-include-path
473 (lambda* (#:key inputs #:allow-other-keys)
474 ;; OpenEXR propagates ilmbase, but its include files do not appear
475 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
476 ;; the CPATH to satisfy the dependency on "ImathVec.h".
478 (string-append (assoc-ref inputs "ilmbase")
480 ":" (or (getenv "CPATH") "")))
482 (add-before 'check 'start-xserver
483 (lambda* (#:key inputs #:allow-other-keys)
484 (let ((xorg-server (assoc-ref inputs "xorg-server"))
486 (setenv "HOME" (getcwd))
487 (setenv "DISPLAY" disp)
488 ;; There must be a running X server and make check doesn't start one.
489 ;; Therefore we must do it.
490 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
492 `(("pkg-config" ,pkg-config)
493 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
498 (url "https://github.com/opencv/opencv_extra")
500 (file-name (git-file-name "opencv_extra" version))
502 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
507 (url "https://github.com/opencv/opencv_contrib")
509 (file-name (git-file-name "opencv_contrib" version))
510 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
512 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
513 (inputs `(("libjpeg" ,libjpeg-turbo)
516 ;; ffmpeg 4.0 causes core dumps in tests.
517 ("ffmpeg" ,ffmpeg-3.4)
520 ("libgphoto2" ,libgphoto2)
523 ("gtkglext" ,gtkglext)
527 ("python-numpy" ,python-numpy)
528 ("protobuf" ,protobuf)
531 ;; These three CVEs are not a problem of OpenCV, see:
532 ;; https://github.com/opencv/opencv/issues/10998
533 (properties '((lint-hidden-cve . ("CVE-2018-7712"
536 (synopsis "Computer vision library")
537 (description "OpenCV is a library aimed at
538 real-time computer vision, including several hundred computer
539 vision algorithms. It can be used to do things like:
542 @item image and video input and output
543 @item image and video processing
545 @item feature recognition
547 @item facial recognition
549 @item structure from motion
550 @item augmented reality
551 @item machine learning
553 (home-page "https://opencv.org/")
554 (license license:bsd-3)))
564 "https://github.com/libvips/libvips/releases/download/v"
565 version "/vips-" version ".tar.gz"))
567 (base32 "0vjsh3i0861f6h9as3bch956cidz824zz499pvhjs3lfjn6hhs14"))))
568 (build-system gnu-build-system)
570 `(("gobject-introspection" ,gobject-introspection)
571 ("pkg-config" ,pkg-config)))
578 ("imagemagick" ,imagemagick)
582 ("libjpeg" ,libjpeg-turbo)
589 ("niftilib" ,niftilib)
593 ("poppler" ,poppler)))
594 (home-page "https://libvips.github.io/libvips/")
595 (synopsis "Multithreaded image processing system with low memory needs")
597 "VIPS is a demand-driven, horizontally threaded image processing library.
598 It's particularly good at processing large images, working with colour,
599 scientific analysis, and general research & development.
601 Compared to most image processing libraries VIPS needs little RAM and runs
602 quickly, especially on machines with more than one CPU core. This is primarily
603 due to its architecture which automatically parallelises the image workflows.")
604 (license license:lgpl2.1+)))
613 (uri (string-append "https://gmic.eu/files/source/gmic_"
616 (base32 "06n1dcskky7aqg3a0cp7biwz8agc4xqvr8091l2wsvgib98yhbyj"))))
617 (build-system cmake-build-system)
619 `(#:tests? #f ;there are no tests
620 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
621 "-DENABLE_DYNAMIC_LINKING=ON"
624 (modify-phases %standard-phases
625 (add-before 'configure 'set-LDFLAGS
626 (lambda* (#:key inputs outputs #:allow-other-keys)
630 (assoc-ref outputs "out") "/lib")))))))
632 `(("pkg-config" ,pkg-config)))
636 ("graphicsmagick" ,graphicsmagick)
637 ("libjpeg-turbo" ,libjpeg-turbo)
641 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
644 (home-page "https://gmic.eu/")
645 (synopsis "Full-featured framework for digital image processing")
646 (description "G'MIC is a full-featured framework for digital image
647 processing. It provides several user interfaces to convert / manipulate
648 / filter / visualize generic image datasets, ranging from 1D scalar
649 signals to 3D+t sequences of multi-spectral volumetric images, hence
650 including 2D color images.")
651 ;; Dual-licensed, either license applies.
652 (license (list license:cecill license:cecill-c))))
654 (define-public gmic-qt
659 (substitute-keyword-arguments (package-arguments gmic)
660 ((#:configure-flags _)
661 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
662 (string-append "-DGMIC_LIB_PATH="
663 (assoc-ref %build-inputs "gmic") "/lib")))
665 `(modify-phases ,phases
666 (add-after 'unpack 'qt-chdir
667 (lambda _ (chdir "gmic-qt") #t))))))
669 `(("pkg-config" ,pkg-config)
670 ("qttools" ,qttools)))
674 ,@(package-inputs gmic)))
675 (synopsis "Qt frontend for the G'MIC image processing framework")
676 (license license:gpl3+)))
678 (define-public gmic-qt-krita
681 (name "gmic-qt-krita")
683 (substitute-keyword-arguments (package-arguments gmic-qt)
684 ((#:configure-flags flags)
685 '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
686 (string-append "-DGMIC_LIB_PATH="
687 (assoc-ref %build-inputs "gmic") "/lib")))))
688 (synopsis "Krita plugin for the G'MIC image processing framework")))
697 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
698 version "/nip2-" version ".tar.gz" ))
700 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
701 (build-system gnu-build-system)
704 (modify-phases %standard-phases
705 ;; test_conv.ws keep failing so disabling for now.
706 (add-after 'unpack 'disable-test-conv
708 (delete-file "test/workspaces/test_conv.ws")
710 (add-before 'check 'set-home
712 (setenv "HOME" "/tmp") #t)))))
720 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
724 ("imagemagick" ,imagemagick)
735 ("pkg-config" ,pkg-config)))
736 (home-page "https://github.com/libvips/nip2")
737 (synopsis "Spreadsheet-like GUI for libvips")
738 (description "This package provide a graphical user interface (GUI) for
739 the VIPS image processing library. It's a little like a spreadsheet: you
740 create a set of formula connecting your objects together, and on a change nip2
742 (license license:gpl2+)))
752 (url "https://github.com/vxl/vxl")
753 (commit (string-append "v" version))))
754 (file-name (git-file-name name version))
756 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
757 (modules '((guix build utils)))
758 ;; TODO: vxl includes an old version of dcmtk. It won't build with
762 (for-each delete-file-recursively
769 (substitute* "v3p/CMakeLists.txt"
770 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
773 (build-system cmake-build-system)
775 `(("libgeotiff" ,libgeotiff)
777 ("libjpeg" ,libjpeg-turbo)
780 (home-page "https://github.com/vxl/vxl/")
781 (synopsis "Collection of C++ libraries for computer vision")
782 (description "VXL (the Vision-something-Libraries) is a collection of C++
783 libraries designed for computer vision research and implementation.")
784 (license license:bsd-3)))
787 (package (inherit vxl)
794 (url "https://github.com/vxl/vxl")
795 (commit (string-append "v" version))))
796 (file-name (git-file-name name version))
798 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
799 (modules '((guix build utils)))
802 (for-each delete-file-recursively
808 (substitute* "v3p/CMakeLists.txt"
809 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
814 ;; Needed for itk-snap
815 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
817 (define-public insight-toolkit
819 (name "insight-toolkit")
824 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
825 "releases/download/v" version "/InsightToolkit-"
828 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
829 (build-system cmake-build-system)
831 `(#:tests? #f ; tests require network access and external data
834 "-DITK_USE_SYSTEM_LIBRARIES=ON"
835 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
836 "-DITK_BUILD_SHARED=ON"
837 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
838 ;; variable in the installed CMake files. This is necessary as other
839 ;; packages using insight-toolkit could not be configured otherwise.
840 "-DGTEST_ROOT=gtest")
842 (modify-phases %standard-phases
843 (add-after 'unpack 'do-not-tune
845 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
846 (("-mute=native") ""))
854 ("libjpeg" ,libjpeg-turbo)
857 ("mesa" ,mesa-opencl)
864 `(("googletest" ,googletest)
865 ("pkg-config" ,pkg-config)))
866 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
867 (synopsis "Scientific image processing, segmentation and registration")
868 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
869 scientific image processing, segmentation, and registration. Segmentation is
870 the process of identifying and classifying data found in a digitally sampled
871 representation. Typically the sampled representation is an image acquired
872 from such medical instrumentation as CT or MRI scanners. Registration is the
873 task of aligning or developing correspondences between data. For example, in
874 the medical environment, a CT scan may be aligned with a MRI scan in order to
875 combine the information contained in both.")
876 (license license:asl2.0)))
878 (define-public insight-toolkit-4
879 (package (inherit insight-toolkit)
884 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
885 "releases/download/v" version "/InsightToolkit-"
888 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
890 `(#:tests? #f ; tests require network access and external data
892 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
894 "-DITK_USE_SYSTEM_LIBRARIES=ON"
895 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
896 "-DITK_USE_SYSTEM_VXL=ON")))))
898 (define-public insight-toolkit-4.12
899 (package (inherit insight-toolkit-4)
904 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
905 "InsightToolkit-" version ".tar.xz"))
907 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
909 (define-public itk-snap
917 (url "https://git.code.sf.net/p/itk-snap/src")
918 (commit (string-append "v" version))))
919 (file-name (git-file-name name version))
921 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
922 (build-system cmake-build-system)
925 (list "-DSNAP_VERSION_GIT_SHA1=release"
926 "-DSNAP_VERSION_GIT_BRANCH=release"
927 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
928 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
929 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
931 (modify-phases %standard-phases
932 ;; During the installation phase all libraries provided by all
933 ;; dependencies will be copied to the lib directory. That's insane,
934 ;; so we disable this.
935 (add-after 'unpack 'do-not-copy-dependencies
937 (substitute* "CMakeLists.txt"
938 (("install_qt5_executable\
939 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
942 (add-after 'unpack 'disable-gui-tests
944 ;; The GUI tests just time out.
945 (substitute* "CMakeLists.txt"
946 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
947 |RandomForest|RandomForestBailOut)")
950 (add-after 'unpack 'make-reproducible
952 (substitute* "CMakeLists.txt"
953 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
954 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
956 (add-after 'unpack 'prepare-submodules
957 (lambda* (#:key inputs #:allow-other-keys)
958 (rmdir "Submodules/c3d")
959 (copy-recursively (assoc-ref inputs "c3d-src")
961 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
962 "Submodules/c3d/adapters/ApplyMetric.cxx")
964 (rmdir "Submodules/greedy")
965 (symlink (assoc-ref inputs "greedy-src")
968 (add-after 'unpack 'fix-includes
970 (substitute* "GUI/Model/RegistrationModel.cxx"
971 (("<vnl_symmetric_eigensystem.h>")
972 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
974 (add-before 'check 'prepare-tests
976 ;; Needed by at least one test.
977 (setenv "HOME" "/tmp")
979 (add-after 'install 'wrap-executable
980 (lambda* (#:key inputs outputs #:allow-other-keys)
981 (let ((out (assoc-ref outputs "out")))
982 (wrap-program (string-append out "/bin/itksnap")
983 `("QT_PLUGIN_PATH" ":" prefix
984 ,(map (lambda (label)
985 (string-append (assoc-ref inputs label)
987 '("qtbase" "qtdeclarative"))))
995 ("mesa" ,mesa-opencl)
996 ;; This package does not build with either insight-toolkit 5.0.0 and
997 ;; not with 4.13. It really needs to be 4.12.
998 ("itk" ,insight-toolkit-4.12)
1001 ("qtdeclarative" ,qtdeclarative)
1005 `(("googletest" ,googletest)
1006 ("qttools" ,qttools)
1007 ("pkg-config" ,pkg-config)
1009 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1011 (version (git-version "0" revision commit)))
1015 (url "https://github.com/pyushkevich/c3d")
1017 (file-name (git-file-name "c3d" version))
1020 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1021 ;; We are using an arbitrary commit from 2017 because the latest
1022 ;; version breaks the build...
1024 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1026 (version (git-version "0" revision commit)))
1030 (url "https://github.com/pyushkevich/greedy")
1032 (file-name (git-file-name "greedy" version))
1035 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1036 (home-page "https://sourceforge.net/p/itk-snap/")
1037 (synopsis "Medical image segmentation")
1038 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1039 medical images. It provides an automatic active contour segmentation
1040 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1041 full-featured UI aimed at clinical researchers.")
1042 ;; This includes the submodules greedy and c3d.
1043 (license license:gpl3+)))
1045 (define-public metapixel
1046 ;; Follow stable branch.
1047 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1050 (version (git-version "1.0.2" "1" commit))
1055 (url "https://github.com/schani/metapixel")
1057 ;; TODO: Package rwimg and lispreader?
1059 (file-name (git-file-name name version))
1061 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1062 (build-system gnu-build-system)
1064 `(("giflib" ,giflib)
1065 ("libjpeg" ,libjpeg-turbo)
1069 `(("pkg-config" ,pkg-config)
1070 ("docbook-xml" ,docbook-xml)
1071 ("docbook-xsl" ,docbook-xsl)
1072 ("xsltproc" ,libxslt)))
1074 `(#:tests? #f ; No tests.
1076 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1077 (string-append "MANPAGE_XSL="
1078 (assoc-ref %build-inputs "docbook-xsl")
1079 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1081 (modify-phases %standard-phases
1083 (add-before 'install 'make-local-docbook-xml
1084 (lambda* (#:key inputs #:allow-other-keys)
1085 (substitute* "metapixel.xml"
1086 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1087 (string-append (assoc-ref inputs "docbook-xml")
1088 "/xml/dtd/docbook/docbookx.dtd")))
1090 (add-before 'install 'fix-directory-creation
1091 (lambda* (#:key outputs #:allow-other-keys)
1092 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1094 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1095 (synopsis "Photomosaics generator")
1096 (description "Metapixel is a program for generating photomosaics. It can
1097 generate classical photomosaics, in which the source image is viewed as a
1098 matrix of equally sized rectangles for each of which a matching image is
1099 substituted, as well as collage-style photomosaics, in which rectangular parts
1100 of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1101 substituted by matching images.")
1102 (license license:gpl2))))
1104 (define-public scantailor-advanced
1105 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1107 (name "scantailor-advanced")
1108 (version (string-append "1.0.16-" (string-take commit 7)))
1113 (url "https://github.com/4lex4/scantailor-advanced")
1115 (file-name (git-file-name name version))
1118 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1119 (build-system qt-build-system)
1121 `(("qttools" ,qttools)))
1124 ("libjpeg" ,libjpeg-turbo)
1126 ("libtiff" ,libtiff)
1132 (modify-phases %standard-phases
1133 ;; Some tests require a display and fail with offscreen mode.
1134 (add-after 'unpack 'disable-failing-tests
1136 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1138 (home-page "https://github.com/4lex4/scantailor-advanced")
1139 (synopsis "Clean up scanned pages")
1140 (description "Scan Tailor is an interactive post-processing tool for
1141 scanned pages. It performs operations such as page splitting, deskewing,
1142 adding/removing borders, and others. You give it raw scans, and you get pages
1143 ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1144 character recognition, and assembling multi-page documents are out of scope of
1147 Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1148 and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1149 (license license:gpl3+))))
1151 (define-public stiff
1158 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1161 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1162 (build-system gnu-build-system)
1164 `(("libtiff" ,libtiff)
1166 ("libjpeg-turbo" ,libjpeg-turbo)))
1167 (home-page "https://www.astromatic.net/software/stiff")
1168 (synopsis "Convert scientific FITS images to TIFF format")
1170 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1171 Transport System} images to the more popular TIFF format for illustration
1173 (license license:gpl3+)))