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>
12 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages image-processing)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix utils)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages algebra)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages boost)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages curl)
44 #:use-module (gnu packages documentation)
45 #:use-module (gnu packages flex)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages geo)
48 #:use-module (gnu packages ghostscript)
49 #:use-module (gnu packages gl)
50 #:use-module (gnu packages glib)
51 #:use-module (gnu packages gnome)
52 #:use-module (gnu packages graphics)
53 #:use-module (gnu packages graphviz)
54 #:use-module (gnu packages gstreamer)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages image)
57 #:use-module (gnu packages imagemagick)
58 #:use-module (gnu packages maths)
59 #:use-module (gnu packages pdf)
60 #:use-module (gnu packages perl)
61 #:use-module (gnu packages photo)
62 #:use-module (gnu packages pkg-config)
63 #:use-module (gnu packages protobuf)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages python-xyz)
66 #:use-module (gnu packages qt)
67 #:use-module (gnu packages serialization)
68 #:use-module (gnu packages tbb)
69 #:use-module (gnu packages tls)
70 #:use-module (gnu packages video)
71 #:use-module (gnu packages xiph)
72 #:use-module (gnu packages xml)
73 #:use-module (gnu packages xorg)
74 #:use-module (ice-9 match)
75 #:use-module (srfi srfi-1))
85 (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/"
86 "dcmtk" (string-join (string-split version #\.) "")
87 "/dcmtk-" version ".tar.gz"))
89 (base32 "1fdyz5wwjp4grys61mxb2ia9fi6i3ax6s43l16xnv291bxk7hld0"))))
90 (build-system cmake-build-system)
92 `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“.
94 ("libjpeg" ,libjpeg-turbo)
101 `(("doxygen" ,doxygen))) ; for HTML documentation
102 (home-page "https://dcmtk.org")
103 (synopsis "Libraries and programs implementing parts of the DICOM standard")
104 (description "DCMTK is a collection of libraries and applications
105 implementing large parts the DICOM standard. It includes software for
106 examining, constructing and converting DICOM image files, handling offline
107 media, sending and receiving images over a network connection, as well as
108 demonstrative image storage and worklist servers.")
109 (license (license:fsf-free
111 "A union of the Apache 2.0 licence and various non-copyleft
112 licences similar to the Modified BSD licence."))))
120 (uri (string-append "mirror://sourceforge/mia/mia/"
121 (version-major+minor version)
122 "/mia-" version ".tar.xz"))
125 "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
126 (build-system cmake-build-system)
129 (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
130 "-DCMAKE_CXX_FLAGS=-fpermissive")))
142 ("libjpeg" ,libjpeg-turbo)
146 ("libxml++" ,libxml++)
148 ("niftilib" ,niftilib)
151 ("python-lxml" ,python2-lxml)
154 `(("pkg-config" ,pkg-config)
155 ("python" ,python-2)))
156 (home-page "http://mia.sourceforge.net")
157 (synopsis "Toolkit for gray scale medical image analysis")
158 (description "MIA provides a combination of command line tools, plug-ins,
159 and libraries that make it possible run image processing tasks interactively
160 in a command shell and to prototype using the shell's scripting language. It
161 is built around a plug-in structure that makes it easy to add functionality
162 without compromising the original code base and it makes use of a wide variety
163 of external libraries that provide additional functionality.")
164 (license license:gpl3+)))
172 (uri (string-append "https://vtk.org/files/release/"
173 (version-major+minor version)
174 "/VTK-" version ".tar.gz"))
177 "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"))))
178 (build-system cmake-build-system)
180 '(#:build-type "Release" ;Build without '-g' to save space.
181 ;; -DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE requires netcdf_cxx
182 #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
183 "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
184 "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
185 "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
186 "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
187 "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
188 "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE"
189 "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
190 "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
191 "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
192 #:tests? #f)) ;XXX: no "test" target
195 ("xorgproto" ,xorgproto)
201 ("freetype" ,freetype)
203 ("jpeg" ,libjpeg-turbo)
206 ("libtheora" ,libtheora)
210 (home-page "https://vtk.org/")
211 (synopsis "Libraries for 3D computer graphics")
213 "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
214 image processing and visualization. It supports a wide variety of
215 visualization algorithms including: scalar, vector, tensor, texture, and
216 volumetric methods; and advanced modeling techniques such as: implicit
217 modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
218 triangulation. VTK has an extensive information visualization framework, has
219 a suite of 3D interaction widgets, supports parallel processing, and
220 integrates with various databases on GUI toolkits such as Qt and Tk.")
221 (license license:bsd-3)))
223 ;; itksnap needs an older variant of VTK.
225 (package (inherit vtk)
229 (uri (string-append "https://vtk.org/files/release/"
230 (version-major+minor version)
231 "/VTK-" version ".tar.gz"))
234 "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j"))))
236 `(("jsoncpp" ,jsoncpp-for-tensorflow)
237 ,@(alist-delete "jsoncpp" (package-inputs vtk))))))
239 (define-public opencv
246 (url "https://github.com/opencv/opencv")
248 (file-name (git-file-name name version))
251 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
252 (modules '((guix build utils)))
255 ;; Remove external libraries. We have all available in Guix:
256 (delete-file-recursively "3rdparty")
258 ;; Milky icon set is non-free:
259 (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
262 (for-each delete-file
263 '("modules/java/test/pure_test/lib/junit-4.11.jar"
264 "samples/java/sbt/sbt/sbt-launch.jar"))
266 (build-system cmake-build-system)
269 (list "-DWITH_IPP=OFF"
271 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
272 "-DENABLE_PRECOMPILED_HEADERS=OFF"
275 ;; See cmake/OpenCVCompilerOptimizations.cmake
276 ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations
277 ;; BASELINE is the minimum optimization all CPUs must support
279 ;; DISPATCH is the list of optional dispatches.
280 "-DCPU_BASELINE=SSE2"
282 ,@(match (%current-system)
284 '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
285 "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"))
287 '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures
289 '("-DCPU_BASELINE=NEON"
290 "-DCPU_DISPATCH=NEON;VFPV3;FP16"))
293 "-DBUILD_PERF_TESTS=OFF"
296 (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd)
297 "/opencv-contrib/modules")
300 (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd)
301 "/opencv-extra/testdata")
303 ;; Is ON by default and would try to rebuild 3rd-party protobuf,
304 ;; which we had removed, which would lead to an error:
305 "-DBUILD_PROTOBUF=OFF"
307 ;; Rebuild protobuf files, because we have a slightly different
308 ;; version than the included one. If we would not update, we
309 ;; would get a compile error later:
310 "-DPROTOBUF_UPDATE_FILES=ON"
312 ;; xfeatures2d disabled, because it downloads extra binaries from
313 ;; https://github.com/opencv/opencv_3rdparty
314 ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
315 ;; Cmp this bug entry:
316 ;; https://github.com/opencv/opencv_contrib/issues/1131
317 "-DBUILD_opencv_xfeatures2d=OFF")
319 (modify-phases %standard-phases
320 (add-after 'unpack 'disable-broken-tests
322 ;; These tests fails with:
323 ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config
324 ;; I think we have no OpenGL support with the Xvfb.
325 (substitute* '("modules/viz/test/test_tutorial3.cpp"
326 "modules/viz/test/test_main.cpp"
327 "modules/viz/test/tests_simple.cpp"
328 "modules/viz/test/test_viz3d.cpp")
329 (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
330 (string-append pre "DISABLED_" post)))
332 ;; This one fails with "unknown file: Failure"
333 ;; But I couldn't figure out which file was missing:
334 (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
335 (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
337 (string-append pre "DISABLED_" post)))
339 ;; Failure reason: Bad accuracy
340 ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000
341 (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
342 (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
343 (string-append pre "DISABLED_" post)))
346 (add-after 'unpack 'unpack-submodule-sources
347 (lambda* (#:key inputs #:allow-other-keys)
348 (mkdir "../opencv-extra")
349 (mkdir "../opencv-contrib")
350 (copy-recursively (assoc-ref inputs "opencv-extra")
353 (assoc-ref inputs "opencv-contrib")
354 "--strip-components=1"
355 "-C" "../opencv-contrib")))
357 (add-after 'set-paths 'add-ilmbase-include-path
358 (lambda* (#:key inputs #:allow-other-keys)
359 ;; OpenEXR propagates ilmbase, but its include files do not appear
360 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
361 ;; the CPATH to satisfy the dependency on "ImathVec.h".
363 (string-append (assoc-ref inputs "ilmbase")
365 ":" (or (getenv "CPATH") "")))
367 (add-before 'check 'start-xserver
368 (lambda* (#:key inputs #:allow-other-keys)
369 (let ((xorg-server (assoc-ref inputs "xorg-server"))
371 (setenv "HOME" (getcwd))
372 (setenv "DISPLAY" disp)
373 ;; There must be a running X server and make check doesn't start one.
374 ;; Therefore we must do it.
375 (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
377 `(("pkg-config" ,pkg-config)
378 ("xorg-server" ,xorg-server-for-tests) ; For running the tests
383 (url "https://github.com/opencv/opencv_extra")
385 (file-name (git-file-name "opencv_extra" version))
387 (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
392 (url "https://github.com/opencv/opencv_contrib")
394 (file-name (git-file-name "opencv_contrib" version))
395 (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
397 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
398 (inputs `(("libjpeg" ,libjpeg-turbo)
401 ;; ffmpeg 4.0 causes core dumps in tests.
402 ("ffmpeg" ,ffmpeg-3.4)
405 ("libgphoto2" ,libgphoto2)
408 ("gtkglext" ,gtkglext)
412 ("python-numpy" ,python-numpy)
413 ("protobuf" ,protobuf)
416 ;; These three CVEs are not a problem of OpenCV, see:
417 ;; https://github.com/opencv/opencv/issues/10998
418 (properties '((lint-hidden-cve . ("CVE-2018-7712"
421 (synopsis "Computer vision library")
422 (description "OpenCV is a library aimed at
423 real-time computer vision, including several hundred computer
424 vision algorithms. It can be used to do things like:
427 @item image and video input and output
428 @item image and video processing
430 @item feature recognition
432 @item facial recognition
434 @item structure from motion
435 @item augmented reality
436 @item machine learning
438 (home-page "https://opencv.org/")
439 (license license:bsd-3)))
449 "https://github.com/libvips/libvips/releases/download/v"
450 version "/vips-" version ".tar.gz"))
452 (base32 "01gjhcrl6zj7mcj1al717v5jsniahplqhz1xkfh2j78vyfl1hxff"))))
453 (build-system gnu-build-system)
455 `(("pkg-config" ,pkg-config)
456 ("gobject-introspection" ,gobject-introspection)))
459 ("libjpeg" ,libjpeg-turbo)
472 ("niftilib" ,niftilib)
475 ("imagemagick" ,imagemagick)
479 (home-page "https://libvips.github.io/libvips/")
480 (synopsis "Multithreaded image processing system with low memory needs")
482 "VIPS is a demand-driven, horizontally threaded image processing library.
483 It's particularly good at processing large images, working with colour,
484 scientific analysis, and general research & development.
486 Compared to most image processing libraries VIPS needs little RAM and runs
487 quickly, especially on machines with more than one CPU core. This is primarily
488 due to its architecture which automatically parallelises the image workflows.")
489 (license license:lgpl2.1+)))
498 (uri (string-append "https://gmic.eu/files/source/gmic_"
501 (base32 "13axx7nwchn6ysgpvlw3fib474q4nrwv3qn20g3q03ldid0xvjah"))))
502 (build-system cmake-build-system)
504 `(#:tests? #f)) ;there are no tests
506 `(("pkg-config" ,pkg-config)))
510 ("graphicsmagick" ,graphicsmagick)
511 ("libjpeg-turbo" ,libjpeg-turbo)
515 ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI
518 (home-page "https://gmic.eu/")
519 (synopsis "Full-featured framework for digital image processing")
520 (description "G'MIC is a full-featured framework for digital image
521 processing. It provides several user interfaces to convert / manipulate
522 / filter / visualize generic image datasets, ranging from 1D scalar
523 signals to 3D+t sequences of multi-spectral volumetric images, hence
524 including 2D color images.")
525 ;; Dual-licensed, either license applies.
526 (license (list license:cecill license:cecill-c))))
535 (uri (string-append "https://github.com/libvips/nip2/releases/download/v"
536 version "/nip2-" version ".tar.gz" ))
538 (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw"))))
539 (build-system gnu-build-system)
542 (modify-phases %standard-phases
543 ;; test_conv.ws keep failing so disabling for now.
544 (add-after 'unpack 'disable-test-conv
546 (delete-file "test/workspaces/test_conv.ws")
548 (add-before 'check 'set-home
550 (setenv "HOME" "/tmp") #t)))))
558 ("libjpeg" ,libjpeg-turbo) ;required by vips.pc
562 ("imagemagick" ,imagemagick)
573 ("pkg-config" ,pkg-config)))
574 (home-page "https://github.com/libvips/nip2")
575 (synopsis "Spreadsheet-like GUI for libvips")
576 (description "This package provide a graphical user interface (GUI) for
577 the VIPS image processing library. It's a little like a spreadsheet: you
578 create a set of formula connecting your objects together, and on a change nip2
580 (license license:gpl2+)))
590 (url "https://github.com/vxl/vxl")
591 (commit (string-append "v" version))))
592 (file-name (git-file-name name version))
594 (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg"))
595 (modules '((guix build utils)))
596 ;; TODO: vxl includes an old version of dcmtk. It won't build with
600 (for-each delete-file-recursively
607 (substitute* "v3p/CMakeLists.txt"
608 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
611 (build-system cmake-build-system)
613 `(("libgeotiff" ,libgeotiff)
615 ("libjpeg" ,libjpeg-turbo)
618 (home-page "https://github.com/vxl/vxl/")
619 (synopsis "Collection of C++ libraries for computer vision")
620 (description "VXL (the Vision-something-Libraries) is a collection of C++
621 libraries designed for computer vision research and implementation.")
622 (license license:bsd-3)))
625 (package (inherit vxl)
632 (url "https://github.com/vxl/vxl")
633 (commit (string-append "v" version))))
634 (file-name (git-file-name name version))
636 (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz"))
637 (modules '((guix build utils)))
640 (for-each delete-file-recursively
646 (substitute* "v3p/CMakeLists.txt"
647 (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)")
652 ;; Needed for itk-snap
653 (list "-DVNL_CONFIG_LEGACY_METHODS=ON")))))
655 (define-public insight-toolkit
657 (name "insight-toolkit")
662 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
663 "releases/download/v" version "/InsightToolkit-"
666 (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi"))))
667 (build-system cmake-build-system)
669 `(#:tests? #f ; tests require network access and external data
672 "-DITK_USE_SYSTEM_LIBRARIES=ON"
673 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
674 "-DITK_BUILD_SHARED=ON"
675 ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES
676 ;; variable in the installed CMake files. This is necessary as other
677 ;; packages using insight-toolkit could not be configured otherwise.
678 "-DGTEST_ROOT=gtest")
680 (modify-phases %standard-phases
681 (add-after 'unpack 'do-not-tune
683 (substitute* "CMake/ITKSetStandardCompilerFlags.cmake"
684 (("-mute=native") ""))
692 ("libjpeg" ,libjpeg-turbo)
695 ("mesa" ,mesa-opencl)
702 `(("googletest" ,googletest)
703 ("pkg-config" ,pkg-config)))
704 (home-page "https://github.com/InsightSoftwareConsortium/ITK/")
705 (synopsis "Scientific image processing, segmentation and registration")
706 (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional
707 scientific image processing, segmentation, and registration. Segmentation is
708 the process of identifying and classifying data found in a digitally sampled
709 representation. Typically the sampled representation is an image acquired
710 from such medical instrumentation as CT or MRI scanners. Registration is the
711 task of aligning or developing correspondences between data. For example, in
712 the medical environment, a CT scan may be aligned with a MRI scan in order to
713 combine the information contained in both.")
714 (license license:asl2.0)))
716 (define-public insight-toolkit-4
717 (package (inherit insight-toolkit)
722 (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/"
723 "releases/download/v" version "/InsightToolkit-"
726 (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns"))))
728 `(#:tests? #f ; tests require network access and external data
730 '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap
732 "-DITK_USE_SYSTEM_LIBRARIES=ON"
733 "-DITK_USE_SYSTEM_GOOGLETEST=ON"
734 "-DITK_USE_SYSTEM_VXL=ON")))))
736 (define-public insight-toolkit-4.12
737 (package (inherit insight-toolkit-4)
742 (uri (string-append "mirror://sourceforge/itk/itk/4.12/"
743 "InsightToolkit-" version ".tar.xz"))
745 (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w"))))))
747 (define-public itk-snap
755 (url "https://git.code.sf.net/p/itk-snap/src")
756 (commit (string-append "v" version))))
757 (file-name (git-file-name name version))
759 (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q"))))
760 (build-system cmake-build-system)
763 (list "-DSNAP_VERSION_GIT_SHA1=release"
764 "-DSNAP_VERSION_GIT_BRANCH=release"
765 "-DSNAP_VERSION_GIT_TIMESTAMP=0"
766 "-DSNAP_PACKAGE_QT_PLUGINS=OFF"
767 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
769 (modify-phases %standard-phases
770 ;; During the installation phase all libraries provided by all
771 ;; dependencies will be copied to the lib directory. That's insane,
772 ;; so we disable this.
773 (add-after 'unpack 'do-not-copy-dependencies
775 (substitute* "CMakeLists.txt"
776 (("install_qt5_executable\
777 \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)")
780 (add-after 'unpack 'disable-gui-tests
782 ;; The GUI tests just time out.
783 (substitute* "CMakeLists.txt"
784 ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\
785 |RandomForest|RandomForestBailOut)")
788 (add-after 'unpack 'make-reproducible
790 (substitute* "CMakeLists.txt"
791 (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)")
792 "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")"))
794 (add-after 'unpack 'prepare-submodules
795 (lambda* (#:key inputs #:allow-other-keys)
796 (rmdir "Submodules/c3d")
797 (copy-recursively (assoc-ref inputs "c3d-src")
799 (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx"
800 "Submodules/c3d/adapters/ApplyMetric.cxx")
802 (rmdir "Submodules/greedy")
803 (symlink (assoc-ref inputs "greedy-src")
806 (add-after 'unpack 'fix-includes
808 (substitute* "GUI/Model/RegistrationModel.cxx"
809 (("<vnl_symmetric_eigensystem.h>")
810 "<vnl/algo/vnl_symmetric_eigensystem.h>"))
812 (add-before 'check 'prepare-tests
814 ;; Needed by at least one test.
815 (setenv "HOME" "/tmp")
817 (add-after 'install 'wrap-executable
818 (lambda* (#:key inputs outputs #:allow-other-keys)
819 (let ((out (assoc-ref outputs "out")))
820 (wrap-program (string-append out "/bin/itksnap")
821 `("QT_PLUGIN_PATH" ":" prefix
822 ,(map (lambda (label)
823 (string-append (assoc-ref inputs label)
825 '("qtbase" "qtdeclarative"))))
833 ("mesa" ,mesa-opencl)
834 ;; This package does not build with either insight-toolkit 5.0.0 and
835 ;; not with 4.13. It really needs to be 4.12.
836 ("itk" ,insight-toolkit-4.12)
839 ("qtdeclarative" ,qtdeclarative)
843 `(("googletest" ,googletest)
845 ("pkg-config" ,pkg-config)
847 ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3")
849 (version (git-version "0" revision commit)))
853 (url "https://github.com/pyushkevich/c3d")
855 (file-name (git-file-name "c3d" version))
858 "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3")))))
859 ;; We are using an arbitrary commit from 2017 because the latest
860 ;; version breaks the build...
862 ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3")
864 (version (git-version "0" revision commit)))
868 (url "https://github.com/pyushkevich/greedy")
870 (file-name (git-file-name "greedy" version))
873 "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab")))))))
874 (home-page "https://sourceforge.net/p/itk-snap/")
875 (synopsis "Medical image segmentation")
876 (description "ITK-SNAP is a tool for segmenting anatomical structures in
877 medical images. It provides an automatic active contour segmentation
878 pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a
879 full-featured UI aimed at clinical researchers.")
880 ;; This includes the submodules greedy and c3d.
881 (license license:gpl3+)))