gnu: Add insight-toolkit.
[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>
882d579d 7;;; Copyright © 2018, 2019 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>
6949f45c 10;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
504c285d
JD
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages image-processing)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (guix download)
6c56e9c4 32 #:use-module (guix git-download)
cdb2a211 33 #:use-module (guix build-system cmake)
504c285d
JD
34 #:use-module (guix build-system gnu)
35 #:use-module (gnu packages)
cdb2a211 36 #:use-module (gnu packages algebra)
e506b5e9 37 #:use-module (gnu packages bison)
cdb2a211 38 #:use-module (gnu packages boost)
d7701e1b 39 #:use-module (gnu packages check)
504c285d
JD
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages documentation)
e506b5e9 42 #:use-module (gnu packages flex)
fb226b43 43 #:use-module (gnu packages fontutils)
02e1acfb 44 #:use-module (gnu packages geo)
5bbd6931 45 #:use-module (gnu packages ghostscript)
fb226b43 46 #:use-module (gnu packages gl)
5bbd6931 47 #:use-module (gnu packages glib)
cdb2a211
JD
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages graphics)
50 #:use-module (gnu packages graphviz)
5bbd6931 51 #:use-module (gnu packages gstreamer)
62834314 52 #:use-module (gnu packages gtk)
504c285d 53 #:use-module (gnu packages image)
5bbd6931 54 #:use-module (gnu packages imagemagick)
cdb2a211 55 #:use-module (gnu packages maths)
5bbd6931 56 #:use-module (gnu packages pdf)
cdb2a211 57 #:use-module (gnu packages perl)
62834314 58 #:use-module (gnu packages photo)
cdb2a211 59 #:use-module (gnu packages pkg-config)
62834314 60 #:use-module (gnu packages protobuf)
cdb2a211 61 #:use-module (gnu packages python)
44d10b1f 62 #:use-module (gnu packages python-xyz)
fb226b43 63 #:use-module (gnu packages serialization)
d7701e1b 64 #:use-module (gnu packages tbb)
8486a80d 65 #:use-module (gnu packages tls)
62834314 66 #:use-module (gnu packages video)
fb226b43 67 #:use-module (gnu packages xiph)
cdb2a211 68 #:use-module (gnu packages xml)
ebe0271a 69 #:use-module (gnu packages xorg)
18696f7a
RW
70 #:use-module (ice-9 match)
71 #:use-module (srfi srfi-1))
504c285d 72
504c285d
JD
73(define-public dcmtk
74 (package
75 (name "dcmtk")
882d579d
TGR
76 (version "3.6.4")
77 (source
78 (origin
79 (method url-fetch)
80 (uri
81 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
82 "dcmtk" (string-join (string-split version #\.) "")
83 "/dcmtk-" version ".tar.gz"))
84 (sha256
85 (base32 "1h22z8g0kmvhg8lgkbikyzyphhvxvq6018a00yd6i4g0z9ag6gx9"))))
86 (build-system cmake-build-system)
504c285d 87 (inputs
8486a80d
TGR
88 `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“.
89 ;; ("icu4c" ,icu4c)
90 ("libjpeg" ,libjpeg)
504c285d 91 ("libpng" ,libpng)
882d579d 92 ("libtiff" ,libtiff)
8486a80d
TGR
93 ("libxml2" ,libxml2)
94 ("openssl" ,openssl)
504c285d
JD
95 ("zlib" ,zlib)))
96 (native-inputs
882d579d 97 `(("doxygen" ,doxygen))) ; for HTML documentation
d2ad4f2e 98 (home-page "https://dcmtk.org")
504c285d
JD
99 (synopsis "Libraries and programs implementing parts of the DICOM standard")
100 (description "DCMTK is a collection of libraries and applications
101implementing large parts the DICOM standard. It includes software for
102examining, constructing and converting DICOM image files, handling offline
103media, sending and receiving images over a network connection, as well as
104demonstrative image storage and worklist servers.")
105 (license (license:fsf-free
106 "file://COPYRIGHT"
107 "A union of the Apache 2.0 licence and various non-copyleft
108licences similar to the Modified BSD licence."))))
cdb2a211
JD
109
110(define-public mia
111 (package
112 (name "mia")
11861d2b 113 (version "2.4.6")
cdb2a211
JD
114 (source (origin
115 (method url-fetch)
116 (uri (string-append "mirror://sourceforge/mia/mia/"
117 (version-major+minor version)
118 "/mia-" version ".tar.xz"))
119 (sha256
120 (base32
11861d2b 121 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
cdb2a211
JD
122 (build-system cmake-build-system)
123 (arguments
124 `(#:configure-flags
125 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
cdb2a211
JD
126 "-DCMAKE_CXX_FLAGS=-fpermissive")))
127 (inputs
128 `(("boost" ,boost)
129 ("dcmtk" ,dcmtk)
130 ("doxygen" ,doxygen)
131 ("eigen" ,eigen)
132 ("fftw" ,fftw)
133 ("fftwf" ,fftwf)
134 ("gsl" ,gsl)
135 ("gts" ,gts)
136 ("hdf5" ,hdf5)
137 ("itpp" ,itpp)
138 ("libjpeg" ,libjpeg)
139 ("libpng" ,libpng)
140 ("libtiff" ,libtiff)
141 ("libxml" ,libxml2)
142 ("libxml++" ,libxml++)
143 ("maxflow" ,maxflow)
144 ("niftilib" ,niftilib)
145 ("nlopt" ,nlopt)
146 ("openexr" ,openexr)
147 ("python-lxml" ,python2-lxml)
148 ("vtk" ,vtk)))
149 (native-inputs
150 `(("pkg-config" ,pkg-config)
151 ("python" ,python-2)))
152 (home-page "http://mia.sourceforge.net")
153 (synopsis "Toolkit for gray scale medical image analysis")
154 (description "MIA provides a combination of command line tools, plug-ins,
155and libraries that make it possible run image processing tasks interactively
156in a command shell and to prototype using the shell's scripting language. It
157is built around a plug-in structure that makes it easy to add functionality
158without compromising the original code base and it makes use of a wide variety
159of external libraries that provide additional functionality.")
160 (license license:gpl3+)))
fb226b43
JD
161
162(define-public vtk
163 (package
164 (name "vtk")
8f8bc406 165 (version "8.2.0")
fb226b43
JD
166 (source (origin
167 (method url-fetch)
f1d4f264 168 (uri (string-append "https://vtk.org/files/release/"
fb226b43
JD
169 (version-major+minor version)
170 "/VTK-" version ".tar.gz"))
171 (sha256
172 (base32
8f8bc406 173 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
fb226b43
JD
174 (build-system cmake-build-system)
175 (arguments
176 '(#:build-type "Release" ;Build without '-g' to save space.
177 ;; -DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE requires netcdf_cxx
178 #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
179 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
180 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
181 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
182 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
183 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
184 "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE"
185 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
186 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
187 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
188 #:tests? #f)) ;XXX: no "test" target
189 (inputs
190 `(("libXt" ,libxt)
6a6db57f 191 ("xorgproto" ,xorgproto)
fb226b43
JD
192 ("libX11" ,libx11)
193 ("libxml2" ,libxml2)
194 ("mesa" ,mesa)
195 ("glu" ,glu)
196 ("expat" ,expat)
197 ("freetype" ,freetype)
198 ("hdf5" ,hdf5)
199 ("jpeg" ,libjpeg)
200 ("jsoncpp" ,jsoncpp)
201 ("libogg" ,libogg)
202 ("libtheora" ,libtheora)
203 ("png" ,libpng)
204 ("tiff" ,libtiff)
205 ("zlib" ,zlib)))
f1d4f264 206 (home-page "https://vtk.org/")
fb226b43
JD
207 (synopsis "Libraries for 3D computer graphics")
208 (description
209 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
210image processing and visualization. It supports a wide variety of
211visualization algorithms including: scalar, vector, tensor, texture, and
212volumetric methods; and advanced modeling techniques such as: implicit
213modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
214triangulation. VTK has an extensive information visualization framework, has
215a suite of 3D interaction widgets, supports parallel processing, and
216integrates with various databases on GUI toolkits such as Qt and Tk.")
217 (license license:bsd-3)))
62834314 218
18696f7a
RW
219;; itksnap needs an older variant of VTK.
220(define-public vtk-6
221 (package (inherit vtk)
222 (version "6.3.0")
223 (source (origin
224 (method url-fetch)
225 (uri (string-append "https://vtk.org/files/release/"
226 (version-major+minor version)
227 "/VTK-" version ".tar.gz"))
228 (sha256
229 (base32
230 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
231 (inputs
232 `(("jsoncpp" ,jsoncpp-for-tensorflow)
233 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
234
62834314
BH
235(define-public opencv
236 (package
237 (name "opencv")
63856931 238 (version "3.4.3")
62834314 239 (source (origin
6c56e9c4
EF
240 (method git-fetch)
241 (uri (git-reference
242 (url "https://github.com/opencv/opencv")
243 (commit version)))
244 (file-name (git-file-name name version))
62834314
BH
245 (sha256
246 (base32
6c56e9c4 247 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
62834314
BH
248 (modules '((guix build utils)))
249 (snippet
250 '(begin
251 ;; Remove external libraries. We have all available in Guix:
252 (delete-file-recursively "3rdparty")
253
254 ;; Milky icon set is non-free:
255 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
256
257 ;; Some jars found:
258 (for-each delete-file
259 '("modules/java/test/pure_test/lib/junit-4.11.jar"
6c56e9c4
EF
260 "samples/java/sbt/sbt/sbt-launch.jar"))
261 #t))))
62834314
BH
262 (build-system cmake-build-system)
263 (arguments
264 `(#:configure-flags
265 (list "-DWITH_IPP=OFF"
266 "-DWITH_ITT=OFF"
6949f45c 267 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
fdeb2def 268 "-DENABLE_PRECOMPILED_HEADERS=OFF"
62834314
BH
269
270 ;; CPU-Features:
271 ;; See cmake/OpenCVCompilerOptimizations.cmake
272 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
273 ;; BASELINE is the minimum optimization all CPUs must support
274 ;;
ebe0271a
EF
275 ;; DISPATCH is the list of optional dispatches.
276 "-DCPU_BASELINE=SSE2"
62834314 277
ebe0271a
EF
278 ,@(match (%current-system)
279 ("x86_64-linux"
280 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
281 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
282 ("armhf-linux"
283 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
284 ("aarch64-linux"
285 '("-DCPU_BASELINE=NEON"
286 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
287 (_ '()))
62834314
BH
288
289 "-DBUILD_PERF_TESTS=OFF"
6949f45c 290 "-DBUILD_TESTS=ON"
62834314 291
b5baf952 292 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
6c56e9c4 293 "/opencv-contrib/modules")
62834314
BH
294
295 ;;Define test data:
b5baf952 296 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
6c56e9c4 297 "/opencv-extra/testdata")
62834314
BH
298
299 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
300 ;; which we had removed, which would lead to an error:
301 "-DBUILD_PROTOBUF=OFF"
302
303 ;; Rebuild protobuf files, because we have a slightly different
304 ;; version than the included one. If we would not update, we
305 ;; would get a compile error later:
306 "-DPROTOBUF_UPDATE_FILES=ON"
307
308 ;; xfeatures2d disabled, because it downloads extra binaries from
309 ;; https://github.com/opencv/opencv_3rdparty
310 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
311 ;; Cmp this bug entry:
312 ;; https://github.com/opencv/opencv_contrib/issues/1131
313 "-DBUILD_opencv_xfeatures2d=OFF")
314 #:phases
315 (modify-phases %standard-phases
316 (add-after 'unpack 'disable-broken-tests
317 (lambda _
318 ;; These tests fails with:
319 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
320 ;; I think we have no OpenGL support with the Xvfb.
321 (substitute* '("modules/viz/test/test_tutorial3.cpp"
322 "modules/viz/test/test_main.cpp"
323 "modules/viz/test/tests_simple.cpp"
324 "modules/viz/test/test_viz3d.cpp")
325 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
326 (string-append pre "DISABLED_" post)))
327
328 ;; This one fails with "unknown file: Failure"
329 ;; But I couldn't figure out which file was missing:
6c56e9c4 330 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
62834314
BH
331 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
332 all pre post)
333 (string-append pre "DISABLED_" post)))
334
335 ;; Failure reason: Bad accuracy
336 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
6c56e9c4 337 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
62834314
BH
338 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
339 (string-append pre "DISABLED_" post)))
340 #t))
341
62834314
BH
342 (add-after 'unpack 'unpack-submodule-sources
343 (lambda* (#:key inputs #:allow-other-keys)
344 (mkdir "../opencv-extra")
345 (mkdir "../opencv-contrib")
6c56e9c4
EF
346 (copy-recursively (assoc-ref inputs "opencv-extra")
347 "../opencv-extra")
348 (invoke "tar" "xvf"
349 (assoc-ref inputs "opencv-contrib")
350 "--strip-components=1"
351 "-C" "../opencv-contrib")))
62834314
BH
352
353 (add-after 'set-paths 'add-ilmbase-include-path
354 (lambda* (#:key inputs #:allow-other-keys)
355 ;; OpenEXR propagates ilmbase, but its include files do not appear
356 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
357 ;; the CPATH to satisfy the dependency on "ImathVec.h".
358 (setenv "CPATH"
359 (string-append (assoc-ref inputs "ilmbase")
360 "/include/OpenEXR"
361 ":" (or (getenv "CPATH") "")))
362 #t))
363 (add-before 'check 'start-xserver
364 (lambda* (#:key inputs #:allow-other-keys)
365 (let ((xorg-server (assoc-ref inputs "xorg-server"))
366 (disp ":1"))
367 (setenv "HOME" (getcwd))
368 (setenv "DISPLAY" disp)
369 ;; There must be a running X server and make check doesn't start one.
370 ;; Therefore we must do it.
371 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
372 (native-inputs
6c56e9c4 373 `(("pkg-config" ,pkg-config)
62834314
BH
374 ("xorg-server" ,xorg-server) ; For running the tests
375 ("opencv-extra"
376 ,(origin
6c56e9c4
EF
377 (method git-fetch)
378 (uri (git-reference
379 (url "https://github.com/opencv/opencv_extra")
380 (commit version)))
381 (file-name (git-file-name "opencv_extra" version))
62834314 382 (sha256
6c56e9c4 383 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
62834314
BH
384 ("opencv-contrib"
385 ,(origin
6c56e9c4
EF
386 (method git-fetch)
387 (uri (git-reference
388 (url "https://github.com/opencv/opencv_contrib")
389 (commit version)))
390 (file-name (git-file-name "opencv_contrib" version))
8e21fa0b 391 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
62834314 392 (sha256
6c56e9c4 393 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
62834314
BH
394 (inputs `(("libjpeg" ,libjpeg)
395 ("libpng" ,libpng)
396 ("jasper" ,jasper)
397 ;; ffmpeg 4.0 causes core dumps in tests.
398 ("ffmpeg" ,ffmpeg-3.4)
399 ("libtiff" ,libtiff)
400 ("hdf5" ,hdf5)
401 ("libgphoto2" ,libgphoto2)
402 ("libwebp" ,libwebp)
403 ("zlib" ,zlib)
404 ("gtkglext" ,gtkglext)
405 ("openexr" ,openexr)
406 ("ilmbase" ,ilmbase)
407 ("gtk+" ,gtk+-2)
408 ("python-numpy" ,python-numpy)
409 ("protobuf" ,protobuf)
410 ("vtk" ,vtk)
411 ("python" ,python)))
5834e4b7
BH
412 ;; These three CVEs are not a problem of OpenCV, see:
413 ;; https://github.com/opencv/opencv/issues/10998
414 (properties '((lint-hidden-cve . ("CVE-2018-7712"
415 "CVE-2018-7713"
416 "CVE-2018-7714"))))
62834314
BH
417 (synopsis "Computer vision library")
418 (description "OpenCV is a library aimed at
419real-time computer vision, including several hundred computer
420vision algorithms. It can be used to do things like:
421
422@itemize
423@item image and video input and output
424@item image and video processing
425@item displaying
426@item feature recognition
427@item segmentation
428@item facial recognition
429@item stereo vision
430@item structure from motion
431@item augmented reality
432@item machine learning
433@end itemize\n")
434 (home-page "https://opencv.org/")
435 (license license:bsd-3)))
5bbd6931
L
436
437(define-public vips
438 (package
439 (name "vips")
7e52321f
TGR
440 (version "8.7.4")
441 (source
442 (origin
443 (method url-fetch)
444 (uri (string-append
445 "https://github.com/libvips/libvips/releases/download/v"
446 version "/vips-" version ".tar.gz"))
447 (sha256
448 (base32 "01gjhcrl6zj7mcj1al717v5jsniahplqhz1xkfh2j78vyfl1hxff"))))
5bbd6931
L
449 (build-system gnu-build-system)
450 (native-inputs
451 `(("pkg-config" ,pkg-config)
452 ("gobject-introspection" ,gobject-introspection)))
453 (inputs
454 `(("glib" ,glib)
455 ("libjpeg" ,libjpeg)
456 ("libpng" ,libpng)
457 ("librsvg" ,librsvg)
458 ("libtiff" ,libtiff)
459 ("libexif" ,libexif)
460 ("giflib" ,giflib)
461 ("libgsf" ,libgsf)
462 ("fftw" ,fftw)
463 ("poppler" ,poppler)
464 ("pango" ,pango)
465 ("lcms" ,lcms)
466 ("matio" ,matio)
467 ("libwebp" ,libwebp)
468 ("niftilib" ,niftilib)
469 ("openexr" ,openexr)
470 ("orc" ,orc)
471 ("imagemagick" ,imagemagick)
472 ("libxml2" ,libxml2)
473 ("expat" ,expat)
474 ("hdf5" ,hdf5)))
475 (home-page "https://libvips.github.io/libvips/")
85e2f212 476 (synopsis "Multithreaded image processing system with low memory needs")
37c1cf89 477 (description
85e2f212
TGR
478 "VIPS is a demand-driven, horizontally threaded image processing library.
479It's particularly good at processing large images, working with colour,
480scientific analysis, and general research & development.
481
482Compared to most image processing libraries VIPS needs little RAM and runs
483quickly, especially on machines with more than one CPU core. This is primarily
484due to its architecture which automatically parallelises the image workflows.")
5bbd6931 485 (license license:lgpl2.1+)))
e506b5e9
L
486
487(define-public nip2
488 (package
489 (name "nip2")
f2d3d742 490 (version "8.7.1")
e506b5e9
L
491 (source
492 (origin
493 (method url-fetch)
494 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
495 version "/nip2-" version ".tar.gz" ))
496 (sha256
f2d3d742 497 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
e506b5e9
L
498 (build-system gnu-build-system)
499 (arguments
500 `(#:phases
501 (modify-phases %standard-phases
f2d3d742 502 ;; test_conv.ws keep failing so disabling for now.
e506b5e9
L
503 (add-after 'unpack 'disable-test-conv
504 (lambda _
505 (delete-file "test/workspaces/test_conv.ws")
506 #t))
507 (add-before 'check 'set-home
508 (lambda _
509 (setenv "HOME" "/tmp") #t)))))
510 (inputs
511 `(("vips" ,vips)
512 ("glib" ,glib)
513 ("libtiff" ,libtiff)
514 ("gtk+-2" ,gtk+-2)
515 ("libxml2" ,libxml2)
516 ("libexif" ,libexif)
f2d3d742 517 ("libjpeg" ,libjpeg) ; required by vips.pc
e506b5e9
L
518 ("librsvg" ,librsvg)
519 ("fftw" ,fftw)
520 ("libgsf" ,libgsf)
521 ("imagemagick" ,imagemagick)
522 ("orc" ,orc)
523 ("matio" ,matio)
524 ("lcms" ,lcms)
525 ("libwebp" ,libwebp)
526 ("openexr" ,openexr)
527 ("poppler" ,poppler)
528 ("gsl" ,gsl)))
529 (native-inputs
530 `(("flex" ,flex)
531 ("bison" ,bison)
532 ("pkg-config" ,pkg-config)))
533 (home-page "https://github.com/libvips/nip2")
534 (synopsis "Spreadsheet-like GUI for libvips")
535 (description "This package provide a graphical user interface (GUI) for
536the VIPS image processing library. It's a little like a spreadsheet: you
537create a set of formula connecting your objects together, and on a change nip2
538recalculates.")
539 (license license:gpl2+)))
02e1acfb
RW
540
541(define-public vxl
542 (package
543 (name "vxl")
544 (version "2.0.2")
545 (source
546 (origin
547 (method git-fetch)
548 (uri (git-reference
549 (url "https://github.com/vxl/vxl.git")
550 (commit (string-append "v" version))))
551 (file-name (git-file-name name version))
552 (sha256
553 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
554 (modules '((guix build utils)))
555 ;; TODO: vxl includes an old version of dcmtk. It won't build with
556 ;; version 3.6.x.
557 (snippet
558 '(begin
559 (for-each delete-file-recursively
560 '("v3p/bzlib/"
561 "v3p/geotiff/"
562 "v3p/jpeg/"
563 "v3p/png/"
564 "v3p/tiff/"
565 "v3p/zlib/"))
566 (substitute* "v3p/CMakeLists.txt"
567 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
568 ""))
569 #t))))
570 (build-system cmake-build-system)
571 (inputs
572 `(("libgeotiff" ,libgeotiff)
573 ("libtiff" ,libtiff)
574 ("libjpeg" ,libjpeg)
575 ("libpng" ,libpng)
576 ("zlib" ,zlib)))
577 (home-page "https://github.com/vxl/vxl/")
578 (synopsis "Collection of C++ libraries for computer vision")
579 (description "VXL (the Vision-something-Libraries) is a collection of C++
580libraries designed for computer vision research and implementation.")
581 (license license:bsd-3)))
4243af4e
RW
582
583(define-public vxl-1
584 (package (inherit vxl)
585 (name "vxl")
586 (version "1.18.0")
587 (source
588 (origin
589 (method git-fetch)
590 (uri (git-reference
591 (url "https://github.com/vxl/vxl.git")
592 (commit (string-append "v" version))))
593 (file-name (git-file-name name version))
594 (sha256
595 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
596 (modules '((guix build utils)))
597 (snippet
598 '(begin
599 (for-each delete-file-recursively
600 '("v3p/bzlib/"
601 "v3p/geotiff/"
602 "v3p/png/"
603 "v3p/tiff/"
604 "v3p/zlib/"))
605 (substitute* "v3p/CMakeLists.txt"
606 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
607 ""))
608 #t))))
609 (arguments
610 `(#:configure-flags
611 ;; Needed for itk-snap
612 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
d7701e1b
RW
613
614(define-public insight-toolkit
615 (package
616 (name "insight-toolkit")
617 (version "5.0.0")
618 (source
619 (origin
620 (method url-fetch)
621 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
622 "releases/download/v" version "/InsightToolkit-"
623 version ".tar.xz"))
624 (sha256
625 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
626 (build-system cmake-build-system)
627 (arguments
628 `(#:tests? #f ; tests require network access and external data
629 #:configure-flags
630 '("-DITK_USE_GPU=ON"
631 "-DITK_USE_SYSTEM_LIBRARIES=ON"
632 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
633 "-DITK_BUILD_SHARED=ON"
634 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
635 ;; variable in the installed CMake files. This is necessary as other
636 ;; packages using insight-toolkit could not be configured otherwise.
637 "-DGTEST_ROOT=gtest")
638 #:phases
639 (modify-phases %standard-phases
640 (add-after 'unpack 'do-not-tune
641 (lambda _
642 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
643 (("-mute=native") ""))
644 #t)))))
645 (inputs
646 `(("eigen" ,eigen)
647 ("expat" ,expat)
648 ("fftw" ,fftw)
649 ("fftwf" ,fftwf)
650 ("hdf5" ,hdf5)
651 ("libjpeg" ,libjpeg)
652 ("libpng" ,libpng)
653 ("libtiff" ,libtiff)
654 ("mesa" ,mesa-opencl)
655 ("perl" ,perl)
656 ("python" ,python)
657 ("tbb" ,tbb)
658 ("vxl" ,vxl-1)
659 ("zlib" ,zlib)))
660 (native-inputs
661 `(("googletest" ,googletest)
662 ("pkg-config" ,pkg-config)))
663 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
664 (synopsis "Scientific image processing, segmentation and registration")
665 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
666scientific image processing, segmentation, and registration. Segmentation is
667the process of identifying and classifying data found in a digitally sampled
668representation. Typically the sampled representation is an image acquired
669from such medical instrumentation as CT or MRI scanners. Registration is the
670task of aligning or developing correspondences between data. For example, in
671the medical environment, a CT scan may be aligned with a MRI scan in order to
672combine the information contained in both.")
673 (license license:asl2.0)))