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