gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / image-processing.scm
index b3972a2..ed21b26 100644 (file)
@@ -1,13 +1,21 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
-;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2018 Lprndn <guix@lprndn.info>
-;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
+;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2021 Oleh Malyi <astroclubzp@gmail.com>
+;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
+;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,6 +38,7 @@
   #:use-module (guix utils)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system qt)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
@@ -39,6 +48,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
@@ -51,6 +61,7 @@
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
+  #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tbb)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
@@ -75,7 +88,7 @@
 (define-public dcmtk
   (package
     (name "dcmtk")
-    (version "3.6.4")
+    (version "3.6.6")
     (source
      (origin
        (method url-fetch)
                        "dcmtk" (string-join (string-split version #\.) "")
                        "/dcmtk-" version ".tar.gz"))
        (sha256
-        (base32 "1h22z8g0kmvhg8lgkbikyzyphhvxvq6018a00yd6i4g0z9ag6gx9"))))
+        (base32 "13j5yf3p6qj3mr17d77r3kcqchf055hgvk1w15vmdr8f54mwcnb8"))))
     (build-system cmake-build-system)
     (inputs
-     `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“.
-       ;; ("icu4c" ,icu4c)
-       ("libjpeg" ,libjpeg)
+     `(("icu4c" ,icu4c)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("libtiff" ,libtiff)
        ("libxml2" ,libxml2)
@@ -137,7 +149,7 @@ licences similar to the Modified BSD licence."))))
        ("gts" ,gts)
        ("hdf5" ,hdf5)
        ("itpp" ,itpp)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("libtiff" ,libtiff)
        ("libxml" ,libxml2)
@@ -161,10 +173,82 @@ without compromising the original code base and it makes use of a wide variety
 of external libraries that provide additional functionality.")
     (license license:gpl3+)))
 
