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, 2019, 2020 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>
17 ;;; This file is part of GNU Guix.
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32 (define-module (gnu packages image-processing)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix utils)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix build-system qt)
39 #:use-module (guix build-system cmake)
40 #:use-module (guix build-system gnu)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages algebra)
43 #:use-module (gnu packages bison)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages curl)
48 #:use-module (gnu packages docbook)
49 #:use-module (gnu packages documentation)
50 #:use-module (gnu packages flex)
51 #:use-module (gnu packages fontutils)
52 #:use-module (gnu packages geo)
53 #:use-module (gnu packages ghostscript)
54 #:use-module (gnu packages gl)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gnome)
57 #:use-module (gnu packages graphics)
58 #:use-module (gnu packages graphviz)
59 #:use-module (gnu packages gstreamer)
60 #:use-module (gnu packages gtk)
61 #:use-module (gnu packages image)
62 #:use-module (gnu packages imagemagick)
63 #:use-module (gnu packages maths)
64 #:use-module (gnu packages pdf)
65 #:use-module (gnu packages perl)
66 #:use-module (gnu packages photo)
67 #:use-module (gnu packages pkg-config)
68 #:use-module (gnu packages protobuf)
69 #:use-module (gnu packages python)
70 #:use-module (gnu packages python-xyz)
71 #:use-module (gnu packages qt)
72 #:use-module (gnu packages serialization)
73 #:use-module (gnu packages sqlite)
74 #:use-module (gnu packages tbb)
75 #:use-module (gnu packages tls)
76 #:use-module (gnu packages version-control)
77 #:use-module (gnu packages video)
78 #:use-module (gnu packages xiph)
79 #:use-module (gnu packages xml)
80 #:use-module (gnu packages xorg)
81 #:use-module (ice-9 match)
82 #:use-module (srfi srfi-1))
92 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
93 "dcmtk" (string-join (string-split version #\.) "")
94 "/dcmtk-" version ".tar.gz"))
96 (base32 "1fdyz5wwjp4grys61mxb2ia9fi6i3ax6s43l16xnv291bxk7hld0"))))
97 (build-system cmake-build-system)
99 `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“.
101 ("libjpeg" ,libjpeg-turbo)
108 `(("doxygen" ,doxygen))) ; for HTML documentation
109 (home-page "https://dcmtk.org")
110 (synopsis "Libraries and programs implementing parts of the DICOM standard")
111 (description "DCMTK is a collection of libraries and applications
112 implementing large parts the DICOM standard. It includes software for
113 examining, constructing and converting DICOM image files, handling offline
114 media, sending and receiving images over a network connection, as well as
115 demonstrative image storage and worklist servers.")
116 (license (license:fsf-free
118 "A union of the Apache 2.0 licence and various non-copyleft
119 licences similar to the Modified BSD licence."))))
127 (uri (string-append "mirror://sourceforge/mia/mia/"
128 (version-major+minor version)
129 "/mia-" version ".tar.xz"))
132 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
133 (build-system cmake-build-system)
136 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
137 "-DCMAKE_CXX_FLAGS=-fpermissive")))
149 ("libjpeg" ,libjpeg-turbo)
153 ("libxml++" ,libxml++)
155 ("niftilib" ,niftilib)
158 ("python-lxml" ,python2-lxml)
161 `(("pkg-config" ,pkg-config)
162 ("python" ,python-2)))
163 (home-page "http://mia.sourceforge.net")
164 (synopsis "Toolkit for gray scale medical image analysis")
165 (description "MIA provides a combination of command line tools, plug-ins,
166 and libraries that make it possible run image processing tasks interactively
167 in a command shell and to prototype using the shell's scripting language. It
168 is built around a plug-in structure that makes it easy to add functionality
169 without compromising the original code base and it makes use of a wide variety
170 of external libraries that provide additional functionality.")
171 (license license:gpl3+)))
173 (define-public opencolorio
181 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
182 (commit (string-append "v" version))))
184 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
185 (file-name (git-file-name name version))
186 (modules '((guix build utils)))
189 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
190 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
191 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
192 ;; When removing it, also remove it from the licence field comment.
193 (for-each delete-file-recursively
196 (let ((file (basename full-name)))
197 (not (or (string-prefix? "yaml-cpp-0.3" file)
198 (string=? "unittest.h" file)))))
199 (find-files "ext" ".*")))
202 (build-system cmake-build-system)
205 (list (string-append "-DCMAKE_CXX_FLAGS="
206 "-Wno-error=deprecated-declarations "
207 "-Wno-error=unused-function")
208 "-DOCIO_BUILD_STATIC=OFF"
209 ;; "-DUSE_EXTERNAL_YAML=ON"
210 "-DUSE_EXTERNAL_TINYXML=ON"
211 "-DUSE_EXTERNAL_LCMS=ON")
213 (modify-phases %standard-phases
214 (add-after 'unpack 'patch-test-suite
216 (substitute* "src/core_tests/CMakeLists.txt"
217 (("/bin/sh") (which "bash")))
221 ("pkg-config" ,pkg-config)))
223 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
224 ;; ocioconvert fails: error: conflicting declaration ?typedef void
225 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
228 ("tinyxml" ,tinyxml)))
229 (home-page "https://opencolorio.org")
230 (synopsis "Color management for visual effects and animation")
232 "OpenColorIO, or OCIO, is a complete color management solution geared
233 towards motion picture production, with an emphasis on visual effects and
234 computer animation. It provides a straightforward and consistent user
235 experience across all supporting applications while allowing for sophisticated
236 back-end configuration options suitable for high-end production usage.
238 OCIO is compatible with the @acronym{ACES, Academy Color Encoding
239 Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
240 many popular formats.")
241 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
242 license:zlib ; src/core/md5
243 license:bsd-3)))) ; the rest
251 (uri (string-append "https://vtk.org/files/release/"
252 (version-major+minor version)
253 "/VTK-" version ".tar.gz"))
256 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))
257 (modules '((guix build utils)))
262 (delete-file-recursively
263 (string-append "ThirdParty/" dir "/vtk" dir)))
264 ;; ogg, pugixml depended upon unconditionally
265 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
266 "glew" "hdf5" "jpeg" "jsoncpp" "libproj" "libxml2" "lz4"
267 "netcdf" "png" "sqlite" "theora" "tiff" "zlib"))
269 (build-system cmake-build-system)
271 '(#:build-type "Release" ;Build without '-g' to save space.
272 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
273 ;"-DVTK_MODULE_USE_EXTERNAL_vtkogg:BOOL=TRUE" ; not honored
274 "-DVTK_USE_SYSTEM_DOUBLECONVERSION:BOOL=TRUE"
275 "-DVTK_USE_SYSTEM_EIGEN:BOOL=TRUE"
276 "-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
277 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
278 "-DVTK_USE_SYSTEM_GL2PS:BOOL=TRUE"
279 "-DVTK_USE_SYSTEM_GLEW:BOOL=TRUE"
280 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
281 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
282 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
283 "-DVTK_USE_SYSTEM_LIBPROJ:BOOL=TRUE"
284 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
285 "-DVTK_USE_SYSTEM_LZ4:BOOL=TRUE"
286 "-DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE"
287 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
288 ;"-DVTK_USE_SYSTEM_PUGIXML:BOOL=TRUE" ; breaks IO/CityGML
289 "-DVTK_USE_SYSTEM_SQLITE:BOOL=TRUE"
290 "-DVTK_USE_SYSTEM_THEORA:BOOL=TRUE"
291 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
292 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
293 #:tests? #f)) ;XXX: test data not included
295 `(("double-conversion" ,double-conversion)
298 ("freetype" ,freetype)
303 ("jpeg" ,libjpeg-turbo)
306 ("libtheora" ,libtheora)
315 ;("pugixml" ,pugixml)
318 ("xorgproto" ,xorgproto)
320 (home-page "https://vtk.org/")
321 (synopsis "Libraries for 3D computer graphics")
323 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
324 image processing and visualization. It supports a wide variety of
325 visualization algorithms including: scalar, vector, tensor, texture, and
326 volumetric methods; and advanced modeling techniques such as: implicit
327 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
328 triangulation. VTK has an extensive information visualization framework, has
329 a suite of 3D interaction widgets, supports parallel processing, and
330 integrates with various databases on GUI toolkits such as Qt and Tk.")
331 (license license:bsd-3)))
333 ;; itksnap needs an older variant of VTK.
335 (package (inherit vtk)
339 (uri (string-append "https://vtk.org/files/release/"
340 (version-major+minor version)
341 "/VTK-" version ".tar.gz"))
344 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
346 `(("jsoncpp" ,jsoncpp-for-tensorflow)
347 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
349 (define-public opencv
356 (url "https://github.com/opencv/opencv")
358 (file-name (git-file-name name version))
361 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
363 (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
364 (modules '((guix build utils)))
367 ;; Remove external libraries. We have all available in Guix:
368 (delete-file-recursively "3rdparty")
370 ;; Milky icon set is non-free:
371 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
374 (for-each delete-file
375 '("modules/java/test/pure_test/lib/junit-4.11.jar"
376 "samples/java/sbt/sbt/sbt-launch.jar"))
378 (build-system cmake-build-system)
381 (list "-DWITH_IPP=OFF"
383 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
384 "-DENABLE_PRECOMPILED_HEADERS=OFF"
387 ;; See cmake/OpenCVCompilerOptimizations.cmake
388 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
389 ;; BASELINE is the minimum optimization all CPUs must support
391 ;; DISPATCH is the list of optional dispatches.
392 "-DCPU_BASELINE=SSE2"
394 ,@(match (%current-system)
396 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
397 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
399 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
401 '("-DCPU_BASELINE=NEON"
402 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
405 "-DBUILD_PERF_TESTS=OFF"
408 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
409 "/opencv-contrib/modules")
412 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
413 "/opencv-extra/testdata")
415 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
416 ;; which we had removed, which would lead to an error:
417 "-DBUILD_PROTOBUF=OFF"
419 ;; Rebuild protobuf files, because we have a slightly different
420 ;; version than the included one. If we would not update, we
421 ;; would get a compile error later:
422 "-DPROTOBUF_UPDATE_FILES=ON"
424 ;; xfeatures2d disabled, because it downloads extra binaries from
425 ;; https://github.com/opencv/opencv_3rdparty
426 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
427 ;; Cmp this bug entry:
428 ;; https://github.com/opencv/opencv_contrib/issues/1131
429 "-DBUILD_opencv_xfeatures2d=OFF")
431 (modify-phases %standard-phases
432 (add-after 'unpack 'disable-broken-tests
434 ;; These tests fails with:
435 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
436 ;; I think we have no OpenGL support with the Xvfb.
437 (substitute* '("modules/viz/test/test_tutorial3.cpp"
438 "modules/viz/test/test_main.cpp"
439 "modules/viz/test/tests_simple.cpp"
440 "modules/viz/test/test_viz3d.cpp")
441 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
442 (string-append pre "DISABLED_" post)))
444 ;; This one fails with "unknown file: Failure"
445 ;; But I couldn't figure out which file was missing:
446 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
447 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
449 (string-append pre "DISABLED_" post)))
451 ;; Failure reason: Bad accuracy
452 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
453 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
454 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
455 (string-append pre "DISABLED_" post)))
458 (add-after 'unpack 'unpack-submodule-sources
459 (lambda* (#:key inputs #:allow-other-keys)
460 (mkdir "../opencv-extra")
461 (mkdir "../opencv-contrib")
462 (copy-recursively (assoc-ref inputs "opencv-extra")
465 (assoc-ref inputs "opencv-contrib")
466 "--strip-components=1"
467 "-C" "../opencv-contrib")))
469 (add-after 'set-paths 'add-ilmbase-include-path
470 (lambda* (#:key inputs #:allow-other-keys)
471 ;; OpenEXR propagates ilmbase, but its include files do not appear
472 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
473 ;; the CPATH to satisfy the dependency on "ImathVec.h".
475 (string-append (assoc-ref inputs "ilmbase")
477 ":" (or (getenv "CPATH") "")))
479 (add-before 'check 'start-xserver
480 (lambda* (#:key inputs #:allow-other-keys)
481 (let ((xorg-server (assoc-ref inputs "xorg-server"))
483 (setenv "HOME" (getcwd))
484 (setenv "DISPLAY" disp)
485 ;; There must be a running X server and make check doesn't start one.
486 ;; Therefore we must do it.
487 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
489 `(("pkg-config" ,pkg-config)
490 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
495 (url "https://github.com/opencv/opencv_extra")
497 (file-name (git-file-name "opencv_extra" version))
499 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
504 (url "https://github.com/opencv/opencv_contrib")
506 (file-name (git-file-name "opencv_contrib" version))
507 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
509 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
510 (inputs `(("libjpeg" ,libjpeg-turbo)
513 ;; ffmpeg 4.0 causes core dumps in tests.
514 ("ffmpeg" ,ffmpeg-3.4)
517 ("libgphoto2" ,libgphoto2)
520 ("gtkglext" ,gtkglext)
524 ("python-numpy" ,python-numpy)
525 ("protobuf" ,protobuf)
528 ;; These three CVEs are not a problem of OpenCV, see:
529 ;; https://github.com/opencv/opencv/issues/10998
530 (properties '((lint-hidden-cve . ("CVE-2018-7712"
533 (synopsis "Computer vision library")
534 (description "OpenCV is a library aimed at
535 real-time computer vision, including several hundred computer
536 vision algorithms. It can be used to do things like:
539 @item image and video input and output
540 @item image and video processing
542 @item feature recognition
544 @item facial recognition
546 @item structure from motion
547 @item augmented reality
548 @item machine learning
550 (home-page "https://opencv.org/")
551 (license license:bsd-3)))
561 "https://github.com/libvips/libvips/releases/download/v"
562 version "/vips-" version ".tar.gz"))
564 (base32 "1n6gw7cw66rfn1wdb92ydpkv7gfmjiinsg6d6gqxpdja6gsz5vm4"))))
565 (build-system gnu-build-system)
567 `(("gobject-introspection" ,gobject-introspection)
568 ("pkg-config" ,pkg-config)))
575 ("imagemagick" ,imagemagick)
579 ("libjpeg" ,libjpeg-turbo)
586 ("niftilib" ,niftilib)
590 ("poppler" ,poppler)))
591 (home-page "https://libvips.github.io/libvips/")
592 (synopsis "Multithreaded image processing system with low memory needs")
594 "VIPS is a demand-driven, horizontally threaded image processing library.
595 It's particularly good at processing large images, working with colour,
596 scientific analysis, and general research & development.
598 Compared to most image processing libraries VIPS needs little RAM and runs
599 quickly, especially on machines with more than one CPU core. This is primarily
600 due to its architecture which automatically parallelises the image workflows.")
601 (license license:lgpl2.1+)))
610 (uri (string-append "https://gmic.eu/files/source/gmic_"
613 (base32 "06n1dcskky7aqg3a0cp7biwz8agc4xqvr8091l2wsvgib98yhbyj"))))
614 (build-system cmake-build-system)
616 `(#:tests? #f ;there are no tests
617 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
618 "-DENABLE_DYNAMIC_LINKING=ON"
621 (modify-phases %standard-phases
622 (add-before 'configure 'set-LDFLAGS
623 (lambda* (#:key inputs outputs #:allow-other-keys)
627 (assoc-ref outputs "out") "/lib")))))))
629 `(("pkg-config" ,pkg-config)))
633 ("graphicsmagick" ,graphicsmagick)
634 ("libjpeg-turbo" ,libjpeg-turbo)
638 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
641 (home-page "https://gmic.eu/")
642 (synopsis "Full-featured framework for digital image processing")
643 (description "G'MIC is a full-featured framework for digital image
644 processing. It provides several user interfaces to convert / manipulate
645 / filter / visualize generic image datasets, ranging from 1D scalar
646 signals to 3D+t sequences of multi-spectral volumetric images, hence
647 including 2D color images.")
648 ;; Dual-licensed, either license applies.
649 (license (list license:cecill license:cecill-c))))
651 (define-public gmic-qt
656 (substitute-keyword-arguments (package-arguments gmic)
657 ((#:configure-flags _)
658 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
659 (string-append "-DGMIC_LIB_PATH="
660 (assoc-ref %build-inputs "gmic") "/lib")))
662 `(modify-phases ,phases
663 (add-after 'unpack 'qt-chdir
664 (lambda _ (chdir "gmic-qt") #t))))))
666 `(("pkg-config" ,pkg-config)
667 ("qttools" ,qttools)))
671 ,@(package-inputs gmic)))
672 (synopsis "Qt frontend for the G'MIC image processing framework")
673 (license license:gpl3+)))
682 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
683 version "/nip2-" version ".tar.gz" ))
685 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
686 (build-system gnu-build-system)
689 (modify-phases %standard-phases
690 ;; test_conv.ws keep failing so disabling for now.
691 (add-after 'unpack 'disable-test-conv
693 (delete-file "test/workspaces/test_conv.ws")
695 (add-before 'check 'set-home
697 (setenv "HOME" "/tmp") #t)))))
705 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
709 ("imagemagick" ,imagemagick)
720 ("pkg-config" ,pkg-config)))
721 (home-page "https://github.com/libvips/nip2")
722 (synopsis "Spreadsheet-like GUI for libvips")
723 (description "This package provide a graphical user interface (GUI) for
724 the VIPS image processing library. It's a little like a spreadsheet: you
725 create a set of formula connecting your objects together, and on a change nip2
727 (license license:gpl2+)))
737 (url "https://github.com/vxl/vxl")
738 (commit (string-append "v" version))))
739 (file-name (git-file-name name version))
741 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
742 (modules '((guix build utils)))
743 ;; TODO: vxl includes an old version of dcmtk. It won't build with
747 (for-each delete-file-recursively
754 (substitute* "v3p/CMakeLists.txt"
755 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
758 (build-system cmake-build-system)
760 `(("libgeotiff" ,libgeotiff)
762 ("libjpeg" ,libjpeg-turbo)
765 (home-page "https://github.com/vxl/vxl/")
766 (synopsis "Collection of C++ libraries for computer vision")
767 (description "VXL (the Vision-something-Libraries) is a collection of C++
768 libraries designed for computer vision research and implementation.")
769 (license license:bsd-3)))
772 (package (inherit vxl)
779 (url "https://github.com/vxl/vxl")
780 (commit (string-append "v" version))))
781 (file-name (git-file-name name version))
783 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
784 (modules '((guix build utils)))
787 (for-each delete-file-recursively
793 (substitute* "v3p/CMakeLists.txt"
794 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
799 ;; Needed for itk-snap
800 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
802 (define-public insight-toolkit
804 (name "insight-toolkit")
809 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
810 "releases/download/v" version "/InsightToolkit-"
813 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
814 (build-system cmake-build-system)
816 `(#:tests? #f ; tests require network access and external data
819 "-DITK_USE_SYSTEM_LIBRARIES=ON"
820 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
821 "-DITK_BUILD_SHARED=ON"
822 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
823 ;; variable in the installed CMake files. This is necessary as other
824 ;; packages using insight-toolkit could not be configured otherwise.
825 "-DGTEST_ROOT=gtest")
827 (modify-phases %standard-phases
828 (add-after 'unpack 'do-not-tune
830 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
831 (("-mute=native") ""))
839 ("libjpeg" ,libjpeg-turbo)
842 ("mesa" ,mesa-opencl)
849 `(("googletest" ,googletest)
850 ("pkg-config" ,pkg-config)))
851 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
852 (synopsis "Scientific image processing, segmentation and registration")
853 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
854 scientific image processing, segmentation, and registration. Segmentation is
855 the process of identifying and classifying data found in a digitally sampled
856 representation. Typically the sampled representation is an image acquired
857 from such medical instrumentation as CT or MRI scanners. Registration is the
858 task of aligning or developing correspondences between data. For example, in
859 the medical environment, a CT scan may be aligned with a MRI scan in order to
860 combine the information contained in both.")
861 (license license:asl2.0)))
863 (define-public insight-toolkit-4
864 (package (inherit insight-toolkit)
869 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
870 "releases/download/v" version "/InsightToolkit-"
873 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
875 `(#:tests? #f ; tests require network access and external data
877 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
879 "-DITK_USE_SYSTEM_LIBRARIES=ON"
880 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
881 "-DITK_USE_SYSTEM_VXL=ON")))))
883 (define-public insight-toolkit-4.12
884 (package (inherit insight-toolkit-4)
889 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
890 "InsightToolkit-" version ".tar.xz"))
892 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
894 (define-public itk-snap
902 (url "https://git.code.sf.net/p/itk-snap/src")
903 (commit (string-append "v" version))))
904 (file-name (git-file-name name version))
906 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
907 (build-system cmake-build-system)
910 (list "-DSNAP_VERSION_GIT_SHA1=release"
911 "-DSNAP_VERSION_GIT_BRANCH=release"
912 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
913 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
914 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
916 (modify-phases %standard-phases
917 ;; During the installation phase all libraries provided by all
918 ;; dependencies will be copied to the lib directory. That's insane,
919 ;; so we disable this.
920 (add-after 'unpack 'do-not-copy-dependencies
922 (substitute* "CMakeLists.txt"
923 (("install_qt5_executable\
924 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
927 (add-after 'unpack 'disable-gui-tests
929 ;; The GUI tests just time out.
930 (substitute* "CMakeLists.txt"
931 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
932 |RandomForest|RandomForestBailOut)")
935 (add-after 'unpack 'make-reproducible
937 (substitute* "CMakeLists.txt"
938 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
939 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
941 (add-after 'unpack 'prepare-submodules
942 (lambda* (#:key inputs #:allow-other-keys)
943 (rmdir "Submodules/c3d")
944 (copy-recursively (assoc-ref inputs "c3d-src")
946 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
947 "Submodules/c3d/adapters/ApplyMetric.cxx")
949 (rmdir "Submodules/greedy")
950 (symlink (assoc-ref inputs "greedy-src")
953 (add-after 'unpack 'fix-includes
955 (substitute* "GUI/Model/RegistrationModel.cxx"
956 (("<vnl_symmetric_eigensystem.h>")
957 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
959 (add-before 'check 'prepare-tests
961 ;; Needed by at least one test.
962 (setenv "HOME" "/tmp")
964 (add-after 'install 'wrap-executable
965 (lambda* (#:key inputs outputs #:allow-other-keys)
966 (let ((out (assoc-ref outputs "out")))
967 (wrap-program (string-append out "/bin/itksnap")
968 `("QT_PLUGIN_PATH" ":" prefix
969 ,(map (lambda (label)
970 (string-append (assoc-ref inputs label)
972 '("qtbase" "qtdeclarative"))))
980 ("mesa" ,mesa-opencl)
981 ;; This package does not build with either insight-toolkit 5.0.0 and
982 ;; not with 4.13. It really needs to be 4.12.
983 ("itk" ,insight-toolkit-4.12)
986 ("qtdeclarative" ,qtdeclarative)
990 `(("googletest" ,googletest)
992 ("pkg-config" ,pkg-config)
994 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
996 (version (git-version "0" revision commit)))
1000 (url "https://github.com/pyushkevich/c3d")
1002 (file-name (git-file-name "c3d" version))
1005 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1006 ;; We are using an arbitrary commit from 2017 because the latest
1007 ;; version breaks the build...
1009 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1011 (version (git-version "0" revision commit)))
1015 (url "https://github.com/pyushkevich/greedy")
1017 (file-name (git-file-name "greedy" version))
1020 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1021 (home-page "https://sourceforge.net/p/itk-snap/")
1022 (synopsis "Medical image segmentation")
1023 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1024 medical images. It provides an automatic active contour segmentation
1025 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1026 full-featured UI aimed at clinical researchers.")
1027 ;; This includes the submodules greedy and c3d.
1028 (license license:gpl3+)))
1030 (define-public metapixel
1031 ;; Follow stable branch.
1032 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1035 (version (git-version "1.0.2" "1" commit))
1040 (url "https://github.com/schani/metapixel")
1042 ;; TODO: Package rwimg and lispreader?
1044 (file-name (git-file-name name version))
1046 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1047 (build-system gnu-build-system)
1049 `(("giflib" ,giflib)
1050 ("libjpeg" ,libjpeg-turbo)
1054 `(("pkg-config" ,pkg-config)
1055 ("docbook-xml" ,docbook-xml)
1056 ("docbook-xsl" ,docbook-xsl)
1057 ("xsltproc" ,libxslt)))
1059 `(#:tests? #f ; No tests.
1061 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1062 (string-append "MANPAGE_XSL="
1063 (assoc-ref %build-inputs "docbook-xsl")
1064 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1066 (modify-phases %standard-phases
1068 (add-before 'install 'make-local-docbook-xml
1069 (lambda* (#:key inputs #:allow-other-keys)
1070 (substitute* "metapixel.xml"
1071 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1072 (string-append (assoc-ref inputs "docbook-xml")
1073 "/xml/dtd/docbook/docbookx.dtd")))
1075 (add-before 'install 'fix-directory-creation
1076 (lambda* (#:key outputs #:allow-other-keys)
1077 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1079 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1080 (synopsis "Photomosaics generator")
1081 (description "Metapixel is a program for generating photomosaics. It can
1082 generate classical photomosaics, in which the source image is viewed as a
1083 matrix of equally sized rectangles for each of which a matching image is
1084 substituted, as well as collage-style photomosaics, in which rectangular parts
1085 of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1086 substituted by matching images.")
1087 (license license:gpl2))))
1089 (define-public scantailor-advanced
1090 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1092 (name "scantailor-advanced")
1093 (version (string-append "1.0.16-" (string-take commit 7)))
1098 (url "https://github.com/4lex4/scantailor-advanced")
1100 (file-name (git-file-name name version))
1103 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1104 (build-system qt-build-system)
1106 `(("qttools" ,qttools)))
1109 ("libjpeg" ,libjpeg-turbo)
1111 ("libtiff" ,libtiff)
1117 (modify-phases %standard-phases
1118 ;; Some tests require a display and fail with offscreen mode.
1119 (add-after 'unpack 'disable-failing-tests
1121 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1123 (home-page "https://github.com/4lex4/scantailor-advanced")
1124 (synopsis "Clean up scanned pages")
1125 (description "Scan Tailor is an interactive post-processing tool for
1126 scanned pages. It performs operations such as page splitting, deskewing,
1127 adding/removing borders, and others. You give it raw scans, and you get pages
1128 ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1129 character recognition, and assembling multi-page documents are out of scope of
1132 Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1133 and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1134 (license license:gpl3+))))
1136 (define-public stiff
1143 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1146 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1147 (build-system gnu-build-system)
1149 `(("libtiff" ,libtiff)
1151 ("libjpeg-turbo" ,libjpeg-turbo)))
1152 (home-page "https://www.astromatic.net/software/stiff")
1153 (synopsis "Convert scientific FITS images to TIFF format")
1155 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1156 Transport System} images to the more popular TIFF format for illustration
1158 (license license:gpl3+)))