gnu: Add python-pyshp.
[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>
e025de68 4;;; Copyright © 2014, 2021 Ludovic Courtès <ludo@gnu.org>
fb226b43
JD
5;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
6;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
cc33f50d 7;;; Copyright © 2018–2021 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>
48f7aa1c 17;;; Copyright © 2021 Andy Tai <atai@atai.org>
950475bb 18;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
d769fcd6 19;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
504c285d
JD
20;;;
21;;; This file is part of GNU Guix.
22;;;
23;;; GNU Guix is free software; you can redistribute it and/or modify it
24;;; under the terms of the GNU General Public License as published by
25;;; the Free Software Foundation; either version 3 of the License, or (at
26;;; your option) any later version.
27;;;
28;;; GNU Guix is distributed in the hope that it will be useful, but
29;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31;;; GNU General Public License for more details.
32;;;
33;;; You should have received a copy of the GNU General Public License
34;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35
36(define-module (gnu packages image-processing)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix utils)
40 #:use-module (guix download)
6c56e9c4 41 #:use-module (guix git-download)
a76e9d13 42 #:use-module (guix build-system qt)
cdb2a211 43 #:use-module (guix build-system cmake)
504c285d
JD
44 #:use-module (guix build-system gnu)
45 #:use-module (gnu packages)
cdb2a211 46 #:use-module (gnu packages algebra)
e506b5e9 47 #:use-module (gnu packages bison)
cdb2a211 48 #:use-module (gnu packages boost)
d7701e1b 49 #:use-module (gnu packages check)
504c285d 50 #:use-module (gnu packages compression)
1c4e6aa9 51 #:use-module (gnu packages curl)
85c4f486 52 #:use-module (gnu packages docbook)
504c285d 53 #:use-module (gnu packages documentation)
e506b5e9 54 #:use-module (gnu packages flex)
fb226b43 55 #:use-module (gnu packages fontutils)
02e1acfb 56 #:use-module (gnu packages geo)
5bbd6931 57 #:use-module (gnu packages ghostscript)
fb226b43 58 #:use-module (gnu packages gl)
5bbd6931 59 #:use-module (gnu packages glib)
cdb2a211
JD
60 #:use-module (gnu packages gnome)
61 #:use-module (gnu packages graphics)
62 #:use-module (gnu packages graphviz)
5bbd6931 63 #:use-module (gnu packages gstreamer)
62834314 64 #:use-module (gnu packages gtk)
5d0f394b 65 #:use-module (gnu packages icu4c)
504c285d 66 #:use-module (gnu packages image)
5bbd6931 67 #:use-module (gnu packages imagemagick)
cdb2a211 68 #:use-module (gnu packages maths)
5bbd6931 69 #:use-module (gnu packages pdf)
cdb2a211 70 #:use-module (gnu packages perl)
62834314 71 #:use-module (gnu packages photo)
cdb2a211 72 #:use-module (gnu packages pkg-config)
62834314 73 #:use-module (gnu packages protobuf)
cdb2a211 74 #:use-module (gnu packages python)
44d10b1f 75 #:use-module (gnu packages python-xyz)
1c4e6aa9 76 #:use-module (gnu packages qt)
fb226b43 77 #:use-module (gnu packages serialization)
a675c01f 78 #:use-module (gnu packages sqlite)
d7701e1b 79 #:use-module (gnu packages tbb)
8486a80d 80 #:use-module (gnu packages tls)
2283cf4c 81 #:use-module (gnu packages version-control)
62834314 82 #:use-module (gnu packages video)
fb226b43 83 #:use-module (gnu packages xiph)
cdb2a211 84 #:use-module (gnu packages xml)
ebe0271a 85 #:use-module (gnu packages xorg)
18696f7a
RW
86 #:use-module (ice-9 match)
87 #:use-module (srfi srfi-1))
504c285d 88
504c285d
JD
89(define-public dcmtk
90 (package
91 (name "dcmtk")
5d0f394b 92 (version "3.6.6")
882d579d
TGR
93 (source
94 (origin
95 (method url-fetch)
96 (uri
97 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
98 "dcmtk" (string-join (string-split version #\.) "")
99 "/dcmtk-" version ".tar.gz"))
100 (sha256
5d0f394b 101 (base32 "13j5yf3p6qj3mr17d77r3kcqchf055hgvk1w15vmdr8f54mwcnb8"))))
882d579d 102 (build-system cmake-build-system)
504c285d 103 (inputs
5d0f394b 104 `(("icu4c" ,icu4c)
4bd428a7 105 ("libjpeg" ,libjpeg-turbo)
504c285d 106 ("libpng" ,libpng)
882d579d 107 ("libtiff" ,libtiff)
8486a80d
TGR
108 ("libxml2" ,libxml2)
109 ("openssl" ,openssl)
504c285d
JD
110 ("zlib" ,zlib)))
111 (native-inputs
882d579d 112 `(("doxygen" ,doxygen))) ; for HTML documentation
d2ad4f2e 113 (home-page "https://dcmtk.org")
504c285d
JD
114 (synopsis "Libraries and programs implementing parts of the DICOM standard")
115 (description "DCMTK is a collection of libraries and applications
116implementing large parts the DICOM standard. It includes software for
117examining, constructing and converting DICOM image files, handling offline
118media, sending and receiving images over a network connection, as well as
119demonstrative image storage and worklist servers.")
120 (license (license:fsf-free
121 "file://COPYRIGHT"
122 "A union of the Apache 2.0 licence and various non-copyleft
123licences similar to the Modified BSD licence."))))
cdb2a211
JD
124
125(define-public mia
126 (package
127 (name "mia")
11861d2b 128 (version "2.4.6")
cdb2a211
JD
129 (source (origin
130 (method url-fetch)
131 (uri (string-append "mirror://sourceforge/mia/mia/"
132 (version-major+minor version)
133 "/mia-" version ".tar.xz"))
134 (sha256
135 (base32
11861d2b 136 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
cdb2a211
JD
137 (build-system cmake-build-system)
138 (arguments
139 `(#:configure-flags
140 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
cdb2a211
JD
141 "-DCMAKE_CXX_FLAGS=-fpermissive")))
142 (inputs
143 `(("boost" ,boost)
144 ("dcmtk" ,dcmtk)
145 ("doxygen" ,doxygen)
146 ("eigen" ,eigen)
147 ("fftw" ,fftw)
148 ("fftwf" ,fftwf)
149 ("gsl" ,gsl)
150 ("gts" ,gts)
151 ("hdf5" ,hdf5)
152 ("itpp" ,itpp)
4bd428a7 153 ("libjpeg" ,libjpeg-turbo)
cdb2a211
JD
154 ("libpng" ,libpng)
155 ("libtiff" ,libtiff)
156 ("libxml" ,libxml2)
157 ("libxml++" ,libxml++)
158 ("maxflow" ,maxflow)
159 ("niftilib" ,niftilib)
160 ("nlopt" ,nlopt)
161 ("openexr" ,openexr)
162 ("python-lxml" ,python2-lxml)
163 ("vtk" ,vtk)))
164 (native-inputs
165 `(("pkg-config" ,pkg-config)
166 ("python" ,python-2)))
167 (home-page "http://mia.sourceforge.net")
168 (synopsis "Toolkit for gray scale medical image analysis")
169 (description "MIA provides a combination of command line tools, plug-ins,
170and libraries that make it possible run image processing tasks interactively
171in a command shell and to prototype using the shell's scripting language. It
172is built around a plug-in structure that makes it easy to add functionality
173without compromising the original code base and it makes use of a wide variety
174of external libraries that provide additional functionality.")
175 (license license:gpl3+)))
fb226b43 176
2283cf4c
TGR
177(define-public opencolorio
178 (package
179 (name "opencolorio")
180 (version "1.1.1")
181 (source
182 (origin
183 (method git-fetch)
184 (uri (git-reference
185 (url "https://github.com/AcademySoftwareFoundation/OpenColorIO")
186 (commit (string-append "v" version))))
187 (sha256
188 (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"))
189 (file-name (git-file-name name version))
190 (modules '((guix build utils)))
191 (snippet
192 `(begin
193 ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream
194 ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with:
195 ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517
196 ;; When removing it, also remove it from the licence field comment.
197 (for-each delete-file-recursively
198 (filter
199 (lambda (full-name)
200 (let ((file (basename full-name)))
201 (not (or (string-prefix? "yaml-cpp-0.3" file)
202 (string=? "unittest.h" file)))))
203 (find-files "ext" ".*")))
204
205 #t))))
206 (build-system cmake-build-system)
207 (arguments
208 `(#:configure-flags
209 (list (string-append "-DCMAKE_CXX_FLAGS="
210 "-Wno-error=deprecated-declarations "
211 "-Wno-error=unused-function")
212 "-DOCIO_BUILD_STATIC=OFF"
213 ;; "-DUSE_EXTERNAL_YAML=ON"
214 "-DUSE_EXTERNAL_TINYXML=ON"
215 "-DUSE_EXTERNAL_LCMS=ON")
216 #:phases
217 (modify-phases %standard-phases
218 (add-after 'unpack 'patch-test-suite
219 (lambda _
220 (substitute* "src/core_tests/CMakeLists.txt"
221 (("/bin/sh") (which "bash")))
222 #t)))))
223 (native-inputs
224 `(("git" ,git)
225 ("pkg-config" ,pkg-config)))
226 (inputs
227 ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for
228 ;; ocioconvert fails: error: conflicting declaration ?typedef void
229 ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)
230 `(("lcms" ,lcms)
231 ("openexr" ,openexr)
232 ("tinyxml" ,tinyxml)))
233 (home-page "https://opencolorio.org")
234 (synopsis "Color management for visual effects and animation")
235 (description
236 "OpenColorIO, or OCIO, is a complete color management solution geared
237towards motion picture production, with an emphasis on visual effects and
238computer animation. It provides a straightforward and consistent user
239experience across all supporting applications while allowing for sophisticated
240back-end configuration options suitable for high-end production usage.
241
242OCIO is compatible with the @acronym{ACES, Academy Color Encoding
243Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting
244many popular formats.")
245 (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-*
246 license:zlib ; src/core/md5
247 license:bsd-3)))) ; the rest
248
fb226b43
JD
249(define-public vtk
250 (package
251 (name "vtk")
48f7aa1c 252 (version "9.0.1")
fb226b43
JD
253 (source (origin
254 (method url-fetch)
f1d4f264 255 (uri (string-append "https://vtk.org/files/release/"
fb226b43
JD
256 (version-major+minor version)
257 "/VTK-" version ".tar.gz"))
258 (sha256
259 (base32
48f7aa1c 260 "1ir2lq9i45ls374lcmjzw0nrm5l5hnm1w47lg8g8d0n2j7hsaf8v"))
251b0f7a
FG
261 (patches
262 (search-patches "vtk-fix-freetypetools-build-failure.patch"))
b17b5411
EF
263 (modules '((guix build utils)))
264 (snippet
265 '(begin
266 (for-each
267 (lambda (dir)
268 (delete-file-recursively
269 (string-append "ThirdParty/" dir "/vtk" dir)))
48f7aa1c 270 ;; pugixml depended upon unconditionally
a675c01f
EF
271 '("doubleconversion" "eigen" "expat" "freetype" "gl2ps"
272 "glew" "hdf5" "jpeg" "jsoncpp" "libproj" "libxml2" "lz4"
48f7aa1c 273 "netcdf" "ogg" "png" "sqlite" "theora" "tiff" "zlib"))
b17b5411 274 #t))))
e025de68 275 (properties `((release-monitoring-url . "https://vtk.org/download/")))
fb226b43
JD
276 (build-system cmake-build-system)
277 (arguments
278 '(#:build-type "Release" ;Build without '-g' to save space.
a675c01f 279 #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
48f7aa1c
AT
280 ; ; not honored
281 "-DVTK_USE_EXTERNAL=OFF" ;; default
282 "-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion=ON"
283 "-DVTK_MODULE_USE_EXTERNAL_VTK_eigen=ON"
284 "-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON"
285 "-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON"
286 "-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=ON"
287 "-DVTK_MODULE_USE_EXTERNAL_VTK_glew=ON"
288 "-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5=ON"
289 "-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg=ON"
290 "-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp=ON"
291 "-DVTK_MODULE_USE_EXTERNAL_VTK_libproj=ON"
292 "-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2=ON"
293 "-DVTK_MODULE_USE_EXTERNAL_VTK_lz4=ON"
294 "-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf=ON"
295 "-DVTK_MODULE_USE_EXTERNAL_VTK_ogg=ON"
296 "-DVTK_MODULE_USE_EXTERNAL_VTK_png=ON"
297 ;"-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml=ON" ; breaks IO/CityGML
298 "-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite=ON"
299 "-DVTK_MODULE_USE_EXTERNAL_VTK_theora=ON"
300 "-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON"
301 "-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON"
d769fcd6
PG
302 "-DVTK_WRAP_PYTHON=ON"
303 "-DVTK_PYTHON_VERSION:STRING=3"
48f7aa1c
AT
304 )
305 #:phases
306 (modify-phases %standard-phases
307 (add-after 'unpack 'patch-sources
308 (lambda _
309 (substitute* "Common/Core/vtkFloatingPointExceptions.cxx"
310 (("<fenv.h>") "<cfenv>"))
311 (substitute* "Common/Core/CMakeLists.txt"
312 (("fenv.h") "cfenv")))))
a675c01f 313 #:tests? #f)) ;XXX: test data not included
fb226b43 314 (inputs
a675c01f
EF
315 `(("double-conversion" ,double-conversion)
316 ("eigen" ,eigen)
317 ("expat" ,expat)
fb226b43 318 ("freetype" ,freetype)
a675c01f
EF
319 ("gl2ps" ,gl2ps)
320 ("glew" ,glew)
fac4e4ae 321 ("glu" ,glu)
fb226b43 322 ("hdf5" ,hdf5)
4bd428a7 323 ("jpeg" ,libjpeg-turbo)
fb226b43 324 ("jsoncpp" ,jsoncpp)
fb226b43 325 ("libtheora" ,libtheora)
fac4e4ae
EF
326 ("libX11" ,libx11)
327 ("libxml2" ,libxml2)
328 ("libXt" ,libxt)
a675c01f 329 ("lz4" ,lz4)
fac4e4ae 330 ("mesa" ,mesa)
a675c01f 331 ("netcdf" ,netcdf)
fb226b43 332 ("png" ,libpng)
a675c01f 333 ("proj" ,proj.4)
d769fcd6 334 ("python", python)
a675c01f
EF
335 ;("pugixml" ,pugixml)
336 ("sqlite" ,sqlite)
fb226b43 337 ("tiff" ,libtiff)
fac4e4ae 338 ("xorgproto" ,xorgproto)
fb226b43 339 ("zlib" ,zlib)))
48f7aa1c
AT
340 (propagated-inputs
341 ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
342 ;; 'find_package(THEORA)', which in turns looks for libogg.
343 `(("libogg" ,libogg)))
f1d4f264 344 (home-page "https://vtk.org/")
fb226b43
JD
345 (synopsis "Libraries for 3D computer graphics")
346 (description
347 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
348image processing and visualization. It supports a wide variety of
349visualization algorithms including: scalar, vector, tensor, texture, and
350volumetric methods; and advanced modeling techniques such as: implicit
351modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
352triangulation. VTK has an extensive information visualization framework, has
353a suite of 3D interaction widgets, supports parallel processing, and
354integrates with various databases on GUI toolkits such as Qt and Tk.")
355 (license license:bsd-3)))
62834314 356
950475bb
EZ
357;; freecad needs an old version of VTK, because VTK's API changed from 8 to 9
358(define-public vtk-8
359 (package (inherit vtk)
360 (version "8.2.0")
361 (source (origin
362 (method url-fetch)
363 (uri (string-append "https://vtk.org/files/release/"
364 (version-major+minor version)
365 "/VTK-" version ".tar.gz"))
366 (sha256
367 (base32
368 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
369 (inputs
370 `(("jsoncpp" ,jsoncpp-for-tensorflow)
371 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
372
18696f7a
RW
373;; itksnap needs an older variant of VTK.
374(define-public vtk-6
375 (package (inherit vtk)
376 (version "6.3.0")
377 (source (origin
378 (method url-fetch)
379 (uri (string-append "https://vtk.org/files/release/"
380 (version-major+minor version)
381 "/VTK-" version ".tar.gz"))
382 (sha256
383 (base32
384 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
385 (inputs
386 `(("jsoncpp" ,jsoncpp-for-tensorflow)
387 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
388
62834314
BH
389(define-public opencv
390 (package
391 (name "opencv")
63856931 392 (version "3.4.3")
62834314 393 (source (origin
6c56e9c4
EF
394 (method git-fetch)
395 (uri (git-reference
396 (url "https://github.com/opencv/opencv")
397 (commit version)))
398 (file-name (git-file-name name version))
62834314
BH
399 (sha256
400 (base32
6c56e9c4 401 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
8bf70426
TGR
402 (patches
403 (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
62834314
BH
404 (modules '((guix build utils)))
405 (snippet
406 '(begin
407 ;; Remove external libraries. We have all available in Guix:
408 (delete-file-recursively "3rdparty")
409
410 ;; Milky icon set is non-free:
411 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
412
413 ;; Some jars found:
414 (for-each delete-file
415 '("modules/java/test/pure_test/lib/junit-4.11.jar"
6c56e9c4
EF
416 "samples/java/sbt/sbt/sbt-launch.jar"))
417 #t))))
62834314
BH
418 (build-system cmake-build-system)
419 (arguments
420 `(#:configure-flags
421 (list "-DWITH_IPP=OFF"
422 "-DWITH_ITT=OFF"
6949f45c 423 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
fdeb2def 424 "-DENABLE_PRECOMPILED_HEADERS=OFF"
62834314
BH
425
426 ;; CPU-Features:
427 ;; See cmake/OpenCVCompilerOptimizations.cmake
428 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
429 ;; BASELINE is the minimum optimization all CPUs must support
430 ;;
ebe0271a
EF
431 ;; DISPATCH is the list of optional dispatches.
432 "-DCPU_BASELINE=SSE2"
62834314 433
ebe0271a
EF
434 ,@(match (%current-system)
435 ("x86_64-linux"
436 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
437 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
438 ("armhf-linux"
439 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
440 ("aarch64-linux"
441 '("-DCPU_BASELINE=NEON"
442 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
443 (_ '()))
62834314
BH
444
445 "-DBUILD_PERF_TESTS=OFF"
6949f45c 446 "-DBUILD_TESTS=ON"
62834314 447
b5baf952 448 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
6c56e9c4 449 "/opencv-contrib/modules")
62834314
BH
450
451 ;;Define test data:
b5baf952 452 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
6c56e9c4 453 "/opencv-extra/testdata")
62834314
BH
454
455 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
456 ;; which we had removed, which would lead to an error:
457 "-DBUILD_PROTOBUF=OFF"
458
459 ;; Rebuild protobuf files, because we have a slightly different
460 ;; version than the included one. If we would not update, we
461 ;; would get a compile error later:
462 "-DPROTOBUF_UPDATE_FILES=ON"
463
464 ;; xfeatures2d disabled, because it downloads extra binaries from
465 ;; https://github.com/opencv/opencv_3rdparty
466 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
467 ;; Cmp this bug entry:
468 ;; https://github.com/opencv/opencv_contrib/issues/1131
469 "-DBUILD_opencv_xfeatures2d=OFF")
470 #:phases
471 (modify-phases %standard-phases
472 (add-after 'unpack 'disable-broken-tests
473 (lambda _
474 ;; These tests fails with:
475 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
476 ;; I think we have no OpenGL support with the Xvfb.
477 (substitute* '("modules/viz/test/test_tutorial3.cpp"
478 "modules/viz/test/test_main.cpp"
479 "modules/viz/test/tests_simple.cpp"
480 "modules/viz/test/test_viz3d.cpp")
481 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
482 (string-append pre "DISABLED_" post)))
483
484 ;; This one fails with "unknown file: Failure"
485 ;; But I couldn't figure out which file was missing:
6c56e9c4 486 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
62834314
BH
487 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
488 all pre post)
489 (string-append pre "DISABLED_" post)))
490
491 ;; Failure reason: Bad accuracy
492 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
6c56e9c4 493 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
62834314
BH
494 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
495 (string-append pre "DISABLED_" post)))
496 #t))
497
62834314
BH
498 (add-after 'unpack 'unpack-submodule-sources
499 (lambda* (#:key inputs #:allow-other-keys)
500 (mkdir "../opencv-extra")
501 (mkdir "../opencv-contrib")
6c56e9c4
EF
502 (copy-recursively (assoc-ref inputs "opencv-extra")
503 "../opencv-extra")
504 (invoke "tar" "xvf"
505 (assoc-ref inputs "opencv-contrib")
506 "--strip-components=1"
507 "-C" "../opencv-contrib")))
62834314
BH
508
509 (add-after 'set-paths 'add-ilmbase-include-path
510 (lambda* (#:key inputs #:allow-other-keys)
511 ;; OpenEXR propagates ilmbase, but its include files do not appear
512 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
513 ;; the CPATH to satisfy the dependency on "ImathVec.h".
514 (setenv "CPATH"
515 (string-append (assoc-ref inputs "ilmbase")
516 "/include/OpenEXR"
517 ":" (or (getenv "CPATH") "")))
518 #t))
519 (add-before 'check 'start-xserver
520 (lambda* (#:key inputs #:allow-other-keys)
521 (let ((xorg-server (assoc-ref inputs "xorg-server"))
522 (disp ":1"))
523 (setenv "HOME" (getcwd))
524 (setenv "DISPLAY" disp)
525 ;; There must be a running X server and make check doesn't start one.
526 ;; Therefore we must do it.
527 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
528 (native-inputs
6c56e9c4 529 `(("pkg-config" ,pkg-config)
ff337525 530 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
62834314
BH
531 ("opencv-extra"
532 ,(origin
6c56e9c4
EF
533 (method git-fetch)
534 (uri (git-reference
535 (url "https://github.com/opencv/opencv_extra")
536 (commit version)))
537 (file-name (git-file-name "opencv_extra" version))
62834314 538 (sha256
6c56e9c4 539 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
62834314
BH
540 ("opencv-contrib"
541 ,(origin
6c56e9c4
EF
542 (method git-fetch)
543 (uri (git-reference
544 (url "https://github.com/opencv/opencv_contrib")
545 (commit version)))
546 (file-name (git-file-name "opencv_contrib" version))
8e21fa0b 547 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
62834314 548 (sha256
6c56e9c4 549 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
4bd428a7 550 (inputs `(("libjpeg" ,libjpeg-turbo)
62834314
BH
551 ("libpng" ,libpng)
552 ("jasper" ,jasper)
553 ;; ffmpeg 4.0 causes core dumps in tests.
554 ("ffmpeg" ,ffmpeg-3.4)
555 ("libtiff" ,libtiff)
556 ("hdf5" ,hdf5)
557 ("libgphoto2" ,libgphoto2)
558 ("libwebp" ,libwebp)
559 ("zlib" ,zlib)
560 ("gtkglext" ,gtkglext)
561 ("openexr" ,openexr)
562 ("ilmbase" ,ilmbase)
563 ("gtk+" ,gtk+-2)
564 ("python-numpy" ,python-numpy)
565 ("protobuf" ,protobuf)
566 ("vtk" ,vtk)
567 ("python" ,python)))
5834e4b7
BH
568 ;; These three CVEs are not a problem of OpenCV, see:
569 ;; https://github.com/opencv/opencv/issues/10998
570 (properties '((lint-hidden-cve . ("CVE-2018-7712"
571 "CVE-2018-7713"
572 "CVE-2018-7714"))))
62834314
BH
573 (synopsis "Computer vision library")
574 (description "OpenCV is a library aimed at
575real-time computer vision, including several hundred computer
576vision algorithms. It can be used to do things like:
577
578@itemize
579@item image and video input and output
580@item image and video processing
581@item displaying
582@item feature recognition
583@item segmentation
584@item facial recognition
585@item stereo vision
586@item structure from motion
587@item augmented reality
588@item machine learning
589@end itemize\n")
590 (home-page "https://opencv.org/")
591 (license license:bsd-3)))
5bbd6931
L
592
593(define-public vips
594 (package
595 (name "vips")
cc33f50d 596 (version "8.10.6")
7e52321f
TGR
597 (source
598 (origin
599 (method url-fetch)
600 (uri (string-append
601 "https://github.com/libvips/libvips/releases/download/v"
602 version "/vips-" version ".tar.gz"))
603 (sha256
cc33f50d 604 (base32 "0vjsh3i0861f6h9as3bch956cidz824zz499pvhjs3lfjn6hhs14"))))
5bbd6931
L
605 (build-system gnu-build-system)
606 (native-inputs
5d99167a
EF
607 `(("gobject-introspection" ,gobject-introspection)
608 ("pkg-config" ,pkg-config)))
5bbd6931 609 (inputs
5d99167a
EF
610 `(("expat" ,expat)
611 ("fftw" ,fftw)
612 ("giflib" ,giflib)
613 ("glib" ,glib)
614 ("hdf5" ,hdf5)
615 ("imagemagick" ,imagemagick)
616 ("lcms" ,lcms)
617 ("libexif" ,libexif)
618 ("libgsf" ,libgsf)
4bd428a7 619 ("libjpeg" ,libjpeg-turbo)
5bbd6931
L
620 ("libpng" ,libpng)
621 ("librsvg" ,librsvg)
622 ("libtiff" ,libtiff)
5d99167a 623 ("libxml2" ,libxml2)
5bbd6931 624 ("libwebp" ,libwebp)
5d99167a 625 ("matio" ,matio)
5bbd6931
L
626 ("niftilib" ,niftilib)
627 ("openexr" ,openexr)
628 ("orc" ,orc)
5d99167a
EF
629 ("pango" ,pango)
630 ("poppler" ,poppler)))
5bbd6931 631 (home-page "https://libvips.github.io/libvips/")
85e2f212 632 (synopsis "Multithreaded image processing system with low memory needs")
37c1cf89 633 (description
85e2f212
TGR
634 "VIPS is a demand-driven, horizontally threaded image processing library.
635It's particularly good at processing large images, working with colour,
636scientific analysis, and general research & development.
637
638Compared to most image processing libraries VIPS needs little RAM and runs
639quickly, especially on machines with more than one CPU core. This is primarily
640due to its architecture which automatically parallelises the image workflows.")
5bbd6931 641 (license license:lgpl2.1+)))
e506b5e9 642
657f8535
VM
643(define-public gmic
644 (package
645 (name "gmic")
ce9fe5f9 646 (version "2.9.7")
657f8535
VM
647 (source
648 (origin
649 (method url-fetch)
650 (uri (string-append "https://gmic.eu/files/source/gmic_"
651 version ".tar.gz"))
652 (sha256
ce9fe5f9 653 (base32 "05kzaplsl5qvxs7v6g73q0lq8dii8g6v77ap609188m7gr43f9cl"))))
657f8535
VM
654 (build-system cmake-build-system)
655 (arguments
75862a9e
VM
656 `(#:tests? #f ;there are no tests
657 #:configure-flags '("-DBUILD_LIB_STATIC=OFF"
658 "-DENABLE_DYNAMIC_LINKING=ON"
659 "-DENABLE_LTO=ON")
660 #:phases
661 (modify-phases %standard-phases
662 (add-before 'configure 'set-LDFLAGS
663 (lambda* (#:key inputs outputs #:allow-other-keys)
664 (setenv "LDFLAGS"
665 (string-append
666 "-Wl,-rpath="
667 (assoc-ref outputs "out") "/lib")))))))
657f8535
VM
668 (native-inputs
669 `(("pkg-config" ,pkg-config)))
670 (inputs
671 `(("curl" ,curl)
672 ("fftw" ,fftw)
673 ("graphicsmagick" ,graphicsmagick)
674 ("libjpeg-turbo" ,libjpeg-turbo)
675 ("libpng" ,libpng)
676 ("libtiff" ,libtiff)
677 ("libx11" ,libx11)
678 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
679 ("openexr" ,openexr)
680 ("zlib" ,zlib)))
681 (home-page "https://gmic.eu/")
682 (synopsis "Full-featured framework for digital image processing")
683 (description "G'MIC is a full-featured framework for digital image
684processing. It provides several user interfaces to convert / manipulate
685/ filter / visualize generic image datasets, ranging from 1D scalar
686signals to 3D+t sequences of multi-spectral volumetric images, hence
687including 2D color images.")
688 ;; Dual-licensed, either license applies.
689 (license (list license:cecill license:cecill-c))))
690
f23ba5d9
VM
691(define-public gmic-qt
692 (package
693 (inherit gmic)
694 (name "gmic-qt")
695 (arguments
696 (substitute-keyword-arguments (package-arguments gmic)
697 ((#:configure-flags _)
698 `(list "-DGMIC_QT_HOST=none" "-DENABLE_DYNAMIC_LINKING=ON"
699 (string-append "-DGMIC_LIB_PATH="
700 (assoc-ref %build-inputs "gmic") "/lib")))
701 ((#:phases phases)
702 `(modify-phases ,phases
703 (add-after 'unpack 'qt-chdir
704 (lambda _ (chdir "gmic-qt") #t))))))
705 (native-inputs
706 `(("pkg-config" ,pkg-config)
707 ("qttools" ,qttools)))
708 (inputs
709 `(("gmic" ,gmic)
ea0a5107 710 ("qtbase" ,qtbase-5)
f23ba5d9
VM
711 ,@(package-inputs gmic)))
712 (synopsis "Qt frontend for the G'MIC image processing framework")
713 (license license:gpl3+)))
714
78e99ae6
VM
715(define-public gmic-qt-krita
716 (package
717 (inherit gmic-qt)
718 (name "gmic-qt-krita")
719 (arguments
720 (substitute-keyword-arguments (package-arguments gmic-qt)
721 ((#:configure-flags flags)
722 '(list "-DGMIC_QT_HOST=krita" "-DENABLE_DYNAMIC_LINKING=ON"
723 (string-append "-DGMIC_LIB_PATH="
724 (assoc-ref %build-inputs "gmic") "/lib")))))
725 (synopsis "Krita plugin for the G'MIC image processing framework")))
726
e506b5e9
L
727(define-public nip2
728 (package
729 (name "nip2")
f2d3d742 730 (version "8.7.1")
e506b5e9
L
731 (source
732 (origin
733 (method url-fetch)
734 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
735 version "/nip2-" version ".tar.gz" ))
736 (sha256
f2d3d742 737 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
e506b5e9
L
738 (build-system gnu-build-system)
739 (arguments
740 `(#:phases
741 (modify-phases %standard-phases
f2d3d742 742 ;; test_conv.ws keep failing so disabling for now.
e506b5e9
L
743 (add-after 'unpack 'disable-test-conv
744 (lambda _
745 (delete-file "test/workspaces/test_conv.ws")
746 #t))
747 (add-before 'check 'set-home
748 (lambda _
749 (setenv "HOME" "/tmp") #t)))))
750 (inputs
751 `(("vips" ,vips)
752 ("glib" ,glib)
753 ("libtiff" ,libtiff)
754 ("gtk+-2" ,gtk+-2)
755 ("libxml2" ,libxml2)
756 ("libexif" ,libexif)
4bd428a7 757 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
e506b5e9
L
758 ("librsvg" ,librsvg)
759 ("fftw" ,fftw)
760 ("libgsf" ,libgsf)
761 ("imagemagick" ,imagemagick)
762 ("orc" ,orc)
763 ("matio" ,matio)
764 ("lcms" ,lcms)
765 ("libwebp" ,libwebp)
766 ("openexr" ,openexr)
767 ("poppler" ,poppler)
768 ("gsl" ,gsl)))
769 (native-inputs
770 `(("flex" ,flex)
771 ("bison" ,bison)
772 ("pkg-config" ,pkg-config)))
773 (home-page "https://github.com/libvips/nip2")
774 (synopsis "Spreadsheet-like GUI for libvips")
775 (description "This package provide a graphical user interface (GUI) for
776the VIPS image processing library. It's a little like a spreadsheet: you
777create a set of formula connecting your objects together, and on a change nip2
778recalculates.")
779 (license license:gpl2+)))
02e1acfb
RW
780
781(define-public vxl
782 (package
783 (name "vxl")
784 (version "2.0.2")
785 (source
786 (origin
787 (method git-fetch)
788 (uri (git-reference
b0e7b699 789 (url "https://github.com/vxl/vxl")
02e1acfb
RW
790 (commit (string-append "v" version))))
791 (file-name (git-file-name name version))
792 (sha256
793 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
794 (modules '((guix build utils)))
795 ;; TODO: vxl includes an old version of dcmtk. It won't build with
796 ;; version 3.6.x.
797 (snippet
798 '(begin
799 (for-each delete-file-recursively
800 '("v3p/bzlib/"
801 "v3p/geotiff/"
802 "v3p/jpeg/"
803 "v3p/png/"
804 "v3p/tiff/"
805 "v3p/zlib/"))
806 (substitute* "v3p/CMakeLists.txt"
807 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
808 ""))
809 #t))))
810 (build-system cmake-build-system)
811 (inputs
812 `(("libgeotiff" ,libgeotiff)
813 ("libtiff" ,libtiff)
4bd428a7 814 ("libjpeg" ,libjpeg-turbo)
02e1acfb
RW
815 ("libpng" ,libpng)
816 ("zlib" ,zlib)))
817 (home-page "https://github.com/vxl/vxl/")
818 (synopsis "Collection of C++ libraries for computer vision")
819 (description "VXL (the Vision-something-Libraries) is a collection of C++
820libraries designed for computer vision research and implementation.")
821 (license license:bsd-3)))
4243af4e
RW
822
823(define-public vxl-1
824 (package (inherit vxl)
825 (name "vxl")
826 (version "1.18.0")
827 (source
828 (origin
829 (method git-fetch)
830 (uri (git-reference
b0e7b699 831 (url "https://github.com/vxl/vxl")
4243af4e
RW
832 (commit (string-append "v" version))))
833 (file-name (git-file-name name version))
834 (sha256
835 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
836 (modules '((guix build utils)))
837 (snippet
838 '(begin
839 (for-each delete-file-recursively
840 '("v3p/bzlib/"
841 "v3p/geotiff/"
842 "v3p/png/"
843 "v3p/tiff/"
844 "v3p/zlib/"))
845 (substitute* "v3p/CMakeLists.txt"
846 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
847 ""))
848 #t))))
849 (arguments
850 `(#:configure-flags
851 ;; Needed for itk-snap
852 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
d7701e1b
RW
853
854(define-public insight-toolkit
855 (package
856 (name "insight-toolkit")
857 (version "5.0.0")
858 (source
859 (origin
860 (method url-fetch)
861 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
862 "releases/download/v" version "/InsightToolkit-"
863 version ".tar.xz"))
864 (sha256
865 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
866 (build-system cmake-build-system)
867 (arguments
868 `(#:tests? #f ; tests require network access and external data
869 #:configure-flags
870 '("-DITK_USE_GPU=ON"
871 "-DITK_USE_SYSTEM_LIBRARIES=ON"
872 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
873 "-DITK_BUILD_SHARED=ON"
874 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
875 ;; variable in the installed CMake files. This is necessary as other
876 ;; packages using insight-toolkit could not be configured otherwise.
877 "-DGTEST_ROOT=gtest")
d769fcd6 878
d7701e1b
RW
879 #:phases
880 (modify-phases %standard-phases
881 (add-after 'unpack 'do-not-tune
882 (lambda _
883 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
884 (("-mute=native") ""))
885 #t)))))
886 (inputs
887 `(("eigen" ,eigen)
888 ("expat" ,expat)
889 ("fftw" ,fftw)
890 ("fftwf" ,fftwf)
891 ("hdf5" ,hdf5)
4bd428a7 892 ("libjpeg" ,libjpeg-turbo)
d7701e1b
RW
893 ("libpng" ,libpng)
894 ("libtiff" ,libtiff)
895 ("mesa" ,mesa-opencl)
896 ("perl" ,perl)
897 ("python" ,python)
898 ("tbb" ,tbb)
899 ("vxl" ,vxl-1)
900 ("zlib" ,zlib)))
901 (native-inputs
902 `(("googletest" ,googletest)
903 ("pkg-config" ,pkg-config)))
904 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
905 (synopsis "Scientific image processing, segmentation and registration")
906 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
907scientific image processing, segmentation, and registration. Segmentation is
908the process of identifying and classifying data found in a digitally sampled
909representation. Typically the sampled representation is an image acquired
910from such medical instrumentation as CT or MRI scanners. Registration is the
911task of aligning or developing correspondences between data. For example, in
912the medical environment, a CT scan may be aligned with a MRI scan in order to
913combine the information contained in both.")
914 (license license:asl2.0)))
8f4d457d
RW
915
916(define-public insight-toolkit-4
917 (package (inherit insight-toolkit)
918 (version "4.13.2")
919 (source
920 (origin
921 (method url-fetch)
922 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
923 "releases/download/v" version "/InsightToolkit-"
924 version ".tar.xz"))
925 (sha256
926 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
927 (arguments
928 `(#:tests? #f ; tests require network access and external data
929 #:configure-flags
930 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
931 "-DITK_USE_GPU=ON"
932 "-DITK_USE_SYSTEM_LIBRARIES=ON"
933 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
934 "-DITK_USE_SYSTEM_VXL=ON")))))
07f36b0c
RW
935
936(define-public insight-toolkit-4.12
937 (package (inherit insight-toolkit-4)
938 (version "4.12.2")
939 (source
940 (origin
941 (method url-fetch)
942 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
943 "InsightToolkit-" version ".tar.xz"))
944 (sha256
945 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
1c4e6aa9
RW
946
947(define-public itk-snap
948 (package
949 (name "itk-snap")
950 (version "3.8.0")
951 (source
952 (origin
953 (method git-fetch)
954 (uri (git-reference
955 (url "https://git.code.sf.net/p/itk-snap/src")
956 (commit (string-append "v" version))))
957 (file-name (git-file-name name version))
958 (sha256
959 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
960 (build-system cmake-build-system)
961 (arguments
962 `(#:configure-flags
963 (list "-DSNAP_VERSION_GIT_SHA1=release"
964 "-DSNAP_VERSION_GIT_BRANCH=release"
965 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
966 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
0fe041bd 967 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
1c4e6aa9
RW
968 #:phases
969 (modify-phases %standard-phases
970 ;; During the installation phase all libraries provided by all
971 ;; dependencies will be copied to the lib directory. That's insane,
972 ;; so we disable this.
973 (add-after 'unpack 'do-not-copy-dependencies
974 (lambda _
975 (substitute* "CMakeLists.txt"
976 (("install_qt5_executable\
977\\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
978 ""))
979 #t))
980 (add-after 'unpack 'disable-gui-tests
981 (lambda _
982 ;; The GUI tests just time out.
983 (substitute* "CMakeLists.txt"
984 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
985|RandomForest|RandomForestBailOut)")
986 ""))
987 #t))
988 (add-after 'unpack 'make-reproducible
989 (lambda _
990 (substitute* "CMakeLists.txt"
991 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
992 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
993 #t))
994 (add-after 'unpack 'prepare-submodules
995 (lambda* (#:key inputs #:allow-other-keys)
996 (rmdir "Submodules/c3d")
997 (copy-recursively (assoc-ref inputs "c3d-src")
998 "Submodules/c3d")
999 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
1000 "Submodules/c3d/adapters/ApplyMetric.cxx")
1001 (("vcl_") "std::"))
1002 (rmdir "Submodules/greedy")
1003 (symlink (assoc-ref inputs "greedy-src")
1004 "Submodules/greedy")
1005 #t))
1006 (add-after 'unpack 'fix-includes
1007 (lambda _
1008 (substitute* "GUI/Model/RegistrationModel.cxx"
1009 (("<vnl_symmetric_eigensystem.h>")
1010 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
1011 #t))
1012 (add-before 'check 'prepare-tests
1013 (lambda _
1014 ;; Needed by at least one test.
1015 (setenv "HOME" "/tmp")
1016 #t))
1017 (add-after 'install 'wrap-executable
1018 (lambda* (#:key inputs outputs #:allow-other-keys)
1019 (let ((out (assoc-ref outputs "out")))
1020 (wrap-program (string-append out "/bin/itksnap")
1021 `("QT_PLUGIN_PATH" ":" prefix
1022 ,(map (lambda (label)
1023 (string-append (assoc-ref inputs label)
1024 "/lib/qt5/plugins"))
1025 '("qtbase" "qtdeclarative"))))
1026 #t))))))
1027 (inputs
1028 `(("curl" ,curl)
1029 ("fftw" ,fftw)
1030 ("fftwf" ,fftwf)
1031 ("glu" ,glu)
1032 ("hdf5" ,hdf5)
1033 ("mesa" ,mesa-opencl)
1034 ;; This package does not build with either insight-toolkit 5.0.0 and
1035 ;; not with 4.13. It really needs to be 4.12.
1036 ("itk" ,insight-toolkit-4.12)
1037 ("vtk" ,vtk-6)
ea0a5107 1038 ("qtbase" ,qtbase-5)
1c4e6aa9 1039 ("qtdeclarative" ,qtdeclarative)
1c4e6aa9
RW
1040 ("vxl" ,vxl-1)
1041 ("zlib" ,zlib)))
1042 (native-inputs
1043 `(("googletest" ,googletest)
957e0be3 1044 ("qttools" ,qttools)
1c4e6aa9
RW
1045 ("pkg-config" ,pkg-config)
1046 ("c3d-src"
1047 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
1048 (revision "1")
1049 (version (git-version "0" revision commit)))
1050 (origin
1051 (method git-fetch)
1052 (uri (git-reference
b0e7b699 1053 (url "https://github.com/pyushkevich/c3d")
1c4e6aa9
RW
1054 (commit commit)))
1055 (file-name (git-file-name "c3d" version))
1056 (sha256
1057 (base32
1058 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
1059 ;; We are using an arbitrary commit from 2017 because the latest
1060 ;; version breaks the build...
1061 ("greedy-src"
1062 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
1063 (revision "1")
1064 (version (git-version "0" revision commit)))
1065 (origin
1066 (method git-fetch)
1067 (uri (git-reference
b0e7b699 1068 (url "https://github.com/pyushkevich/greedy")
1c4e6aa9
RW
1069 (commit commit)))
1070 (file-name (git-file-name "greedy" version))
1071 (sha256
1072 (base32
1073 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
1074 (home-page "https://sourceforge.net/p/itk-snap/")
1075 (synopsis "Medical image segmentation")
1076 (description "ITK-SNAP is a tool for segmenting anatomical structures in
1077medical images. It provides an automatic active contour segmentation
1078pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
1079full-featured UI aimed at clinical researchers.")
1080 ;; This includes the submodules greedy and c3d.
1081 (license license:gpl3+)))
85c4f486
PN
1082
1083(define-public metapixel
1084 ;; Follow stable branch.
1085 (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f"))
1086 (package
1087 (name "metapixel")
1088 (version (git-version "1.0.2" "1" commit))
1089 (source
1090 (origin
1091 (method git-fetch)
1092 (uri (git-reference
1093 (url "https://github.com/schani/metapixel")
1094 (commit commit)
1095 ;; TODO: Package rwimg and lispreader?
1096 (recursive? #t)))
1097 (file-name (git-file-name name version))
1098 (sha256
1099 (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309"))))
1100 (build-system gnu-build-system)
1101 (inputs
1102 `(("giflib" ,giflib)
1103 ("libjpeg" ,libjpeg-turbo)
1104 ("libpng" ,libpng)
1105 ("perl" ,perl)))
1106 (native-inputs
1107 `(("pkg-config" ,pkg-config)
1108 ("docbook-xml" ,docbook-xml)
1109 ("docbook-xsl" ,docbook-xsl)
1110 ("xsltproc" ,libxslt)))
1111 (arguments
1112 `(#:tests? #f ; No tests.
1113 #:make-flags (list
1114 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1115 (string-append "MANPAGE_XSL="
1116 (assoc-ref %build-inputs "docbook-xsl")
1117 "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl"))
1118 #:phases
1119 (modify-phases %standard-phases
1120 (delete 'configure)
1121 (add-before 'install 'make-local-docbook-xml
1122 (lambda* (#:key inputs #:allow-other-keys)
1123 (substitute* "metapixel.xml"
1124 (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd")
1125 (string-append (assoc-ref inputs "docbook-xml")
1126 "/xml/dtd/docbook/docbookx.dtd")))
1127 #t))
1128 (add-before 'install 'fix-directory-creation
1129 (lambda* (#:key outputs #:allow-other-keys)
1130 (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1"))
1131 #t)))))
1132 (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/")
1133 (synopsis "Photomosaics generator")
1134 (description "Metapixel is a program for generating photomosaics. It can
1135generate classical photomosaics, in which the source image is viewed as a
1136matrix of equally sized rectangles for each of which a matching image is
1b8be80e 1137substituted, as well as collage-style photomosaics, in which rectangular parts
85c4f486
PN
1138of the source image at arbitrary positions (i.e. not aligned to a matrix) are
1139substituted by matching images.")
1140 (license license:gpl2))))
a76e9d13
BT
1141
1142(define-public scantailor-advanced
1143 (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027"))
1144 (package
1145 (name "scantailor-advanced")
1146 (version (string-append "1.0.16-" (string-take commit 7)))
1147 (source
1148 (origin
1149 (method git-fetch)
1150 (uri (git-reference
1151 (url "https://github.com/4lex4/scantailor-advanced")
1152 (commit commit)))
1153 (file-name (git-file-name name version))
1154 (sha256
1155 (base32
1156 "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h"))))
1157 (build-system qt-build-system)
1158 (native-inputs
1159 `(("qttools" ,qttools)))
1160 (inputs
1161 `(("boost" ,boost)
1162 ("libjpeg" ,libjpeg-turbo)
1163 ("libpng" ,libpng)
1164 ("libtiff" ,libtiff)
ea0a5107 1165 ("qtbase" ,qtbase-5)
a76e9d13
BT
1166 ("qtsvg" ,qtsvg)
1167 ("zlib" ,zlib)))
1168 (arguments
1169 `(#:phases
1170 (modify-phases %standard-phases
1171 ;; Some tests require a display and fail with offscreen mode.
1172 (add-after 'unpack 'disable-failing-tests
1173 (lambda _
1174 (setenv "ARGS" "--exclude-regex \"imageproc_.*\"")
1175 #t)))))
1176 (home-page "https://github.com/4lex4/scantailor-advanced")
1177 (synopsis "Clean up scanned pages")
1178 (description "Scan Tailor is an interactive post-processing tool for
1179scanned pages. It performs operations such as page splitting, deskewing,
1180adding/removing borders, and others. You give it raw scans, and you get pages
1181ready to be printed or assembled into a PDF or DJVU file. Scanning, optical
1182character recognition, and assembling multi-page documents are out of scope of
1183this project.
1184
1185Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured
1186and Scan Tailor Enhanced versions as well as including many more bug fixes.")
1187 (license license:gpl3+))))
58a5746e
OM
1188
1189(define-public stiff
1190 (package
1191 (name "stiff")
1192 (version "2.4.0")
1193 (source
1194 (origin
1195 (method url-fetch)
1196 (uri (string-append "https://www.astromatic.net/download/stiff/stiff-"
1197 version ".tar.gz"))
1198 (sha256
1199 (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l"))))
1200 (build-system gnu-build-system)
1201 (inputs
1202 `(("libtiff" ,libtiff)
1203 ("zlib" ,zlib)
1204 ("libjpeg-turbo" ,libjpeg-turbo)))
1205 (home-page "https://www.astromatic.net/software/stiff")
1206 (synopsis "Convert scientific FITS images to TIFF format")
1207 (description
1208 "STIFF is a program that converts scientific @acronym{FITS, Flexible Image
1209Transport System} images to the more popular TIFF format for illustration
1210purposes.")
1211 (license license:gpl3+)))