+(define-public opencolorio
+  (package
+    (name "opencolorio")
+    (version "1.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
+       (file-name (git-file-name name version))
+       (modules '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Remove bundled tarballs, patches, and .jars(!).  XXX: Upstream
+           ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
+           ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
+           ;; When removing it, also remove it from the licence field comment.
+           (for-each delete-file-recursively
+                     (filter
+                      (lambda (full-name)
+                        (let ((file (basename full-name)))
+                          (not (or (string-prefix? "yaml-cpp-0.3" file)
+                                   (string=? "unittest.h" file)))))
+                      (find-files "ext" ".*")))
+
+           #t))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list (string-append "-DCMAKE_CXX_FLAGS="
+                            "-Wno-error=deprecated-declarations "
+                            "-Wno-error=unused-function")
+             "-DOCIO_BUILD_STATIC=OFF"
+             ;; "-DUSE_EXTERNAL_YAML=ON"
+             "-DUSE_EXTERNAL_TINYXML=ON"
+             "-DUSE_EXTERNAL_LCMS=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-test-suite
+           (lambda _
+             (substitute* "src/core_tests/CMakeLists.txt"
+               (("/bin/sh") (which "bash")))
+             #t)))))
+    (native-inputs
+     `(("git" ,git)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
+     ;; ocioconvert fails: error: conflicting declaration ?typedef void
+     ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
+     `(("lcms" ,lcms)
+       ("openexr" ,openexr)
+       ("tinyxml" ,tinyxml)))
+    (home-page "https://opencolorio.org")
+    (synopsis "Color management for visual effects and animation")
+    (description
+     "OpenColorIO, or OCIO, is a complete color management solution geared
+towards motion picture production, with an emphasis on visual effects and
+computer animation.  It provides a straightforward and consistent user
+experience across all supporting applications while allowing for sophisticated
+back-end configuration options suitable for high-end production usage.
+
+OCIO is compatible with the @acronym{ACES, Academy Color Encoding
+Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
+many popular formats.")
+    (license (list license:expat        ; docs/ociotheme/static, ext/yaml-cpp-*
+                   license:zlib         ; src/core/md5
+                   license:bsd-3))))    ; the rest
+
 (define-public vtk
   (package
     (name "vtk")
-    (version "8.2.0")
+    (version "9.0.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://vtk.org/files/release/"
@@ -172,39 +256,87 @@ of external libraries that provide additional functionality.")
                                   "/VTK-" version ".tar.gz"))
               (sha256
                (base32
-                "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
+                "1ir2lq9i45ls374lcmjzw0nrm5l5hnm1w47lg8g8d0n2j7hsaf8v"))
+              (patches
+               (search-patches "vtk-fix-freetypetools-build-failure.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (for-each
+                    (lambda (dir)
+                      (delete-file-recursively
+                        (string-append "ThirdParty/" dir "/vtk" dir)))
+                    ;; pugixml depended upon unconditionally
+                    '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
+                      "glew" "hdf5" "jpeg" "jsoncpp" "libproj" "libxml2" "lz4"
+                      "netcdf" "ogg" "png" "sqlite" "theora" "tiff" "zlib"))
+                  #t))))
+    (properties `((release-monitoring-url . "https://vtk.org/download/")))
     (build-system cmake-build-system)
     (arguments
      '(#:build-type "Release"           ;Build without '-g' to save space.
-       ;; -DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE requires netcdf_cxx
-       #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
-                           "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
-       #:tests? #f))                              ;XXX: no "test" target
+       #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
+                           ;    ; not honored
+                           "-DVTK_USE_EXTERNAL=OFF" ;; default
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
+                           ;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON"    ; breaks IO/CityGML
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
+                           "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
+                           )
+       #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-sources
+             (lambda _
+               (substitute* "Common/Core/vtkFloatingPointExceptions.cxx"
+                 (("<fenv.h>") "<cfenv>"))
+               (substitute* "Common/Core/CMakeLists.txt"
+                 (("fenv.h") "cfenv")))))
+       #:tests? #f))        ;XXX: test data not included
     (inputs
-     `(("libXt" ,libxt)
-       ("xorgproto" ,xorgproto)
-       ("libX11" ,libx11)
-       ("libxml2" ,libxml2)
-       ("mesa" ,mesa)
-       ("glu" ,glu)
+     `(("double-conversion" ,double-conversion)
+       ("eigen" ,eigen)
        ("expat" ,expat)
        ("freetype" ,freetype)
+       ("gl2ps" ,gl2ps)
+       ("glew" ,glew)
+       ("glu" ,glu)
        ("hdf5" ,hdf5)
-       ("jpeg" ,libjpeg)
+       ("jpeg" ,libjpeg-turbo)
        ("jsoncpp" ,jsoncpp)
-       ("libogg" ,libogg)
        ("libtheora" ,libtheora)
+       ("libX11" ,libx11)
+       ("libxml2" ,libxml2)
+       ("libXt" ,libxt)
+       ("lz4" ,lz4)
+       ("mesa" ,mesa)
+       ("netcdf" ,netcdf)
        ("png" ,libpng)
+       ("proj" ,proj.4)
+       ;("pugixml" ,pugixml)
+       ("sqlite" ,sqlite)
        ("tiff" ,libtiff)
+       ("xorgproto" ,xorgproto)
        ("zlib" ,zlib)))
+    (propagated-inputs
+     ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
+     ;; 'find_package(THEORA)', which in turns looks for libogg.
+     `(("libogg" ,libogg)))
     (home-page "https://vtk.org/")
     (synopsis "Libraries for 3D computer graphics")
     (description
@@ -218,6 +350,22 @@ a suite of 3D interaction widgets, supports parallel processing, and
 integrates with various databases on GUI toolkits such as Qt and Tk.")
     (license license:bsd-3)))
 
+;; freecad needs an old version of VTK, because VTK's API changed from 8 to 9
+(define-public vtk-8
+  (package (inherit vtk)
+    (version "8.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://vtk.org/files/release/"
+                                  (version-major+minor version)
+                                  "/VTK-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
+    (inputs
+     `(("jsoncpp" ,jsoncpp-for-tensorflow)
+       ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
+
 ;; itksnap needs an older variant of VTK.
 (define-public vtk-6
   (package (inherit vtk)
@@ -247,6 +395,8 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
               (sha256
                (base32
                 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
+              (patches
+               (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -373,7 +523,7 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
              (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
-       ("xorg-server" ,xorg-server) ; For running the tests
+       ("xorg-server" ,xorg-server-for-tests) ; For running the tests
        ("opencv-extra"
         ,(origin
            (method git-fetch)
@@ -393,7 +543,7 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
            (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
            (sha256
             (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
-    (inputs `(("libjpeg" ,libjpeg)
+    (inputs `(("libjpeg" ,libjpeg-turbo)
               ("libpng" ,libpng)
               ("jasper" ,jasper)
               ;; ffmpeg 4.0 causes core dumps in tests.
@@ -439,7 +589,7 @@ vision algorithms.  It can be used to do things like:
 (define-public vips
   (package
     (name "vips")
-    (version "8.7.4")
+    (version "8.10.6")
     (source
      (origin
        (method url-fetch)
@@ -447,33 +597,33 @@ vision algorithms.  It can be used to do things like:
              "https://github.com/libvips/libvips/releases/download/v"
              version "/vips-" version ".tar.gz"))
        (sha256
-        (base32 "01gjhcrl6zj7mcj1al717v5jsniahplqhz1xkfh2j78vyfl1hxff"))))
+        (base32 "0vjsh3i0861f6h9as3bch956cidz824zz499pvhjs3lfjn6hhs14"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("gobject-introspection" ,gobject-introspection)))
+     `(("gobject-introspection" ,gobject-introspection)
+       ("pkg-config" ,pkg-config)))
     (inputs
-     `(("glib" ,glib)
-       ("libjpeg" ,libjpeg)
+     `(("expat" ,expat)
+       ("fftw" ,fftw)
+       ("giflib" ,giflib)
+       ("glib" ,glib)
+       ("hdf5" ,hdf5)
+       ("imagemagick" ,imagemagick)
+       ("lcms" ,lcms)
+       ("libexif" ,libexif)
+       ("libgsf" ,libgsf)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("librsvg" ,librsvg)
        ("libtiff" ,libtiff)
-       ("libexif" ,libexif)
-       ("giflib" ,giflib)
-       ("libgsf" ,libgsf)
-       ("fftw" ,fftw)
-       ("poppler" ,poppler)
-       ("pango" ,pango)
-       ("lcms" ,lcms)
-       ("matio" ,matio)
+       ("libxml2" ,libxml2)
        ("libwebp" ,libwebp)
+       ("matio" ,matio)
        ("niftilib" ,niftilib)
        ("openexr" ,openexr)
        ("orc" ,orc)
-       ("imagemagick" ,imagemagick)
-       ("libxml2" ,libxml2)
-       ("expat" ,expat)
-       ("hdf5" ,hdf5)))
+       ("pango" ,pango)
+       ("poppler" ,poppler)))
     (home-page "https://libvips.github.io/libvips/")
     (synopsis "Multithreaded image processing system with low memory needs")
     (description
@@ -486,6 +636,90 @@ quickly, especially on machines with more than one CPU core.  This is primarily
 due to its architecture which automatically parallelises the image workflows.")
     (license license:lgpl2.1+)))
 
+(define-public gmic
+  (package
+    (name "gmic")
+    (version "2.9.7")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://gmic.eu/files/source/gmic_"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "05kzaplsl5qvxs7v6g73q0lq8dii8g6v77ap609188m7gr43f9cl"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f ;there are no tests
+       #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
+                           "-DENABLE_DYNAMIC_LINKING=ON"
+                           "-DENABLE_LTO=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'set-LDFLAGS
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "LDFLAGS"
+                     (string-append
+                      "-Wl,-rpath="
+                      (assoc-ref outputs "out") "/lib")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("curl" ,curl)
+       ("fftw" ,fftw)
+       ("graphicsmagick" ,graphicsmagick)
+       ("libjpeg-turbo" ,libjpeg-turbo)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("libx11" ,libx11)
+       ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
+       ("openexr" ,openexr)
+       ("zlib" ,zlib)))
+    (home-page "https://gmic.eu/")
+    (synopsis "Full-featured framework for digital image processing")
+    (description "G'MIC is a full-featured framework for digital image
+processing.  It provides several user interfaces to convert / manipulate
+/ filter / visualize generic image datasets, ranging from 1D scalar
+signals to 3D+t sequences of multi-spectral volumetric images, hence
+including 2D color images.")
+    ;; Dual-licensed, either license applies.
+    (license (list license:cecill license:cecill-c))))
+
+(define-public gmic-qt
+  (package
+    (inherit gmic)
+    (name "gmic-qt")
+    (arguments
+     (substitute-keyword-arguments (package-arguments gmic)
+       ((#:configure-flags _)
+        `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
+               (string-append "-DGMIC_LIB_PATH="
+                              (assoc-ref %build-inputs "gmic") "/lib")))
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (add-after 'unpack 'qt-chdir
+              (lambda _ (chdir "gmic-qt") #t))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("qttools" ,qttools)))
+    (inputs
+     `(("gmic" ,gmic)
+       ("qtbase" ,qtbase)
+       ,@(package-inputs gmic)))
+    (synopsis "Qt frontend for the G'MIC image processing framework")
+    (license license:gpl3+)))
+
+(define-public gmic-qt-krita
+  (package
+    (inherit gmic-qt)
+    (name "gmic-qt-krita")
+    (arguments
+     (substitute-keyword-arguments (package-arguments gmic-qt)
+       ((#:configure-flags flags)
+        '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
+               (string-append "-DGMIC_LIB_PATH="
+                              (assoc-ref %build-inputs "gmic") "/lib")))))
+    (synopsis "Krita plugin for the G'MIC image processing framework")))
+
 (define-public nip2
   (package
     (name "nip2")
@@ -516,7 +750,7 @@ due to its architecture which automatically parallelises the image workflows.")
        ("gtk+-2" ,gtk+-2)
        ("libxml2" ,libxml2)
        ("libexif" ,libexif)
-       ("libjpeg" ,libjpeg)             ; required by vips.pc
+       ("libjpeg" ,libjpeg-turbo)        ;required by vips.pc
        ("librsvg" ,librsvg)
        ("fftw" ,fftw)
        ("libgsf" ,libgsf)
@@ -548,7 +782,7 @@ recalculates.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/vxl/vxl.git")
+             (url "https://github.com/vxl/vxl")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -573,7 +807,7 @@ recalculates.")
     (inputs
      `(("libgeotiff" ,libgeotiff)
        ("libtiff" ,libtiff)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("zlib" ,zlib)))
     (home-page "https://github.com/vxl/vxl/")
@@ -590,7 +824,7 @@ libraries designed for computer vision research and implementation.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/vxl/vxl.git")
+             (url "https://github.com/vxl/vxl")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -650,7 +884,7 @@ libraries designed for computer vision research and implementation.")
        ("fftw" ,fftw)
        ("fftwf" ,fftwf)
        ("hdf5" ,hdf5)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("libtiff" ,libtiff)
        ("mesa" ,mesa-opencl)
@@ -725,8 +959,7 @@ combine the information contained in both.")
              "-DSNAP_VERSION_GIT_BRANCH=release"
              "-DSNAP_VERSION_GIT_TIMESTAMP=0"
              "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
-             "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
-             "-DCMAKE_CXX_FLAGS=-std=gnu++11 -fpermissive")
+             "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
        #:phases
        (modify-phases %standard-phases
          ;; During the installation phase all libraries provided by all
@@ -799,11 +1032,11 @@ combine the information contained in both.")
        ("vtk" ,vtk-6)
        ("qtbase" ,qtbase)
        ("qtdeclarative" ,qtdeclarative)
-       ("qttools" ,qttools)
        ("vxl" ,vxl-1)
        ("zlib" ,zlib)))
     (native-inputs
      `(("googletest" ,googletest)
+       ("qttools" ,qttools)
        ("pkg-config" ,pkg-config)
        ("c3d-src"
         ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
@@ -812,7 +1045,7 @@ combine the information contained in both.")
            (origin
              (method git-fetch)
              (uri (git-reference
-                   (url "https://github.com/pyushkevich/c3d.git")
+                   (url "https://github.com/pyushkevich/c3d")
                    (commit commit)))
              (file-name (git-file-name "c3d" version))
              (sha256
@@ -827,7 +1060,7 @@ combine the information contained in both.")
            (origin
              (method git-fetch)
              (uri (git-reference
-                   (url "https://github.com/pyushkevich/greedy.git")
+                   (url "https://github.com/pyushkevich/greedy")
                    (commit commit)))
              (file-name (git-file-name "greedy" version))
              (sha256
@@ -841,3 +1074,133 @@ pipeline, along with supporting a manual segmentation toolbox.  ITK-SNAP has a
 full-featured UI aimed at clinical researchers.")
     ;; This includes the submodules greedy and c3d.
     (license license:gpl3+)))
+
+(define-public metapixel
+  ;; Follow stable branch.
+  (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
+    (package
+      (name "metapixel")
+      (version (git-version "1.0.2" "1" commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/schani/metapixel")
+               (commit commit)
+               ;; TODO: Package rwimg and lispreader?
+               (recursive? #t)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
+      (build-system gnu-build-system)
+      (inputs
+       `(("giflib" ,giflib)
+         ("libjpeg" ,libjpeg-turbo)
+         ("libpng" ,libpng)
+         ("perl" ,perl)))
+      (native-inputs
+       `(("pkg-config" ,pkg-config)
+         ("docbook-xml" ,docbook-xml)
+         ("docbook-xsl" ,docbook-xsl)
+         ("xsltproc" ,libxslt)))
+      (arguments
+       `(#:tests? #f                    ; No tests.
+         #:make-flags (list
+                       (string-append "PREFIX=" (assoc-ref %outputs "out"))
+                       (string-append "MANPAGE_XSL="
+                                      (assoc-ref %build-inputs "docbook-xsl")
+                                      "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (add-before 'install 'make-local-docbook-xml
+             (lambda* (#:key inputs #:allow-other-keys)
+               (substitute* "metapixel.xml"
+                 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
+                  (string-append (assoc-ref inputs "docbook-xml")
+                                 "/xml/dtd/docbook/docbookx.dtd")))
+               #t))
+           (add-before 'install 'fix-directory-creation
+             (lambda* (#:key outputs #:allow-other-keys)
+               (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
+               #t)))))
+      (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
+      (synopsis "Photomosaics generator")
+      (description "Metapixel is a program for generating photomosaics.  It can
+generate classical photomosaics, in which the source image is viewed as a
+matrix of equally sized rectangles for each of which a matching image is
+substituted, as well as collage-style photomosaics, in which rectangular parts
+of the source image at arbitrary positions (i.e. not aligned to a matrix) are
+substituted by matching images.")
+      (license license:gpl2))))
+
+(define-public scantailor-advanced
+  (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
+    (package
+      (name "scantailor-advanced")
+      (version (string-append "1.0.16-" (string-take commit 7)))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/4lex4/scantailor-advanced")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
+      (build-system qt-build-system)
+      (native-inputs
+       `(("qttools" ,qttools)))
+      (inputs
+       `(("boost" ,boost)
+         ("libjpeg" ,libjpeg-turbo)
+         ("libpng" ,libpng)
+         ("libtiff" ,libtiff)
+         ("qtbase" ,qtbase)
+         ("qtsvg" ,qtsvg)
+         ("zlib" ,zlib)))
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           ;; Some tests require a display and fail with offscreen mode.
+           (add-after 'unpack 'disable-failing-tests
+             (lambda _
+               (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
+               #t)))))
+      (home-page "https://github.com/4lex4/scantailor-advanced")
+      (synopsis "Clean up scanned pages")
+      (description "Scan Tailor is an interactive post-processing tool for
+scanned pages.  It performs operations such as page splitting, deskewing,
+adding/removing borders, and others.  You give it raw scans, and you get pages
+ready to be printed or assembled into a PDF or DJVU file.  Scanning, optical
+character recognition, and assembling multi-page documents are out of scope of
+this project.
+
+Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
+and Scan Tailor Enhanced versions as well as including many more bug fixes.")
+      (license license:gpl3+))))
+
+(define-public stiff
+  (package
+    (name "stiff")
+    (version "2.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("libtiff" ,libtiff)
+       ("zlib" ,zlib)
+       ("libjpeg-turbo" ,libjpeg-turbo)))
+    (home-page "https://www.astromatic.net/software/stiff")
+    (synopsis "Convert scientific FITS images to TIFF format")
+    (description
+     "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
+Transport System} images to the more popular TIFF format for illustration
+purposes.")
+    (license license:gpl3+)))