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