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>
11 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages image-processing)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages)
31 #:use-module (guix utils)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system gnu)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages algebra)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages boost)
40 #:use-module (gnu packages check)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages curl)
43 #:use-module (gnu packages documentation)
44 #:use-module (gnu packages flex)
45 #:use-module (gnu packages fontutils)
46 #:use-module (gnu packages geo)
47 #:use-module (gnu packages ghostscript)
48 #:use-module (gnu packages gl)
49 #:use-module (gnu packages glib)
50 #:use-module (gnu packages gnome)
51 #:use-module (gnu packages graphics)
52 #:use-module (gnu packages graphviz)
53 #:use-module (gnu packages gstreamer)
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages image)
56 #:use-module (gnu packages imagemagick)
57 #:use-module (gnu packages maths)
58 #:use-module (gnu packages pdf)
59 #:use-module (gnu packages perl)
60 #:use-module (gnu packages photo)
61 #:use-module (gnu packages pkg-config)
62 #:use-module (gnu packages protobuf)
63 #:use-module (gnu packages python)
64 #:use-module (gnu packages python-xyz)
65 #:use-module (gnu packages qt)
66 #:use-module (gnu packages serialization)
67 #:use-module (gnu packages tbb)
68 #:use-module (gnu packages tls)
69 #:use-module (gnu packages video)
70 #:use-module (gnu packages xiph)
71 #:use-module (gnu packages xml)
72 #:use-module (gnu packages xorg)
73 #:use-module (ice-9 match)
74 #:use-module (srfi srfi-1))
84 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
85 "dcmtk" (string-join (string-split version #\.) "")
86 "/dcmtk-" version ".tar.gz"))
88 (base32 "1fdyz5wwjp4grys61mxb2ia9fi6i3ax6s43l16xnv291bxk7hld0"))))
89 (build-system cmake-build-system)
91 `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“.
93 ("libjpeg" ,libjpeg-turbo)
100 `(("doxygen" ,doxygen))) ; for HTML documentation
101 (home-page "https://dcmtk.org")
102 (synopsis "Libraries and programs implementing parts of the DICOM standard")
103 (description "DCMTK is a collection of libraries and applications
104 implementing large parts the DICOM standard. It includes software for
105 examining, constructing and converting DICOM image files, handling offline
106 media, sending and receiving images over a network connection, as well as
107 demonstrative image storage and worklist servers.")
108 (license (license:fsf-free
110 "A union of the Apache 2.0 licence and various non-copyleft
111 licences similar to the Modified BSD licence."))))
119 (uri (string-append "mirror://sourceforge/mia/mia/"
120 (version-major+minor version)
121 "/mia-" version ".tar.xz"))
124 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
125 (build-system cmake-build-system)
128 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
129 "-DCMAKE_CXX_FLAGS=-fpermissive")))
141 ("libjpeg" ,libjpeg-turbo)
145 ("libxml++" ,libxml++)
147 ("niftilib" ,niftilib)
150 ("python-lxml" ,python2-lxml)
153 `(("pkg-config" ,pkg-config)
154 ("python" ,python-2)))
155 (home-page "http://mia.sourceforge.net")
156 (synopsis "Toolkit for gray scale medical image analysis")
157 (description "MIA provides a combination of command line tools, plug-ins,
158 and libraries that make it possible run image processing tasks interactively
159 in a command shell and to prototype using the shell's scripting language. It
160 is built around a plug-in structure that makes it easy to add functionality
161 without compromising the original code base and it makes use of a wide variety
162 of external libraries that provide additional functionality.")
163 (license license:gpl3+)))
171 (uri (string-append "https://vtk.org/files/release/"
172 (version-major+minor version)
173 "/VTK-" version ".tar.gz"))
176 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
177 (build-system cmake-build-system)
179 '(#:build-type "Release" ;Build without '-g' to save space.
180 ;; -DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE requires netcdf_cxx
181 #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
182 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
183 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
184 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
185 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
186 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
187 "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE"
188 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
189 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
190 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
191 #:tests? #f)) ;XXX: no "test" target
194 ("xorgproto" ,xorgproto)
200 ("freetype" ,freetype)
202 ("jpeg" ,libjpeg-turbo)
205 ("libtheora" ,libtheora)
209 (home-page "https://vtk.org/")
210 (synopsis "Libraries for 3D computer graphics")
212 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
213 image processing and visualization. It supports a wide variety of
214 visualization algorithms including: scalar, vector, tensor, texture, and
215 volumetric methods; and advanced modeling techniques such as: implicit
216 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
217 triangulation. VTK has an extensive information visualization framework, has
218 a suite of 3D interaction widgets, supports parallel processing, and
219 integrates with various databases on GUI toolkits such as Qt and Tk.")
220 (license license:bsd-3)))
222 ;; itksnap needs an older variant of VTK.
224 (package (inherit vtk)
228 (uri (string-append "https://vtk.org/files/release/"
229 (version-major+minor version)
230 "/VTK-" version ".tar.gz"))
233 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
235 `(("jsoncpp" ,jsoncpp-for-tensorflow)
236 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
238 (define-public opencv
245 (url "https://github.com/opencv/opencv")
247 (file-name (git-file-name name version))
250 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
251 (modules '((guix build utils)))
254 ;; Remove external libraries. We have all available in Guix:
255 (delete-file-recursively "3rdparty")
257 ;; Milky icon set is non-free:
258 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
261 (for-each delete-file
262 '("modules/java/test/pure_test/lib/junit-4.11.jar"
263 "samples/java/sbt/sbt/sbt-launch.jar"))
265 (build-system cmake-build-system)
268 (list "-DWITH_IPP=OFF"
270 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
271 "-DENABLE_PRECOMPILED_HEADERS=OFF"
274 ;; See cmake/OpenCVCompilerOptimizations.cmake
275 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
276 ;; BASELINE is the minimum optimization all CPUs must support
278 ;; DISPATCH is the list of optional dispatches.
279 "-DCPU_BASELINE=SSE2"
281 ,@(match (%current-system)
283 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
284 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
286 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
288 '("-DCPU_BASELINE=NEON"
289 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
292 "-DBUILD_PERF_TESTS=OFF"
295 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
296 "/opencv-contrib/modules")
299 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
300 "/opencv-extra/testdata")
302 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
303 ;; which we had removed, which would lead to an error:
304 "-DBUILD_PROTOBUF=OFF"
306 ;; Rebuild protobuf files, because we have a slightly different
307 ;; version than the included one. If we would not update, we
308 ;; would get a compile error later:
309 "-DPROTOBUF_UPDATE_FILES=ON"
311 ;; xfeatures2d disabled, because it downloads extra binaries from
312 ;; https://github.com/opencv/opencv_3rdparty
313 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
314 ;; Cmp this bug entry:
315 ;; https://github.com/opencv/opencv_contrib/issues/1131
316 "-DBUILD_opencv_xfeatures2d=OFF")
318 (modify-phases %standard-phases
319 (add-after 'unpack 'disable-broken-tests
321 ;; These tests fails with:
322 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
323 ;; I think we have no OpenGL support with the Xvfb.
324 (substitute* '("modules/viz/test/test_tutorial3.cpp"
325 "modules/viz/test/test_main.cpp"
326 "modules/viz/test/tests_simple.cpp"
327 "modules/viz/test/test_viz3d.cpp")
328 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
329 (string-append pre "DISABLED_" post)))
331 ;; This one fails with "unknown file: Failure"
332 ;; But I couldn't figure out which file was missing:
333 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
334 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
336 (string-append pre "DISABLED_" post)))
338 ;; Failure reason: Bad accuracy
339 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
340 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
341 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
342 (string-append pre "DISABLED_" post)))
345 (add-after 'unpack 'unpack-submodule-sources
346 (lambda* (#:key inputs #:allow-other-keys)
347 (mkdir "../opencv-extra")
348 (mkdir "../opencv-contrib")
349 (copy-recursively (assoc-ref inputs "opencv-extra")
352 (assoc-ref inputs "opencv-contrib")
353 "--strip-components=1"
354 "-C" "../opencv-contrib")))
356 (add-after 'set-paths 'add-ilmbase-include-path
357 (lambda* (#:key inputs #:allow-other-keys)
358 ;; OpenEXR propagates ilmbase, but its include files do not appear
359 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
360 ;; the CPATH to satisfy the dependency on "ImathVec.h".
362 (string-append (assoc-ref inputs "ilmbase")
364 ":" (or (getenv "CPATH") "")))
366 (add-before 'check 'start-xserver
367 (lambda* (#:key inputs #:allow-other-keys)
368 (let ((xorg-server (assoc-ref inputs "xorg-server"))
370 (setenv "HOME" (getcwd))
371 (setenv "DISPLAY" disp)
372 ;; There must be a running X server and make check doesn't start one.
373 ;; Therefore we must do it.
374 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
376 `(("pkg-config" ,pkg-config)
377 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
382 (url "https://github.com/opencv/opencv_extra")
384 (file-name (git-file-name "opencv_extra" version))
386 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
391 (url "https://github.com/opencv/opencv_contrib")
393 (file-name (git-file-name "opencv_contrib" version))
394 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
396 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
397 (inputs `(("libjpeg" ,libjpeg-turbo)
400 ;; ffmpeg 4.0 causes core dumps in tests.
401 ("ffmpeg" ,ffmpeg-3.4)
404 ("libgphoto2" ,libgphoto2)
407 ("gtkglext" ,gtkglext)
411 ("python-numpy" ,python-numpy)
412 ("protobuf" ,protobuf)
415 ;; These three CVEs are not a problem of OpenCV, see:
416 ;; https://github.com/opencv/opencv/issues/10998
417 (properties '((lint-hidden-cve . ("CVE-2018-7712"
420 (synopsis "Computer vision library")
421 (description "OpenCV is a library aimed at
422 real-time computer vision, including several hundred computer
423 vision algorithms. It can be used to do things like:
426 @item image and video input and output
427 @item image and video processing
429 @item feature recognition
431 @item facial recognition
433 @item structure from motion
434 @item augmented reality
435 @item machine learning
437 (home-page "https://opencv.org/")
438 (license license:bsd-3)))
448 "https://github.com/libvips/libvips/releases/download/v"
449 version "/vips-" version ".tar.gz"))
451 (base32 "01gjhcrl6zj7mcj1al717v5jsniahplqhz1xkfh2j78vyfl1hxff"))))
452 (build-system gnu-build-system)
454 `(("pkg-config" ,pkg-config)
455 ("gobject-introspection" ,gobject-introspection)))
458 ("libjpeg" ,libjpeg-turbo)
471 ("niftilib" ,niftilib)
474 ("imagemagick" ,imagemagick)
478 (home-page "https://libvips.github.io/libvips/")
479 (synopsis "Multithreaded image processing system with low memory needs")
481 "VIPS is a demand-driven, horizontally threaded image processing library.
482 It's particularly good at processing large images, working with colour,
483 scientific analysis, and general research & development.
485 Compared to most image processing libraries VIPS needs little RAM and runs
486 quickly, especially on machines with more than one CPU core. This is primarily
487 due to its architecture which automatically parallelises the image workflows.")
488 (license license:lgpl2.1+)))
497 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
498 version "/nip2-" version ".tar.gz" ))
500 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
501 (build-system gnu-build-system)
504 (modify-phases %standard-phases
505 ;; test_conv.ws keep failing so disabling for now.
506 (add-after 'unpack 'disable-test-conv
508 (delete-file "test/workspaces/test_conv.ws")
510 (add-before 'check 'set-home
512 (setenv "HOME" "/tmp") #t)))))
520 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
524 ("imagemagick" ,imagemagick)
535 ("pkg-config" ,pkg-config)))
536 (home-page "https://github.com/libvips/nip2")
537 (synopsis "Spreadsheet-like GUI for libvips")
538 (description "This package provide a graphical user interface (GUI) for
539 the VIPS image processing library. It's a little like a spreadsheet: you
540 create a set of formula connecting your objects together, and on a change nip2
542 (license license:gpl2+)))
552 (url "https://github.com/vxl/vxl.git")
553 (commit (string-append "v" version))))
554 (file-name (git-file-name name version))
556 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
557 (modules '((guix build utils)))
558 ;; TODO: vxl includes an old version of dcmtk. It won't build with
562 (for-each delete-file-recursively
569 (substitute* "v3p/CMakeLists.txt"
570 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
573 (build-system cmake-build-system)
575 `(("libgeotiff" ,libgeotiff)
577 ("libjpeg" ,libjpeg-turbo)
580 (home-page "https://github.com/vxl/vxl/")
581 (synopsis "Collection of C++ libraries for computer vision")
582 (description "VXL (the Vision-something-Libraries) is a collection of C++
583 libraries designed for computer vision research and implementation.")
584 (license license:bsd-3)))
587 (package (inherit vxl)
594 (url "https://github.com/vxl/vxl.git")
595 (commit (string-append "v" version))))
596 (file-name (git-file-name name version))
598 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
599 (modules '((guix build utils)))
602 (for-each delete-file-recursively
608 (substitute* "v3p/CMakeLists.txt"
609 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
614 ;; Needed for itk-snap
615 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
617 (define-public insight-toolkit
619 (name "insight-toolkit")
624 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
625 "releases/download/v" version "/InsightToolkit-"
628 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
629 (build-system cmake-build-system)
631 `(#:tests? #f ; tests require network access and external data
634 "-DITK_USE_SYSTEM_LIBRARIES=ON"
635 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
636 "-DITK_BUILD_SHARED=ON"
637 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
638 ;; variable in the installed CMake files. This is necessary as other
639 ;; packages using insight-toolkit could not be configured otherwise.
640 "-DGTEST_ROOT=gtest")
642 (modify-phases %standard-phases
643 (add-after 'unpack 'do-not-tune
645 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
646 (("-mute=native") ""))
654 ("libjpeg" ,libjpeg-turbo)
657 ("mesa" ,mesa-opencl)
664 `(("googletest" ,googletest)
665 ("pkg-config" ,pkg-config)))
666 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
667 (synopsis "Scientific image processing, segmentation and registration")
668 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
669 scientific image processing, segmentation, and registration. Segmentation is
670 the process of identifying and classifying data found in a digitally sampled
671 representation. Typically the sampled representation is an image acquired
672 from such medical instrumentation as CT or MRI scanners. Registration is the
673 task of aligning or developing correspondences between data. For example, in
674 the medical environment, a CT scan may be aligned with a MRI scan in order to
675 combine the information contained in both.")
676 (license license:asl2.0)))
678 (define-public insight-toolkit-4
679 (package (inherit insight-toolkit)
684 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
685 "releases/download/v" version "/InsightToolkit-"
688 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
690 `(#:tests? #f ; tests require network access and external data
692 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
694 "-DITK_USE_SYSTEM_LIBRARIES=ON"
695 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
696 "-DITK_USE_SYSTEM_VXL=ON")))))
698 (define-public insight-toolkit-4.12
699 (package (inherit insight-toolkit-4)
704 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
705 "InsightToolkit-" version ".tar.xz"))
707 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
709 (define-public itk-snap
717 (url "https://git.code.sf.net/p/itk-snap/src")
718 (commit (string-append "v" version))))
719 (file-name (git-file-name name version))
721 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
722 (build-system cmake-build-system)
725 (list "-DSNAP_VERSION_GIT_SHA1=release"
726 "-DSNAP_VERSION_GIT_BRANCH=release"
727 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
728 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
729 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
731 (modify-phases %standard-phases
732 ;; During the installation phase all libraries provided by all
733 ;; dependencies will be copied to the lib directory. That's insane,
734 ;; so we disable this.
735 (add-after 'unpack 'do-not-copy-dependencies
737 (substitute* "CMakeLists.txt"
738 (("install_qt5_executable\
739 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
742 (add-after 'unpack 'disable-gui-tests
744 ;; The GUI tests just time out.
745 (substitute* "CMakeLists.txt"
746 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
747 |RandomForest|RandomForestBailOut)")
750 (add-after 'unpack 'make-reproducible
752 (substitute* "CMakeLists.txt"
753 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
754 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
756 (add-after 'unpack 'prepare-submodules
757 (lambda* (#:key inputs #:allow-other-keys)
758 (rmdir "Submodules/c3d")
759 (copy-recursively (assoc-ref inputs "c3d-src")
761 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
762 "Submodules/c3d/adapters/ApplyMetric.cxx")
764 (rmdir "Submodules/greedy")
765 (symlink (assoc-ref inputs "greedy-src")
768 (add-after 'unpack 'fix-includes
770 (substitute* "GUI/Model/RegistrationModel.cxx"
771 (("<vnl_symmetric_eigensystem.h>")
772 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
774 (add-before 'check 'prepare-tests
776 ;; Needed by at least one test.
777 (setenv "HOME" "/tmp")
779 (add-after 'install 'wrap-executable
780 (lambda* (#:key inputs outputs #:allow-other-keys)
781 (let ((out (assoc-ref outputs "out")))
782 (wrap-program (string-append out "/bin/itksnap")
783 `("QT_PLUGIN_PATH" ":" prefix
784 ,(map (lambda (label)
785 (string-append (assoc-ref inputs label)
787 '("qtbase" "qtdeclarative"))))
795 ("mesa" ,mesa-opencl)
796 ;; This package does not build with either insight-toolkit 5.0.0 and
797 ;; not with 4.13. It really needs to be 4.12.
798 ("itk" ,insight-toolkit-4.12)
801 ("qtdeclarative" ,qtdeclarative)
805 `(("googletest" ,googletest)
807 ("pkg-config" ,pkg-config)
809 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
811 (version (git-version "0" revision commit)))
815 (url "https://github.com/pyushkevich/c3d.git")
817 (file-name (git-file-name "c3d" version))
820 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
821 ;; We are using an arbitrary commit from 2017 because the latest
822 ;; version breaks the build...
824 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
826 (version (git-version "0" revision commit)))
830 (url "https://github.com/pyushkevich/greedy.git")
832 (file-name (git-file-name "greedy" version))
835 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
836 (home-page "https://sourceforge.net/p/itk-snap/")
837 (synopsis "Medical image segmentation")
838 (description "ITK-SNAP is a tool for segmenting anatomical structures in
839 medical images. It provides an automatic active contour segmentation
840 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
841 full-featured UI aimed at clinical researchers.")
842 ;; This includes the submodules greedy and c3d.
843 (license license:gpl3+)))