gnu: spdlog: Update to 1.8.3.
[jackhill/guix/guix.git] / gnu / packages / image-processing.scm
CommitLineData
504c285d
JD
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 John Darrington <jmd@gnu.org>
18696f7a 3;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
fb226b43
JD
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>
8bf70426 7;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
62834314 8;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
e506b5e9 9;;; Copyright © 2018 Lprndn <guix@lprndn.info>
b17b5411 10;;; Copyright © 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
957e0be3 11;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
5dc130c4 12;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
85c4f486 13;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
a76e9d13 14;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
58a5746e 15;;; Copyright © 2021 Oleh Malyi <astroclubzp@gmail.com>
251b0f7a 16;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
504c285d
JD
17;;;
18;;; This file is part of GNU Guix.
19;;;
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.
24;;;
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.
29;;;
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/>.
32
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)
6c56e9c4 38 #:use-module (guix git-download)
a76e9d13 39 #:use-module (guix build-system qt)
cdb2a211 40 #:use-module (guix build-system cmake)
504c285d
JD
41 #:use-module (guix build-system gnu)
42 #:use-module (gnu packages)
cdb2a211 43 #:use-module (gnu packages algebra)
e506b5e9 44 #:use-module (gnu packages bison)
cdb2a211 45 #:use-module (gnu packages boost)
d7701e1b 46 #:use-module (gnu packages check)
504c285d 47 #:use-module (gnu packages compression)
1c4e6aa9 48 #:use-module (gnu packages curl)
85c4f486 49 #:use-module (gnu packages docbook)
504c285d 50 #:use-module (gnu packages documentation)
e506b5e9 51 #:use-module (gnu packages flex)
fb226b43 52 #:use-module (gnu packages fontutils)
02e1acfb 53 #:use-module (gnu packages geo)
5bbd6931 54 #:use-module (gnu packages ghostscript)
fb226b43 55 #:use-module (gnu packages gl)
5bbd6931 56 #:use-module (gnu packages glib)
cdb2a211
JD
57 #:use-module (gnu packages gnome)
58 #:use-module (gnu packages graphics)
59 #:use-module (gnu packages graphviz)
5bbd6931 60 #:use-module (gnu packages gstreamer)
62834314 61 #:use-module (gnu packages gtk)
5d0f394b 62 #:use-module (gnu packages icu4c)
504c285d 63 #:use-module (gnu packages image)
5bbd6931 64 #:use-module (gnu packages imagemagick)
cdb2a211 65 #:use-module (gnu packages maths)
5bbd6931 66 #:use-module (gnu packages pdf)
cdb2a211 67 #:use-module (gnu packages perl)
62834314 68 #:use-module (gnu packages photo)
cdb2a211 69 #:use-module (gnu packages pkg-config)
62834314 70 #:use-module (gnu packages protobuf)
cdb2a211 71 #:use-module (gnu packages python)
44d10b1f 72 #:use-module (gnu packages python-xyz)
1c4e6aa9 73 #:use-module (gnu packages qt)
fb226b43 74 #:use-module (gnu packages serialization)
a675c01f 75 #:use-module (gnu packages sqlite)
d7701e1b 76 #:use-module (gnu packages tbb)
8486a80d 77 #:use-module (gnu packages tls)
2283cf4c 78 #:use-module (gnu packages version-control)
62834314 79 #:use-module (gnu packages video)
fb226b43 80 #:use-module (gnu packages xiph)
cdb2a211 81 #:use-module (gnu packages xml)
ebe0271a 82 #:use-module (gnu packages xorg)
18696f7a
RW
83 #:use-module (ice-9 match)
84 #:use-module (srfi srfi-1))
504c285d 85
504c285d
JD
86(define-public dcmtk
87 (package
88 (name "dcmtk")
5d0f394b 89 (version "3.6.6")
882d579d
TGR
90 (source
91 (origin
92 (method url-fetch)
93 (uri
94 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
95 "dcmtk" (string-join (string-split version #\.) "")
96 "/dcmtk-" version ".tar.gz"))
97 (sha256
5d0f394b 98 (base32 "13j5yf3p6qj3mr17d77r3kcqchf055hgvk1w15vmdr8f54mwcnb8"))))
882d579d 99 (build-system cmake-build-system)
504c285d 100 (inputs
5d0f394b 101 `(("icu4c" ,icu4c)
4bd428a7 102 ("libjpeg" ,libjpeg-turbo)
504c285d 103 ("libpng" ,libpng)
882d579d 104 ("libtiff" ,libtiff)
8486a80d
TGR
105 ("libxml2" ,libxml2)
106 ("openssl" ,openssl)
504c285d
JD
107 ("zlib" ,zlib)))
108 (native-inputs
882d579d 109 `(("doxygen" ,doxygen))) ; for HTML documentation
d2ad4f2e 110 (home-page "https://dcmtk.org")
504c285d
JD
111 (synopsis "Libraries and programs implementing parts of the DICOM standard")
112 (description "DCMTK is a collection of libraries and applications
113implementing large parts the DICOM standard. It includes software for
114examining, constructing and converting DICOM image files, handling offline
115media, sending and receiving images over a network connection, as well as
116demonstrative image storage and worklist servers.")
117 (license (license:fsf-free
118 "file://COPYRIGHT"
119 "A union of the Apache 2.0 licence and various non-copyleft
120licences similar to the Modified BSD licence."))))
cdb2a211
JD
121
122(define-public mia
123 (package
124 (name "mia")
11861d2b 125 (version "2.4.6")
cdb2a211
JD
126 (source (origin
127 (method url-fetch)
128 (uri (string-append "mirror://sourceforge/mia/mia/"
129 (version-major+minor version)
130 "/mia-" version ".tar.xz"))
131 (sha256
132 (base32
11861d2b 133 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
cdb2a211
JD
134 (build-system cmake-build-system)
135 (arguments
136 `(#:configure-flags
137 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
cdb2a211
JD
138 "-DCMAKE_CXX_FLAGS=-fpermissive")))
139 (inputs
140 `(("boost" ,boost)
141 ("dcmtk" ,dcmtk)
142 ("doxygen" ,doxygen)
143 ("eigen" ,eigen)
144 ("fftw" ,fftw)
145 ("fftwf" ,fftwf)
146 ("gsl" ,gsl)
147 ("gts" ,gts)
148 ("hdf5" ,hdf5)
149 ("itpp" ,itpp)
4bd428a7 150 ("libjpeg" ,libjpeg-turbo)
cdb2a211
JD
151 ("libpng" ,libpng)
152 ("libtiff" ,libtiff)
153 ("libxml" ,libxml2)
154 ("libxml++" ,libxml++)
155 ("maxflow" ,maxflow)
156 ("niftilib" ,niftilib)
157 ("nlopt" ,nlopt)
158 ("openexr" ,openexr)
159 ("python-lxml" ,python2-lxml)
160 ("vtk" ,vtk)))
161 (native-inputs
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,
167and libraries that make it possible run image processing tasks interactively
168in a command shell and to prototype using the shell's scripting language. It
169is built around a plug-in structure that makes it easy to add functionality
170without compromising the original code base and it makes use of a wide variety
171of external libraries that provide additional functionality.")
172 (license license:gpl3+)))
fb226b43 173
2283cf4c
TGR
174(define-public opencolorio
175 (package
176 (name "opencolorio")
177 (version "1.1.1")
178 (source
179 (origin
180 (method git-fetch)
181 (uri (git-reference
182 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
183 (commit (string-append "v" version))))
184 (sha256
185 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
186 (file-name (git-file-name name version))
187 (modules '((guix build utils)))
188 (snippet
189 `(begin
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
195 (filter
196 (lambda (full-name)
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" ".*")))
201
202 #t))))
203 (build-system cmake-build-system)
204 (arguments
205 `(#:configure-flags
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")
213 #:phases
214 (modify-phases %standard-phases
215 (add-after 'unpack 'patch-test-suite
216 (lambda _
217 (substitute* "src/core_tests/CMakeLists.txt"
218 (("/bin/sh") (which "bash")))
219 #t)))))
220 (native-inputs
221 `(("git" ,git)
222 ("pkg-config" ,pkg-config)))
223 (inputs
224 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
225 ;; ocioconvert fails: error: conflicting declaration ?typedef void
226 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
227 `(("lcms" ,lcms)
228 ("openexr" ,openexr)
229 ("tinyxml" ,tinyxml)))
230 (home-page "https://opencolorio.org")
231 (synopsis "Color management for visual effects and animation")
232 (description
233 "OpenColorIO, or OCIO, is a complete color management solution geared
234towards motion picture production, with an emphasis on visual effects and
235computer animation. It provides a straightforward and consistent user
236experience across all supporting applications while allowing for sophisticated
237back-end configuration options suitable for high-end production usage.
238
239OCIO is compatible with the @acronym{ACES, Academy Color Encoding
240Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
241many 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
245
fb226b43
JD
246(define-public vtk
247 (package
248 (name "vtk")
8f8bc406 249 (version "8.2.0")
fb226b43
JD
250 (source (origin
251 (method url-fetch)
f1d4f264 252 (uri (string-append "https://vtk.org/files/release/"
fb226b43
JD
253 (version-major+minor version)
254 "/VTK-" version ".tar.gz"))
255 (sha256
256 (base32
b17b5411 257 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))
251b0f7a
FG
258 (patches
259 (search-patches "vtk-fix-freetypetools-build-failure.patch"))
b17b5411
EF
260 (modules '((guix build utils)))
261 (snippet
262 '(begin
263 (for-each
264 (lambda (dir)
265 (delete-file-recursively
266 (string-append "ThirdParty/" dir "/vtk" dir)))
a675c01f
EF
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"))
b17b5411 271 #t))))
fb226b43
JD
272 (build-system cmake-build-system)
273 (arguments
274 '(#:build-type "Release" ;Build without '-g' to save space.
a675c01f
EF
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"
fb226b43 280 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
a675c01f
EF
281 "-DVTK_USE_SYSTEM_GL2PS:BOOL=TRUE"
282 "-DVTK_USE_SYSTEM_GLEW:BOOL=TRUE"
fb226b43
JD
283 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
284 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
285 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
a675c01f 286 "-DVTK_USE_SYSTEM_LIBPROJ:BOOL=TRUE"
fb226b43 287 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
a675c01f
EF
288 "-DVTK_USE_SYSTEM_LZ4:BOOL=TRUE"
289 "-DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE"
fb226b43 290 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
a675c01f
EF
291 ;"-DVTK_USE_SYSTEM_PUGIXML:BOOL=TRUE" ; breaks IO/CityGML
292 "-DVTK_USE_SYSTEM_SQLITE:BOOL=TRUE"
293 "-DVTK_USE_SYSTEM_THEORA:BOOL=TRUE"
fb226b43
JD
294 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
295 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
a675c01f 296 #:tests? #f)) ;XXX: test data not included
fb226b43 297 (inputs
a675c01f
EF
298 `(("double-conversion" ,double-conversion)
299 ("eigen" ,eigen)
300 ("expat" ,expat)
fb226b43 301 ("freetype" ,freetype)
a675c01f
EF
302 ("gl2ps" ,gl2ps)
303 ("glew" ,glew)
fac4e4ae 304 ("glu" ,glu)
fb226b43 305 ("hdf5" ,hdf5)
4bd428a7 306 ("jpeg" ,libjpeg-turbo)
fb226b43 307 ("jsoncpp" ,jsoncpp)
a675c01f 308 ;("libogg" ,libogg)
fb226b43 309 ("libtheora" ,libtheora)
fac4e4ae
EF
310 ("libX11" ,libx11)
311 ("libxml2" ,libxml2)
312 ("libXt" ,libxt)
a675c01f 313 ("lz4" ,lz4)
fac4e4ae 314 ("mesa" ,mesa)
a675c01f 315 ("netcdf" ,netcdf)
fb226b43 316 ("png" ,libpng)
a675c01f
EF
317 ("proj" ,proj.4)
318 ;("pugixml" ,pugixml)
319 ("sqlite" ,sqlite)
fb226b43 320 ("tiff" ,libtiff)
fac4e4ae 321 ("xorgproto" ,xorgproto)
fb226b43 322 ("zlib" ,zlib)))
f1d4f264 323 (home-page "https://vtk.org/")
fb226b43
JD
324 (synopsis "Libraries for 3D computer graphics")
325 (description
326 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
327image processing and visualization. It supports a wide variety of
328visualization algorithms including: scalar, vector, tensor, texture, and
329volumetric methods; and advanced modeling techniques such as: implicit
330modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
331triangulation. VTK has an extensive information visualization framework, has
332a suite of 3D interaction widgets, supports parallel processing, and
333integrates with various databases on GUI toolkits such as Qt and Tk.")
334 (license license:bsd-3)))
62834314 335
18696f7a
RW
336;; itksnap needs an older variant of VTK.
337(define-public vtk-6
338 (package (inherit vtk)
339 (version "6.3.0")
340 (source (origin
341 (method url-fetch)
342 (uri (string-append "https://vtk.org/files/release/"
343 (version-major+minor version)
344 "/VTK-" version ".tar.gz"))
345 (sha256
346 (base32
347 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
348 (inputs
349 `(("jsoncpp" ,jsoncpp-for-tensorflow)
350 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
351
62834314
BH
352(define-public opencv
353 (package
354 (name "opencv")
63856931 355 (version "3.4.3")
62834314 356 (source (origin
6c56e9c4
EF
357 (method git-fetch)
358 (uri (git-reference
359 (url "https://github.com/opencv/opencv")
360 (commit version)))
361 (file-name (git-file-name name version))
62834314
BH
362 (sha256
363 (base32
6c56e9c4 364 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
8bf70426
TGR
365 (patches
366 (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
62834314
BH
367 (modules '((guix build utils)))
368 (snippet
369 '(begin
370 ;; Remove external libraries. We have all available in Guix:
371 (delete-file-recursively "3rdparty")
372
373 ;; Milky icon set is non-free:
374 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
375
376 ;; Some jars found:
377 (for-each delete-file
378 '("modules/java/test/pure_test/lib/junit-4.11.jar"
6c56e9c4
EF
379 "samples/java/sbt/sbt/sbt-launch.jar"))
380 #t))))
62834314
BH
381 (build-system cmake-build-system)
382 (arguments
383 `(#:configure-flags
384 (list "-DWITH_IPP=OFF"
385 "-DWITH_ITT=OFF"
6949f45c 386 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
fdeb2def 387 "-DENABLE_PRECOMPILED_HEADERS=OFF"
62834314
BH
388
389 ;; CPU-Features:
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
393 ;;
ebe0271a
EF
394 ;; DISPATCH is the list of optional dispatches.
395 "-DCPU_BASELINE=SSE2"
62834314 396
ebe0271a
EF
397 ,@(match (%current-system)
398 ("x86_64-linux"
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"))
401 ("armhf-linux"
402 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
403 ("aarch64-linux"
404 '("-DCPU_BASELINE=NEON"
405 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
406 (_ '()))
62834314
BH
407
408 "-DBUILD_PERF_TESTS=OFF"
6949f45c 409 "-DBUILD_TESTS=ON"
62834314 410
b5baf952 411 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
6c56e9c4 412 "/opencv-contrib/modules")
62834314
BH
413
414 ;;Define test data:
b5baf952 415 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
6c56e9c4 416 "/opencv-extra/testdata")
62834314
BH
417
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"
421
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"
426
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")
433 #:phases
434 (modify-phases %standard-phases
435 (add-after 'unpack 'disable-broken-tests
436 (lambda _
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)))
446
447 ;; This one fails with "unknown file: Failure"
448 ;; But I couldn't figure out which file was missing:
6c56e9c4 449 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
62834314
BH
450 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
451 all pre post)
452 (string-append pre "DISABLED_" post)))
453
454 ;; Failure reason: Bad accuracy
455 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
6c56e9c4 456 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
62834314
BH
457 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
458 (string-append pre "DISABLED_" post)))
459 #t))
460
62834314
BH
461 (add-after 'unpack 'unpack-submodule-sources
462 (lambda* (#:key inputs #:allow-other-keys)
463 (mkdir "../opencv-extra")
464 (mkdir "../opencv-contrib")
6c56e9c4
EF
465 (copy-recursively (assoc-ref inputs "opencv-extra")
466 "../opencv-extra")
467 (invoke "tar" "xvf"
468 (assoc-ref inputs "opencv-contrib")
469 "--strip-components=1"
470 "-C" "../opencv-contrib")))
62834314
BH
471
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".
477 (setenv "CPATH"
478 (string-append (assoc-ref inputs "ilmbase")
479 "/include/OpenEXR"
480 ":" (or (getenv "CPATH") "")))
481 #t))
482 (add-before 'check 'start-xserver
483 (lambda* (#:key inputs #:allow-other-keys)
484 (let ((xorg-server (assoc-ref inputs "xorg-server"))
485 (disp ":1"))
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)))))))))
491 (native-inputs
6c56e9c4 492 `(("pkg-config" ,pkg-config)
ff337525 493 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
62834314
BH
494 ("opencv-extra"
495 ,(origin
6c56e9c4
EF
496 (method git-fetch)
497 (uri (git-reference
498 (url "https://github.com/opencv/opencv_extra")
499 (commit version)))
500 (file-name (git-file-name "opencv_extra" version))
62834314 501 (sha256
6c56e9c4 502 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
62834314
BH
503 ("opencv-contrib"
504 ,(origin
6c56e9c4
EF
505 (method git-fetch)
506 (uri (git-reference
507 (url "https://github.com/opencv/opencv_contrib")
508 (commit version)))
509 (file-name (git-file-name "opencv_contrib" version))
8e21fa0b 510 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
62834314 511 (sha256
6c56e9c4 512 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
4bd428a7 513 (inputs `(("libjpeg" ,libjpeg-turbo)
62834314
BH
514 ("libpng" ,libpng)
515 ("jasper" ,jasper)
516 ;; ffmpeg 4.0 causes core dumps in tests.
517 ("ffmpeg" ,ffmpeg-3.4)
518 ("libtiff" ,libtiff)
519 ("hdf5" ,hdf5)
520 ("libgphoto2" ,libgphoto2)
521 ("libwebp" ,libwebp)
522 ("zlib" ,zlib)
523 ("gtkglext" ,gtkglext)
524 ("openexr" ,openexr)
525 ("ilmbase" ,ilmbase)
526 ("gtk+" ,gtk+-2)
527 ("python-numpy" ,python-numpy)
528 ("protobuf" ,protobuf)
529 ("vtk" ,vtk)
530 ("python" ,python)))
5834e4b7
BH
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"
534 "CVE-2018-7713"
535 "CVE-2018-7714"))))
62834314
BH
536 (synopsis "Computer vision library")
537 (description "OpenCV is a library aimed at
538real-time computer vision, including several hundred computer
539vision algorithms. It can be used to do things like:
540
541@itemize
542@item image and video input and output
543@item image and video processing
544@item displaying
545@item feature recognition
546@item segmentation
547@item facial recognition
548@item stereo vision
549@item structure from motion
550@item augmented reality
551@item machine learning
552@end itemize\n")
553 (home-page "https://opencv.org/")
554 (license license:bsd-3)))
5bbd6931
L
555
556(define-public vips
557 (package
558 (name "vips")
63e6f8a5 559 (version "8.10.5")
7e52321f
TGR
560 (source
561 (origin
562 (method url-fetch)
563 (uri (string-append
564 "https://github.com/libvips/libvips/releases/download/v"
565 version "/vips-" version ".tar.gz"))
566 (sha256
63e6f8a5 567 (base32 "1n6gw7cw66rfn1wdb92ydpkv7gfmjiinsg6d6gqxpdja6gsz5vm4"))))
5bbd6931
L
568 (build-system gnu-build-system)
569 (native-inputs
5d99167a
EF
570 `(("gobject-introspection" ,gobject-introspection)
571 ("pkg-config" ,pkg-config)))
5bbd6931 572 (inputs
5d99167a
EF
573 `(("expat" ,expat)
574 ("fftw" ,fftw)
575 ("giflib" ,giflib)
576 ("glib" ,glib)
577 ("hdf5" ,hdf5)
578 ("imagemagick" ,imagemagick)
579 ("lcms" ,lcms)
580 ("libexif" ,libexif)
581 ("libgsf" ,libgsf)
4bd428a7 582 ("libjpeg" ,libjpeg-turbo)
5bbd6931
L
583 ("libpng" ,libpng)
584 ("librsvg" ,librsvg)
585 ("libtiff" ,libtiff)
5d99167a 586 ("libxml2" ,libxml2)
5bbd6931 587 ("libwebp" ,libwebp)
5d99167a 588 ("matio" ,matio)
5bbd6931
L
589 ("niftilib" ,niftilib)
590 ("openexr" ,openexr)
591 ("orc" ,orc)
5d99167a
EF
592 ("pango" ,pango)
593 ("poppler" ,poppler)))
5bbd6931 594 (home-page "https://libvips.github.io/libvips/")
85e2f212 595 (synopsis "Multithreaded image processing system with low memory needs")
37c1cf89 596 (description
85e2f212
TGR
597 "VIPS is a demand-driven, horizontally threaded image processing library.
598It's particularly good at processing large images, working with colour,
599scientific analysis, and general research & development.
600
601Compared to most image processing libraries VIPS needs little RAM and runs
602quickly, especially on machines with more than one CPU core. This is primarily
603due to its architecture which automatically parallelises the image workflows.")
5bbd6931 604 (license license:lgpl2.1+)))
e506b5e9 605
657f8535
VM
606(define-public gmic
607 (package
608 (name "gmic")
5dc130c4 609 (version "2.9.6")
657f8535
VM
610 (source
611 (origin
612 (method url-fetch)
613 (uri (string-append "https://gmic.eu/files/source/gmic_"
614 version ".tar.gz"))
615 (sha256
5dc130c4 616 (base32 "06n1dcskky7aqg3a0cp7biwz8agc4xqvr8091l2wsvgib98yhbyj"))))
657f8535
VM
617 (build-system cmake-build-system)
618 (arguments
75862a9e
VM
619 `(#:tests? #f ;there are no tests
620 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
621 "-DENABLE_DYNAMIC_LINKING=ON"
622 "-DENABLE_LTO=ON")
623 #:phases
624 (modify-phases %standard-phases
625 (add-before 'configure 'set-LDFLAGS
626 (lambda* (#:key inputs outputs #:allow-other-keys)
627 (setenv "LDFLAGS"
628 (string-append
629 "-Wl,-rpath="
630 (assoc-ref outputs "out") "/lib")))))))
657f8535
VM
631 (native-inputs
632 `(("pkg-config" ,pkg-config)))
633 (inputs
634 `(("curl" ,curl)
635 ("fftw" ,fftw)
636 ("graphicsmagick" ,graphicsmagick)
637 ("libjpeg-turbo" ,libjpeg-turbo)
638 ("libpng" ,libpng)
639 ("libtiff" ,libtiff)
640 ("libx11" ,libx11)
641 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
642 ("openexr" ,openexr)
643 ("zlib" ,zlib)))
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
647processing. It provides several user interfaces to convert / manipulate
648/ filter / visualize generic image datasets, ranging from 1D scalar
649signals to 3D+t sequences of multi-spectral volumetric images, hence
650including 2D color images.")
651 ;; Dual-licensed, either license applies.
652 (license (list license:cecill license:cecill-c))))
653
f23ba5d9
VM
654(define-public gmic-qt
655 (package
656 (inherit gmic)
657 (name "gmic-qt")
658 (arguments
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")))
664 ((#:phases phases)
665 `(modify-phases ,phases
666 (add-after 'unpack 'qt-chdir
667 (lambda _ (chdir "gmic-qt") #t))))))
668 (native-inputs
669 `(("pkg-config" ,pkg-config)
670 ("qttools" ,qttools)))
671 (inputs
672 `(("gmic" ,gmic)
673 ("qtbase" ,qtbase)
674 ,@(package-inputs gmic)))
675 (synopsis "Qt frontend for the G'MIC image processing framework")
676 (license license:gpl3+)))
677
78e99ae6
VM
678(define-public gmic-qt-krita
679 (package
680 (inherit gmic-qt)
681 (name "gmic-qt-krita")
682 (arguments
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")))
689
e506b5e9
L
690(define-public nip2
691 (package
692 (name "nip2")
f2d3d742 693 (version "8.7.1")
e506b5e9
L
694 (source
695 (origin
696 (method url-fetch)
697 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
698 version "/nip2-" version ".tar.gz" ))
699 (sha256
f2d3d742 700 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
e506b5e9
L
701 (build-system gnu-build-system)
702 (arguments
703 `(#:phases
704 (modify-phases %standard-phases
f2d3d742 705 ;; test_conv.ws keep failing so disabling for now.
e506b5e9
L
706 (add-after 'unpack 'disable-test-conv
707 (lambda _
708 (delete-file "test/workspaces/test_conv.ws")
709 #t))
710 (add-before 'check 'set-home
711 (lambda _
712 (setenv "HOME" "/tmp") #t)))))
713 (inputs
714 `(("vips" ,vips)
715 ("glib" ,glib)
716 ("libtiff" ,libtiff)
717 ("gtk+-2" ,gtk+-2)
718 ("libxml2" ,libxml2)
719 ("libexif" ,libexif)
4bd428a7 720 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
e506b5e9
L
721 ("librsvg" ,librsvg)
722 ("fftw" ,fftw)
723 ("libgsf" ,libgsf)
724 ("imagemagick" ,imagemagick)
725 ("orc" ,orc)
726 ("matio" ,matio)
727 ("lcms" ,lcms)
728 ("libwebp" ,libwebp)
729 ("openexr" ,openexr)
730 ("poppler" ,poppler)
731 ("gsl" ,gsl)))
732 (native-inputs
733 `(("flex" ,flex)
734 ("bison" ,bison)
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
739the VIPS image processing library. It's a little like a spreadsheet: you
740create a set of formula connecting your objects together, and on a change nip2
741recalculates.")
742 (license license:gpl2+)))
02e1acfb
RW
743
744(define-public vxl
745 (package
746 (name "vxl")
747 (version "2.0.2")
748 (source
749 (origin
750 (method git-fetch)
751 (uri (git-reference
b0e7b699 752 (url "https://github.com/vxl/vxl")
02e1acfb
RW
753 (commit (string-append "v" version))))
754 (file-name (git-file-name name version))
755 (sha256
756 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
757 (modules '((guix build utils)))
758 ;; TODO: vxl includes an old version of dcmtk. It won't build with
759 ;; version 3.6.x.
760 (snippet
761 '(begin
762 (for-each delete-file-recursively
763 '("v3p/bzlib/"
764 "v3p/geotiff/"
765 "v3p/jpeg/"
766 "v3p/png/"
767 "v3p/tiff/"
768 "v3p/zlib/"))
769 (substitute* "v3p/CMakeLists.txt"
770 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
771 ""))
772 #t))))
773 (build-system cmake-build-system)
774 (inputs
775 `(("libgeotiff" ,libgeotiff)
776 ("libtiff" ,libtiff)
4bd428a7 777 ("libjpeg" ,libjpeg-turbo)
02e1acfb
RW
778 ("libpng" ,libpng)
779 ("zlib" ,zlib)))
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++
783libraries designed for computer vision research and implementation.")
784 (license license:bsd-3)))
4243af4e
RW
785
786(define-public vxl-1
787 (package (inherit vxl)
788 (name "vxl")
789 (version "1.18.0")
790 (source
791 (origin
792 (method git-fetch)
793 (uri (git-reference
b0e7b699 794 (url "https://github.com/vxl/vxl")
4243af4e
RW
795 (commit (string-append "v" version))))
796 (file-name (git-file-name name version))
797 (sha256
798 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
799 (modules '((guix build utils)))
800 (snippet
801 '(begin
802 (for-each delete-file-recursively
803 '("v3p/bzlib/"
804 "v3p/geotiff/"
805 "v3p/png/"
806 "v3p/tiff/"
807 "v3p/zlib/"))
808 (substitute* "v3p/CMakeLists.txt"
809 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
810 ""))
811 #t))))
812 (arguments
813 `(#:configure-flags
814 ;; Needed for itk-snap
815 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
d7701e1b
RW
816
817(define-public insight-toolkit
818 (package
819 (name "insight-toolkit")
820 (version "5.0.0")
821 (source
822 (origin
823 (method url-fetch)
824 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
825 "releases/download/v" version "/InsightToolkit-"
826 version ".tar.xz"))
827 (sha256
828 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
829 (build-system cmake-build-system)
830 (arguments
831 `(#:tests? #f ; tests require network access and external data
832 #:configure-flags
833 '("-DITK_USE_GPU=ON"
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")
841 #:phases
842 (modify-phases %standard-phases
843 (add-after 'unpack 'do-not-tune
844 (lambda _
845 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
846 (("-mute=native") ""))
847 #t)))))
848 (inputs
849 `(("eigen" ,eigen)
850 ("expat" ,expat)
851 ("fftw" ,fftw)
852 ("fftwf" ,fftwf)
853 ("hdf5" ,hdf5)
4bd428a7 854 ("libjpeg" ,libjpeg-turbo)
d7701e1b
RW
855 ("libpng" ,libpng)
856 ("libtiff" ,libtiff)
857 ("mesa" ,mesa-opencl)
858 ("perl" ,perl)
859 ("python" ,python)
860 ("tbb" ,tbb)
861 ("vxl" ,vxl-1)
862 ("zlib" ,zlib)))
863 (native-inputs
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
869scientific image processing, segmentation, and registration. Segmentation is
870the process of identifying and classifying data found in a digitally sampled
871representation. Typically the sampled representation is an image acquired
872from such medical instrumentation as CT or MRI scanners. Registration is the
873task of aligning or developing correspondences between data. For example, in
874the medical environment, a CT scan may be aligned with a MRI scan in order to
875combine the information contained in both.")
876 (license license:asl2.0)))
8f4d457d
RW
877
878(define-public insight-toolkit-4
879 (package (inherit insight-toolkit)
880 (version "4.13.2")
881 (source
882 (origin
883 (method url-fetch)
884 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
885 "releases/download/v" version "/InsightToolkit-"
886 version ".tar.xz"))
887 (sha256
888 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
889 (arguments
890 `(#:tests? #f ; tests require network access and external data
891 #:configure-flags
892 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
893 "-DITK_USE_GPU=ON"
894 "-DITK_USE_SYSTEM_LIBRARIES=ON"
895 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
896 "-DITK_USE_SYSTEM_VXL=ON")))))
07f36b0c
RW
897
898(define-public insight-toolkit-4.12
899 (package (inherit insight-toolkit-4)
900 (version "4.12.2")
901 (source
902 (origin
903 (method url-fetch)
904 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
905 "InsightToolkit-" version ".tar.xz"))
906 (sha256
907 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
1c4e6aa9
RW
908
909(define-public itk-snap
910 (package
911 (name "itk-snap")
912 (version "3.8.0")
913 (source
914 (origin
915 (method git-fetch)
916 (uri (git-reference
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))
920 (sha256
921 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
922 (build-system cmake-build-system)
923 (arguments
924 `(#:configure-flags
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"
0fe041bd 929 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
1c4e6aa9
RW
930 #:phases
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
936 (lambda _
937 (substitute* "CMakeLists.txt"
938 (("install_qt5_executable\
939\\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
940 ""))
941 #t))
942 (add-after 'unpack 'disable-gui-tests
943 (lambda _
944 ;; The GUI tests just time out.
945 (substitute* "CMakeLists.txt"
946 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
947|RandomForest|RandomForestBailOut)")
948 ""))
949 #t))
950 (add-after 'unpack 'make-reproducible
951 (lambda _
952 (substitute* "CMakeLists.txt"
953 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
954 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
955 #t))
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")
960 "Submodules/c3d")
961 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
962 "Submodules/c3d/adapters/ApplyMetric.cxx")
963 (("vcl_") "std::"))
964 (rmdir "Submodules/greedy")
965 (symlink (assoc-ref inputs "greedy-src")
966 "Submodules/greedy")
967 #t))
968 (add-after 'unpack 'fix-includes
969 (lambda _
970 (substitute* "GUI/Model/RegistrationModel.cxx"
971 (("<vnl_symmetric_eigensystem.h>")
972 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
973 #t))
974 (add-before 'check 'prepare-tests
975 (lambda _
976 ;; Needed by at least one test.
977 (setenv "HOME" "/tmp")
978 #t))
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)
986 "/lib/qt5/plugins"))
987 '("qtbase" "qtdeclarative"))))
988 #t))))))
989 (inputs
990 `(("curl" ,curl)
991 ("fftw" ,fftw)
992 ("fftwf" ,fftwf)
993 ("glu" ,glu)
994 ("hdf5" ,hdf5)
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)
999 ("vtk" ,vtk-6)
1000 ("qtbase" ,qtbase)
1001 ("qtdeclarative" ,qtdeclarative)
1c4e6aa9
RW
1002 ("vxl" ,vxl-1)
1003 ("zlib" ,zlib)))
1004 (native-inputs
1005 `(("googletest" ,googletest)
957e0be3 1006 ("qttools" ,qttools)
1c4e6aa9
RW
1007 ("pkg-config" ,pkg-config)
1008 ("c3d-src"
1009 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1010 (revision "1")
1011 (version (git-version "0" revision commit)))
1012 (origin
1013 (method git-fetch)
1014 (uri (git-reference
b0e7b699 1015 (url "https://github.com/pyushkevich/c3d")
1c4e6aa9
RW
1016 (commit commit)))
1017 (file-name (git-file-name "c3d" version))
1018 (sha256
1019 (base32
1020 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1021 ;; We are using an arbitrary commit from 2017 because the latest
1022 ;; version breaks the build...
1023 ("greedy-src"
1024 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1025 (revision "1")
1026 (version (git-version "0" revision commit)))
1027 (origin
1028 (method git-fetch)
1029 (uri (git-reference
b0e7b699 1030 (url "https://github.com/pyushkevich/greedy")
1c4e6aa9
RW
1031 (commit commit)))
1032 (file-name (git-file-name "greedy" version))
1033 (sha256
1034 (base32
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
1039medical images. It provides an automatic active contour segmentation
1040pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1041full-featured UI aimed at clinical researchers.")
1042 ;; This includes the submodules greedy and c3d.
1043 (license license:gpl3+)))
85c4f486
PN
1044
1045(define-public metapixel
1046 ;; Follow stable branch.
1047 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1048 (package
1049 (name "metapixel")
1050 (version (git-version "1.0.2" "1" commit))
1051 (source
1052 (origin
1053 (method git-fetch)
1054 (uri (git-reference
1055 (url "https://github.com/schani/metapixel")
1056 (commit commit)
1057 ;; TODO: Package rwimg and lispreader?
1058 (recursive? #t)))
1059 (file-name (git-file-name name version))
1060 (sha256
1061 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1062 (build-system gnu-build-system)
1063 (inputs
1064 `(("giflib" ,giflib)
1065 ("libjpeg" ,libjpeg-turbo)
1066 ("libpng" ,libpng)
1067 ("perl" ,perl)))
1068 (native-inputs
1069 `(("pkg-config" ,pkg-config)
1070 ("docbook-xml" ,docbook-xml)
1071 ("docbook-xsl" ,docbook-xsl)
1072 ("xsltproc" ,libxslt)))
1073 (arguments
1074 `(#:tests? #f ; No tests.
1075 #:make-flags (list
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"))
1080 #:phases
1081 (modify-phases %standard-phases
1082 (delete 'configure)
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")))
1089 #t))
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"))
1093 #t)))))
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
1097generate classical photomosaics, in which the source image is viewed as a
1098matrix of equally sized rectangles for each of which a matching image is
1b8be80e 1099substituted, as well as collage-style photomosaics, in which rectangular parts
85c4f486
PN
1100of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1101substituted by matching images.")
1102 (license license:gpl2))))
a76e9d13
BT
1103
1104(define-public scantailor-advanced
1105 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1106 (package
1107 (name "scantailor-advanced")
1108 (version (string-append "1.0.16-" (string-take commit 7)))
1109 (source
1110 (origin
1111 (method git-fetch)
1112 (uri (git-reference
1113 (url "https://github.com/4lex4/scantailor-advanced")
1114 (commit commit)))
1115 (file-name (git-file-name name version))
1116 (sha256
1117 (base32
1118 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1119 (build-system qt-build-system)
1120 (native-inputs
1121 `(("qttools" ,qttools)))
1122 (inputs
1123 `(("boost" ,boost)
1124 ("libjpeg" ,libjpeg-turbo)
1125 ("libpng" ,libpng)
1126 ("libtiff" ,libtiff)
1127 ("qtbase" ,qtbase)
1128 ("qtsvg" ,qtsvg)
1129 ("zlib" ,zlib)))
1130 (arguments
1131 `(#:phases
1132 (modify-phases %standard-phases
1133 ;; Some tests require a display and fail with offscreen mode.
1134 (add-after 'unpack 'disable-failing-tests
1135 (lambda _
1136 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1137 #t)))))
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
1141scanned pages. It performs operations such as page splitting, deskewing,
1142adding/removing borders, and others. You give it raw scans, and you get pages
1143ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1144character recognition, and assembling multi-page documents are out of scope of
1145this project.
1146
1147Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1148and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1149 (license license:gpl3+))))
58a5746e
OM
1150
1151(define-public stiff
1152 (package
1153 (name "stiff")
1154 (version "2.4.0")
1155 (source
1156 (origin
1157 (method url-fetch)
1158 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1159 version ".tar.gz"))
1160 (sha256
1161 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1162 (build-system gnu-build-system)
1163 (inputs
1164 `(("libtiff" ,libtiff)
1165 ("zlib" ,zlib)
1166 ("libjpeg-turbo" ,libjpeg-turbo)))
1167 (home-page "https://www.astromatic.net/software/stiff")
1168 (synopsis "Convert scientific FITS images to TIFF format")
1169 (description
1170 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1171Transport System} images to the more popular TIFF format for illustration
1172purposes.")
1173 (license license:gpl3+)))