1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
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>
7 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
9 ;;; Copyright © 2018 Lprndn <guix@lprndn.info>
10 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
12 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages algebra)
37 #:use-module (gnu packages bison)
38 #:use-module (gnu packages boost)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages documentation)
43 #:use-module (gnu packages flex)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages geo)
46 #:use-module (gnu packages ghostscript)
47 #:use-module (gnu packages gl)
48 #:use-module (gnu packages glib)
49 #:use-module (gnu packages gnome)
50 #:use-module (gnu packages graphics)
51 #:use-module (gnu packages graphviz)
52 #:use-module (gnu packages gstreamer)
53 #:use-module (gnu packages gtk)
54 #:use-module (gnu packages image)
55 #:use-module (gnu packages imagemagick)
56 #:use-module (gnu packages maths)
57 #:use-module (gnu packages pdf)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages photo)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages protobuf)
62 #:use-module (gnu packages python)
63 #:use-module (gnu packages python-xyz)
64 #:use-module (gnu packages qt)
65 #:use-module (gnu packages serialization)
66 #:use-module (gnu packages tbb)
67 #:use-module (gnu packages tls)
68 #:use-module (gnu packages video)
69 #:use-module (gnu packages xiph)
70 #:use-module (gnu packages xml)
71 #:use-module (gnu packages xorg)
72 #:use-module (ice-9 match)
73 #:use-module (srfi srfi-1))
83 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
84 "dcmtk" (string-join (string-split version #\.) "")
85 "/dcmtk-" version ".tar.gz"))
87 (base32 "1fdyz5wwjp4grys61mxb2ia9fi6i3ax6s43l16xnv291bxk7hld0"))))
88 (build-system cmake-build-system)
90 `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“.
99 `(("doxygen" ,doxygen))) ; for HTML documentation
100 (home-page "https://dcmtk.org")
101 (synopsis "Libraries and programs implementing parts of the DICOM standard")
102 (description "DCMTK is a collection of libraries and applications
103 implementing large parts the DICOM standard. It includes software for
104 examining, constructing and converting DICOM image files, handling offline
105 media, sending and receiving images over a network connection, as well as
106 demonstrative image storage and worklist servers.")
107 (license (license:fsf-free
109 "A union of the Apache 2.0 licence and various non-copyleft
110 licences similar to the Modified BSD licence."))))
118 (uri (string-append "mirror://sourceforge/mia/mia/"
119 (version-major+minor version)
120 "/mia-" version ".tar.xz"))
123 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
124 (build-system cmake-build-system)
127 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
128 "-DCMAKE_CXX_FLAGS=-fpermissive")))
144 ("libxml++" ,libxml++)
146 ("niftilib" ,niftilib)
149 ("python-lxml" ,python2-lxml)
152 `(("pkg-config" ,pkg-config)
153 ("python" ,python-2)))
154 (home-page "http://mia.sourceforge.net")
155 (synopsis "Toolkit for gray scale medical image analysis")
156 (description "MIA provides a combination of command line tools, plug-ins,
157 and libraries that make it possible run image processing tasks interactively
158 in a command shell and to prototype using the shell's scripting language. It
159 is built around a plug-in structure that makes it easy to add functionality
160 without compromising the original code base and it makes use of a wide variety
161 of external libraries that provide additional functionality.")
162 (license license:gpl3+)))
170 (uri (string-append "https://vtk.org/files/release/"
171 (version-major+minor version)
172 "/VTK-" version ".tar.gz"))
175 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
176 (build-system cmake-build-system)
178 '(#:build-type "Release" ;Build without '-g' to save space.
179 ;; -DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE requires netcdf_cxx
180 #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
181 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
182 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
183 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
184 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
185 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
186 "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE"
187 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
188 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
189 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
190 #:tests? #f)) ;XXX: no "test" target
193 ("xorgproto" ,xorgproto)
199 ("freetype" ,freetype)
204 ("libtheora" ,libtheora)
208 (home-page "https://vtk.org/")
209 (synopsis "Libraries for 3D computer graphics")
211 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
212 image processing and visualization. It supports a wide variety of
213 visualization algorithms including: scalar, vector, tensor, texture, and
214 volumetric methods; and advanced modeling techniques such as: implicit
215 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
216 triangulation. VTK has an extensive information visualization framework, has
217 a suite of 3D interaction widgets, supports parallel processing, and
218 integrates with various databases on GUI toolkits such as Qt and Tk.")
219 (license license:bsd-3)))
221 ;; itksnap needs an older variant of VTK.
223 (package (inherit vtk)
227 (uri (string-append "https://vtk.org/files/release/"
228 (version-major+minor version)
229 "/VTK-" version ".tar.gz"))
232 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
234 `(("jsoncpp" ,jsoncpp-for-tensorflow)
235 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
237 (define-public opencv
244 (url "https://github.com/opencv/opencv")
246 (file-name (git-file-name name version))
249 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
250 (modules '((guix build utils)))
253 ;; Remove external libraries. We have all available in Guix:
254 (delete-file-recursively "3rdparty")
256 ;; Milky icon set is non-free:
257 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
260 (for-each delete-file
261 '("modules/java/test/pure_test/lib/junit-4.11.jar"
262 "samples/java/sbt/sbt/sbt-launch.jar"))
264 (build-system cmake-build-system)
267 (list "-DWITH_IPP=OFF"
269 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
270 "-DENABLE_PRECOMPILED_HEADERS=OFF"
273 ;; See cmake/OpenCVCompilerOptimizations.cmake
274 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
275 ;; BASELINE is the minimum optimization all CPUs must support
277 ;; DISPATCH is the list of optional dispatches.
278 "-DCPU_BASELINE=SSE2"
280 ,@(match (%current-system)
282 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
283 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
285 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
287 '("-DCPU_BASELINE=NEON"
288 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
291 "-DBUILD_PERF_TESTS=OFF"
294 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
295 "/opencv-contrib/modules")
298 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
299 "/opencv-extra/testdata")
301 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
302 ;; which we had removed, which would lead to an error:
303 "-DBUILD_PROTOBUF=OFF"
305 ;; Rebuild protobuf files, because we have a slightly different
306 ;; version than the included one. If we would not update, we
307 ;; would get a compile error later:
308 "-DPROTOBUF_UPDATE_FILES=ON"
310 ;; xfeatures2d disabled, because it downloads extra binaries from
311 ;; https://github.com/opencv/opencv_3rdparty
312 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
313 ;; Cmp this bug entry:
314 ;; https://github.com/opencv/opencv_contrib/issues/1131
315 "-DBUILD_opencv_xfeatures2d=OFF")
317 (modify-phases %standard-phases
318 (add-after 'unpack 'disable-broken-tests
320 ;; These tests fails with:
321 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
322 ;; I think we have no OpenGL support with the Xvfb.
323 (substitute* '("modules/viz/test/test_tutorial3.cpp"
324 "modules/viz/test/test_main.cpp"
325 "modules/viz/test/tests_simple.cpp"
326 "modules/viz/test/test_viz3d.cpp")
327 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
328 (string-append pre "DISABLED_" post)))
330 ;; This one fails with "unknown file: Failure"
331 ;; But I couldn't figure out which file was missing:
332 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
333 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
335 (string-append pre "DISABLED_" post)))
337 ;; Failure reason: Bad accuracy
338 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
339 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
340 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
341 (string-append pre "DISABLED_" post)))
344 (add-after 'unpack 'unpack-submodule-sources
345 (lambda* (#:key inputs #:allow-other-keys)
346 (mkdir "../opencv-extra")
347 (mkdir "../opencv-contrib")
348 (copy-recursively (assoc-ref inputs "opencv-extra")
351 (assoc-ref inputs "opencv-contrib")
352 "--strip-components=1"
353 "-C" "../opencv-contrib")))
355 (add-after 'set-paths 'add-ilmbase-include-path
356 (lambda* (#:key inputs #:allow-other-keys)
357 ;; OpenEXR propagates ilmbase, but its include files do not appear
358 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
359 ;; the CPATH to satisfy the dependency on "ImathVec.h".
361 (string-append (assoc-ref inputs "ilmbase")
363 ":" (or (getenv "CPATH") "")))
365 (add-before 'check 'start-xserver
366 (lambda* (#:key inputs #:allow-other-keys)
367 (let ((xorg-server (assoc-ref inputs "xorg-server"))
369 (setenv "HOME" (getcwd))
370 (setenv "DISPLAY" disp)
371 ;; There must be a running X server and make check doesn't start one.
372 ;; Therefore we must do it.
373 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
375 `(("pkg-config" ,pkg-config)
376 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
381 (url "https://github.com/opencv/opencv_extra")
383 (file-name (git-file-name "opencv_extra" version))
385 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
390 (url "https://github.com/opencv/opencv_contrib")
392 (file-name (git-file-name "opencv_contrib" version))
393 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
395 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
396 (inputs `(("libjpeg" ,libjpeg)
399 ;; ffmpeg 4.0 causes core dumps in tests.
400 ("ffmpeg" ,ffmpeg-3.4)
403 ("libgphoto2" ,libgphoto2)
406 ("gtkglext" ,gtkglext)
410 ("python-numpy" ,python-numpy)
411 ("protobuf" ,protobuf)
414 ;; These three CVEs are not a problem of OpenCV, see:
415 ;; https://github.com/opencv/opencv/issues/10998
416 (properties '((lint-hidden-cve . ("CVE-2018-7712"
419 (synopsis "Computer vision library")
420 (description "OpenCV is a library aimed at
421 real-time computer vision, including several hundred computer
422 vision algorithms. It can be used to do things like:
425 @item image and video input and output
426 @item image and video processing
428 @item feature recognition
430 @item facial recognition
432 @item structure from motion
433 @item augmented reality
434 @item machine learning
436 (home-page "https://opencv.org/")
437 (license license:bsd-3)))
447 "https://github.com/libvips/libvips/releases/download/v"
448 version "/vips-" version ".tar.gz"))
450 (base32 "01gjhcrl6zj7mcj1al717v5jsniahplqhz1xkfh2j78vyfl1hxff"))))
451 (build-system gnu-build-system)
453 `(("pkg-config" ,pkg-config)
454 ("gobject-introspection" ,gobject-introspection)))
470 ("niftilib" ,niftilib)
473 ("imagemagick" ,imagemagick)
477 (home-page "https://libvips.github.io/libvips/")
478 (synopsis "Multithreaded image processing system with low memory needs")
480 "VIPS is a demand-driven, horizontally threaded image processing library.
481 It's particularly good at processing large images, working with colour,
482 scientific analysis, and general research & development.
484 Compared to most image processing libraries VIPS needs little RAM and runs
485 quickly, especially on machines with more than one CPU core. This is primarily
486 due to its architecture which automatically parallelises the image workflows.")
487 (license license:lgpl2.1+)))
496 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
497 version "/nip2-" version ".tar.gz" ))
499 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
500 (build-system gnu-build-system)
503 (modify-phases %standard-phases
504 ;; test_conv.ws keep failing so disabling for now.
505 (add-after 'unpack 'disable-test-conv
507 (delete-file "test/workspaces/test_conv.ws")
509 (add-before 'check 'set-home
511 (setenv "HOME" "/tmp") #t)))))
519 ("libjpeg" ,libjpeg) ; required by vips.pc
523 ("imagemagick" ,imagemagick)
534 ("pkg-config" ,pkg-config)))
535 (home-page "https://github.com/libvips/nip2")
536 (synopsis "Spreadsheet-like GUI for libvips")
537 (description "This package provide a graphical user interface (GUI) for
538 the VIPS image processing library. It's a little like a spreadsheet: you
539 create a set of formula connecting your objects together, and on a change nip2
541 (license license:gpl2+)))
551 (url "https://github.com/vxl/vxl.git")
552 (commit (string-append "v" version))))
553 (file-name (git-file-name name version))
555 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
556 (modules '((guix build utils)))
557 ;; TODO: vxl includes an old version of dcmtk. It won't build with
561 (for-each delete-file-recursively
568 (substitute* "v3p/CMakeLists.txt"
569 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
572 (build-system cmake-build-system)
574 `(("libgeotiff" ,libgeotiff)
579 (home-page "https://github.com/vxl/vxl/")
580 (synopsis "Collection of C++ libraries for computer vision")
581 (description "VXL (the Vision-something-Libraries) is a collection of C++
582 libraries designed for computer vision research and implementation.")
583 (license license:bsd-3)))
586 (package (inherit vxl)
593 (url "https://github.com/vxl/vxl.git")
594 (commit (string-append "v" version))))
595 (file-name (git-file-name name version))
597 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
598 (modules '((guix build utils)))
601 (for-each delete-file-recursively
607 (substitute* "v3p/CMakeLists.txt"
608 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
613 ;; Needed for itk-snap
614 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
616 (define-public insight-toolkit
618 (name "insight-toolkit")
623 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
624 "releases/download/v" version "/InsightToolkit-"
627 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
628 (build-system cmake-build-system)
630 `(#:tests? #f ; tests require network access and external data
633 "-DITK_USE_SYSTEM_LIBRARIES=ON"
634 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
635 "-DITK_BUILD_SHARED=ON"
636 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
637 ;; variable in the installed CMake files. This is necessary as other
638 ;; packages using insight-toolkit could not be configured otherwise.
639 "-DGTEST_ROOT=gtest")
641 (modify-phases %standard-phases
642 (add-after 'unpack 'do-not-tune
644 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
645 (("-mute=native") ""))
656 ("mesa" ,mesa-opencl)
663 `(("googletest" ,googletest)
664 ("pkg-config" ,pkg-config)))
665 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
666 (synopsis "Scientific image processing, segmentation and registration")
667 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
668 scientific image processing, segmentation, and registration. Segmentation is
669 the process of identifying and classifying data found in a digitally sampled
670 representation. Typically the sampled representation is an image acquired
671 from such medical instrumentation as CT or MRI scanners. Registration is the
672 task of aligning or developing correspondences between data. For example, in
673 the medical environment, a CT scan may be aligned with a MRI scan in order to
674 combine the information contained in both.")
675 (license license:asl2.0)))
677 (define-public insight-toolkit-4
678 (package (inherit insight-toolkit)
683 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
684 "releases/download/v" version "/InsightToolkit-"
687 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
689 `(#:tests? #f ; tests require network access and external data
691 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
693 "-DITK_USE_SYSTEM_LIBRARIES=ON"
694 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
695 "-DITK_USE_SYSTEM_VXL=ON")))))
697 (define-public insight-toolkit-4.12
698 (package (inherit insight-toolkit-4)
703 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
704 "InsightToolkit-" version ".tar.xz"))
706 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
708 (define-public itk-snap
716 (url "https://git.code.sf.net/p/itk-snap/src")
717 (commit (string-append "v" version))))
718 (file-name (git-file-name name version))
720 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
721 (build-system cmake-build-system)
724 (list "-DSNAP_VERSION_GIT_SHA1=release"
725 "-DSNAP_VERSION_GIT_BRANCH=release"
726 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
727 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
728 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
730 (modify-phases %standard-phases
731 ;; During the installation phase all libraries provided by all
732 ;; dependencies will be copied to the lib directory. That's insane,
733 ;; so we disable this.
734 (add-after 'unpack 'do-not-copy-dependencies
736 (substitute* "CMakeLists.txt"
737 (("install_qt5_executable\
738 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
741 (add-after 'unpack 'disable-gui-tests
743 ;; The GUI tests just time out.
744 (substitute* "CMakeLists.txt"
745 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
746 |RandomForest|RandomForestBailOut)")
749 (add-after 'unpack 'make-reproducible
751 (substitute* "CMakeLists.txt"
752 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
753 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
755 (add-after 'unpack 'prepare-submodules
756 (lambda* (#:key inputs #:allow-other-keys)
757 (rmdir "Submodules/c3d")
758 (copy-recursively (assoc-ref inputs "c3d-src")
760 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
761 "Submodules/c3d/adapters/ApplyMetric.cxx")
763 (rmdir "Submodules/greedy")
764 (symlink (assoc-ref inputs "greedy-src")
767 (add-after 'unpack 'fix-includes
769 (substitute* "GUI/Model/RegistrationModel.cxx"
770 (("<vnl_symmetric_eigensystem.h>")
771 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
773 (add-before 'check 'prepare-tests
775 ;; Needed by at least one test.
776 (setenv "HOME" "/tmp")
778 (add-after 'install 'wrap-executable
779 (lambda* (#:key inputs outputs #:allow-other-keys)
780 (let ((out (assoc-ref outputs "out")))
781 (wrap-program (string-append out "/bin/itksnap")
782 `("QT_PLUGIN_PATH" ":" prefix
783 ,(map (lambda (label)
784 (string-append (assoc-ref inputs label)
786 '("qtbase" "qtdeclarative"))))
794 ("mesa" ,mesa-opencl)
795 ;; This package does not build with either insight-toolkit 5.0.0 and
796 ;; not with 4.13. It really needs to be 4.12.
797 ("itk" ,insight-toolkit-4.12)
800 ("qtdeclarative" ,qtdeclarative)
805 `(("googletest" ,googletest)
806 ("pkg-config" ,pkg-config)
808 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
810 (version (git-version "0" revision commit)))
814 (url "https://github.com/pyushkevich/c3d.git")
816 (file-name (git-file-name "c3d" version))
819 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
820 ;; We are using an arbitrary commit from 2017 because the latest
821 ;; version breaks the build...
823 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
825 (version (git-version "0" revision commit)))
829 (url "https://github.com/pyushkevich/greedy.git")
831 (file-name (git-file-name "greedy" version))
834 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
835 (home-page "https://sourceforge.net/p/itk-snap/")
836 (synopsis "Medical image segmentation")
837 (description "ITK-SNAP is a tool for segmenting anatomical structures in
838 medical images. It provides an automatic active contour segmentation
839 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
840 full-featured UI aimed at clinical researchers.")
841 ;; This includes the submodules greedy and c3d.
842 (license license:gpl3+)))