Commit | Line | Data |
---|---|---|
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> |
657f8535 | 12 | ;;; Copyright © 2020 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 | |
112 | implementing large parts the DICOM standard. It includes software for | |
113 | examining, constructing and converting DICOM image files, handling offline | |
114 | media, sending and receiving images over a network connection, as well as | |
115 | demonstrative 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 | |
119 | licences 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, | |
166 | and libraries that make it possible run image processing tasks interactively | |
167 | in a command shell and to prototype using the shell's scripting language. It | |
168 | is built around a plug-in structure that makes it easy to add functionality | |
169 | without compromising the original code base and it makes use of a wide variety | |
170 | of 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 | |
233 | towards motion picture production, with an emphasis on visual effects and | |
234 | computer animation. It provides a straightforward and consistent user | |
235 | experience across all supporting applications while allowing for sophisticated | |
236 | back-end configuration options suitable for high-end production usage. | |
237 | ||
238 | OCIO is compatible with the @acronym{ACES, Academy Color Encoding | |
239 | Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting | |
240 | many 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, | |
324 | image processing and visualization. It supports a wide variety of | |
325 | visualization algorithms including: scalar, vector, tensor, texture, and | |
326 | volumetric methods; and advanced modeling techniques such as: implicit | |
327 | modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay | |
328 | triangulation. VTK has an extensive information visualization framework, has | |
329 | a suite of 3D interaction widgets, supports parallel processing, and | |
330 | integrates 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 | |
535 | real-time computer vision, including several hundred computer | |
536 | vision 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. |
595 | It's particularly good at processing large images, working with colour, | |
596 | scientific analysis, and general research & development. | |
597 | ||
598 | Compared to most image processing libraries VIPS needs little RAM and runs | |
599 | quickly, especially on machines with more than one CPU core. This is primarily | |
600 | due 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") | |
84479dcc | 606 | (version "2.9.2") |
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 | |
84479dcc | 613 | (base32 "14acph914a8lp6qqfmp319ggqjg3i3hmalmnpk3mp07m7vpv2p9q")))) |
657f8535 VM |
614 | (build-system cmake-build-system) |
615 | (arguments | |
616 | `(#:tests? #f)) ;there are no tests | |
617 | (native-inputs | |
618 | `(("pkg-config" ,pkg-config))) | |
619 | (inputs | |
620 | `(("curl" ,curl) | |
621 | ("fftw" ,fftw) | |
622 | ("graphicsmagick" ,graphicsmagick) | |
623 | ("libjpeg-turbo" ,libjpeg-turbo) | |
624 | ("libpng" ,libpng) | |
625 | ("libtiff" ,libtiff) | |
626 | ("libx11" ,libx11) | |
627 | ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI | |
628 | ("openexr" ,openexr) | |
629 | ("zlib" ,zlib))) | |
630 | (home-page "https://gmic.eu/") | |
631 | (synopsis "Full-featured framework for digital image processing") | |
632 | (description "G'MIC is a full-featured framework for digital image | |
633 | processing. It provides several user interfaces to convert / manipulate | |
634 | / filter / visualize generic image datasets, ranging from 1D scalar | |
635 | signals to 3D+t sequences of multi-spectral volumetric images, hence | |
636 | including 2D color images.") | |
637 | ;; Dual-licensed, either license applies. | |
638 | (license (list license:cecill license:cecill-c)))) | |
639 | ||
e506b5e9 L |
640 | (define-public nip2 |
641 | (package | |
642 | (name "nip2") | |
f2d3d742 | 643 | (version "8.7.1") |
e506b5e9 L |
644 | (source |
645 | (origin | |
646 | (method url-fetch) | |
647 | (uri (string-append "https://github.com/libvips/nip2/releases/download/v" | |
648 | version "/nip2-" version ".tar.gz" )) | |
649 | (sha256 | |
f2d3d742 | 650 | (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw")))) |
e506b5e9 L |
651 | (build-system gnu-build-system) |
652 | (arguments | |
653 | `(#:phases | |
654 | (modify-phases %standard-phases | |
f2d3d742 | 655 | ;; test_conv.ws keep failing so disabling for now. |
e506b5e9 L |
656 | (add-after 'unpack 'disable-test-conv |
657 | (lambda _ | |
658 | (delete-file "test/workspaces/test_conv.ws") | |
659 | #t)) | |
660 | (add-before 'check 'set-home | |
661 | (lambda _ | |
662 | (setenv "HOME" "/tmp") #t))))) | |
663 | (inputs | |
664 | `(("vips" ,vips) | |
665 | ("glib" ,glib) | |
666 | ("libtiff" ,libtiff) | |
667 | ("gtk+-2" ,gtk+-2) | |
668 | ("libxml2" ,libxml2) | |
669 | ("libexif" ,libexif) | |
4bd428a7 | 670 | ("libjpeg" ,libjpeg-turbo) ;required by vips.pc |
e506b5e9 L |
671 | ("librsvg" ,librsvg) |
672 | ("fftw" ,fftw) | |
673 | ("libgsf" ,libgsf) | |
674 | ("imagemagick" ,imagemagick) | |
675 | ("orc" ,orc) | |
676 | ("matio" ,matio) | |
677 | ("lcms" ,lcms) | |
678 | ("libwebp" ,libwebp) | |
679 | ("openexr" ,openexr) | |
680 | ("poppler" ,poppler) | |
681 | ("gsl" ,gsl))) | |
682 | (native-inputs | |
683 | `(("flex" ,flex) | |
684 | ("bison" ,bison) | |
685 | ("pkg-config" ,pkg-config))) | |
686 | (home-page "https://github.com/libvips/nip2") | |
687 | (synopsis "Spreadsheet-like GUI for libvips") | |
688 | (description "This package provide a graphical user interface (GUI) for | |
689 | the VIPS image processing library. It's a little like a spreadsheet: you | |
690 | create a set of formula connecting your objects together, and on a change nip2 | |
691 | recalculates.") | |
692 | (license license:gpl2+))) | |
02e1acfb RW |
693 | |
694 | (define-public vxl | |
695 | (package | |
696 | (name "vxl") | |
697 | (version "2.0.2") | |
698 | (source | |
699 | (origin | |
700 | (method git-fetch) | |
701 | (uri (git-reference | |
b0e7b699 | 702 | (url "https://github.com/vxl/vxl") |
02e1acfb RW |
703 | (commit (string-append "v" version)))) |
704 | (file-name (git-file-name name version)) | |
705 | (sha256 | |
706 | (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg")) | |
707 | (modules '((guix build utils))) | |
708 | ;; TODO: vxl includes an old version of dcmtk. It won't build with | |
709 | ;; version 3.6.x. | |
710 | (snippet | |
711 | '(begin | |
712 | (for-each delete-file-recursively | |
713 | '("v3p/bzlib/" | |
714 | "v3p/geotiff/" | |
715 | "v3p/jpeg/" | |
716 | "v3p/png/" | |
717 | "v3p/tiff/" | |
718 | "v3p/zlib/")) | |
719 | (substitute* "v3p/CMakeLists.txt" | |
720 | (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)") | |
721 | "")) | |
722 | #t)))) | |
723 | (build-system cmake-build-system) | |
724 | (inputs | |
725 | `(("libgeotiff" ,libgeotiff) | |
726 | ("libtiff" ,libtiff) | |
4bd428a7 | 727 | ("libjpeg" ,libjpeg-turbo) |
02e1acfb RW |
728 | ("libpng" ,libpng) |
729 | ("zlib" ,zlib))) | |
730 | (home-page "https://github.com/vxl/vxl/") | |
731 | (synopsis "Collection of C++ libraries for computer vision") | |
732 | (description "VXL (the Vision-something-Libraries) is a collection of C++ | |
733 | libraries designed for computer vision research and implementation.") | |
734 | (license license:bsd-3))) | |
4243af4e RW |
735 | |
736 | (define-public vxl-1 | |
737 | (package (inherit vxl) | |
738 | (name "vxl") | |
739 | (version "1.18.0") | |
740 | (source | |
741 | (origin | |
742 | (method git-fetch) | |
743 | (uri (git-reference | |
b0e7b699 | 744 | (url "https://github.com/vxl/vxl") |
4243af4e RW |
745 | (commit (string-append "v" version)))) |
746 | (file-name (git-file-name name version)) | |
747 | (sha256 | |
748 | (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz")) | |
749 | (modules '((guix build utils))) | |
750 | (snippet | |
751 | '(begin | |
752 | (for-each delete-file-recursively | |
753 | '("v3p/bzlib/" | |
754 | "v3p/geotiff/" | |
755 | "v3p/png/" | |
756 | "v3p/tiff/" | |
757 | "v3p/zlib/")) | |
758 | (substitute* "v3p/CMakeLists.txt" | |
759 | (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)") | |
760 | "")) | |
761 | #t)))) | |
762 | (arguments | |
763 | `(#:configure-flags | |
764 | ;; Needed for itk-snap | |
765 | (list "-DVNL_CONFIG_LEGACY_METHODS=ON"))))) | |
d7701e1b RW |
766 | |
767 | (define-public insight-toolkit | |
768 | (package | |
769 | (name "insight-toolkit") | |
770 | (version "5.0.0") | |
771 | (source | |
772 | (origin | |
773 | (method url-fetch) | |
774 | (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" | |
775 | "releases/download/v" version "/InsightToolkit-" | |
776 | version ".tar.xz")) | |
777 | (sha256 | |
778 | (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi")))) | |
779 | (build-system cmake-build-system) | |
780 | (arguments | |
781 | `(#:tests? #f ; tests require network access and external data | |
782 | #:configure-flags | |
783 | '("-DITK_USE_GPU=ON" | |
784 | "-DITK_USE_SYSTEM_LIBRARIES=ON" | |
785 | "-DITK_USE_SYSTEM_GOOGLETEST=ON" | |
786 | "-DITK_BUILD_SHARED=ON" | |
787 | ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES | |
788 | ;; variable in the installed CMake files. This is necessary as other | |
789 | ;; packages using insight-toolkit could not be configured otherwise. | |
790 | "-DGTEST_ROOT=gtest") | |
791 | #:phases | |
792 | (modify-phases %standard-phases | |
793 | (add-after 'unpack 'do-not-tune | |
794 | (lambda _ | |
795 | (substitute* "CMake/ITKSetStandardCompilerFlags.cmake" | |
796 | (("-mute=native") "")) | |
797 | #t))))) | |
798 | (inputs | |
799 | `(("eigen" ,eigen) | |
800 | ("expat" ,expat) | |
801 | ("fftw" ,fftw) | |
802 | ("fftwf" ,fftwf) | |
803 | ("hdf5" ,hdf5) | |
4bd428a7 | 804 | ("libjpeg" ,libjpeg-turbo) |
d7701e1b RW |
805 | ("libpng" ,libpng) |
806 | ("libtiff" ,libtiff) | |
807 | ("mesa" ,mesa-opencl) | |
808 | ("perl" ,perl) | |
809 | ("python" ,python) | |
810 | ("tbb" ,tbb) | |
811 | ("vxl" ,vxl-1) | |
812 | ("zlib" ,zlib))) | |
813 | (native-inputs | |
814 | `(("googletest" ,googletest) | |
815 | ("pkg-config" ,pkg-config))) | |
816 | (home-page "https://github.com/InsightSoftwareConsortium/ITK/") | |
817 | (synopsis "Scientific image processing, segmentation and registration") | |
818 | (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional | |
819 | scientific image processing, segmentation, and registration. Segmentation is | |
820 | the process of identifying and classifying data found in a digitally sampled | |
821 | representation. Typically the sampled representation is an image acquired | |
822 | from such medical instrumentation as CT or MRI scanners. Registration is the | |
823 | task of aligning or developing correspondences between data. For example, in | |
824 | the medical environment, a CT scan may be aligned with a MRI scan in order to | |
825 | combine the information contained in both.") | |
826 | (license license:asl2.0))) | |
8f4d457d RW |
827 | |
828 | (define-public insight-toolkit-4 | |
829 | (package (inherit insight-toolkit) | |
830 | (version "4.13.2") | |
831 | (source | |
832 | (origin | |
833 | (method url-fetch) | |
834 | (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" | |
835 | "releases/download/v" version "/InsightToolkit-" | |
836 | version ".tar.xz")) | |
837 | (sha256 | |
838 | (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns")))) | |
839 | (arguments | |
840 | `(#:tests? #f ; tests require network access and external data | |
841 | #:configure-flags | |
842 | '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap | |
843 | "-DITK_USE_GPU=ON" | |
844 | "-DITK_USE_SYSTEM_LIBRARIES=ON" | |
845 | "-DITK_USE_SYSTEM_GOOGLETEST=ON" | |
846 | "-DITK_USE_SYSTEM_VXL=ON"))))) | |
07f36b0c RW |
847 | |
848 | (define-public insight-toolkit-4.12 | |
849 | (package (inherit insight-toolkit-4) | |
850 | (version "4.12.2") | |
851 | (source | |
852 | (origin | |
853 | (method url-fetch) | |
854 | (uri (string-append "mirror://sourceforge/itk/itk/4.12/" | |
855 | "InsightToolkit-" version ".tar.xz")) | |
856 | (sha256 | |
857 | (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w")))))) | |
1c4e6aa9 RW |
858 | |
859 | (define-public itk-snap | |
860 | (package | |
861 | (name "itk-snap") | |
862 | (version "3.8.0") | |
863 | (source | |
864 | (origin | |
865 | (method git-fetch) | |
866 | (uri (git-reference | |
867 | (url "https://git.code.sf.net/p/itk-snap/src") | |
868 | (commit (string-append "v" version)))) | |
869 | (file-name (git-file-name name version)) | |
870 | (sha256 | |
871 | (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q")))) | |
872 | (build-system cmake-build-system) | |
873 | (arguments | |
874 | `(#:configure-flags | |
875 | (list "-DSNAP_VERSION_GIT_SHA1=release" | |
876 | "-DSNAP_VERSION_GIT_BRANCH=release" | |
877 | "-DSNAP_VERSION_GIT_TIMESTAMP=0" | |
878 | "-DSNAP_PACKAGE_QT_PLUGINS=OFF" | |
0fe041bd | 879 | "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") |
1c4e6aa9 RW |
880 | #:phases |
881 | (modify-phases %standard-phases | |
882 | ;; During the installation phase all libraries provided by all | |
883 | ;; dependencies will be copied to the lib directory. That's insane, | |
884 | ;; so we disable this. | |
885 | (add-after 'unpack 'do-not-copy-dependencies | |
886 | (lambda _ | |
887 | (substitute* "CMakeLists.txt" | |
888 | (("install_qt5_executable\ | |
889 | \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)") | |
890 | "")) | |
891 | #t)) | |
892 | (add-after 'unpack 'disable-gui-tests | |
893 | (lambda _ | |
894 | ;; The GUI tests just time out. | |
895 | (substitute* "CMakeLists.txt" | |
896 | ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\ | |
897 | |RandomForest|RandomForestBailOut)") | |
898 | "")) | |
899 | #t)) | |
900 | (add-after 'unpack 'make-reproducible | |
901 | (lambda _ | |
902 | (substitute* "CMakeLists.txt" | |
903 | (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)") | |
904 | "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")")) | |
905 | #t)) | |
906 | (add-after 'unpack 'prepare-submodules | |
907 | (lambda* (#:key inputs #:allow-other-keys) | |
908 | (rmdir "Submodules/c3d") | |
909 | (copy-recursively (assoc-ref inputs "c3d-src") | |
910 | "Submodules/c3d") | |
911 | (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx" | |
912 | "Submodules/c3d/adapters/ApplyMetric.cxx") | |
913 | (("vcl_") "std::")) | |
914 | (rmdir "Submodules/greedy") | |
915 | (symlink (assoc-ref inputs "greedy-src") | |
916 | "Submodules/greedy") | |
917 | #t)) | |
918 | (add-after 'unpack 'fix-includes | |
919 | (lambda _ | |
920 | (substitute* "GUI/Model/RegistrationModel.cxx" | |
921 | (("<vnl_symmetric_eigensystem.h>") | |
922 | "<vnl/algo/vnl_symmetric_eigensystem.h>")) | |
923 | #t)) | |
924 | (add-before 'check 'prepare-tests | |
925 | (lambda _ | |
926 | ;; Needed by at least one test. | |
927 | (setenv "HOME" "/tmp") | |
928 | #t)) | |
929 | (add-after 'install 'wrap-executable | |
930 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
931 | (let ((out (assoc-ref outputs "out"))) | |
932 | (wrap-program (string-append out "/bin/itksnap") | |
933 | `("QT_PLUGIN_PATH" ":" prefix | |
934 | ,(map (lambda (label) | |
935 | (string-append (assoc-ref inputs label) | |
936 | "/lib/qt5/plugins")) | |
937 | '("qtbase" "qtdeclarative")))) | |
938 | #t)))))) | |
939 | (inputs | |
940 | `(("curl" ,curl) | |
941 | ("fftw" ,fftw) | |
942 | ("fftwf" ,fftwf) | |
943 | ("glu" ,glu) | |
944 | ("hdf5" ,hdf5) | |
945 | ("mesa" ,mesa-opencl) | |
946 | ;; This package does not build with either insight-toolkit 5.0.0 and | |
947 | ;; not with 4.13. It really needs to be 4.12. | |
948 | ("itk" ,insight-toolkit-4.12) | |
949 | ("vtk" ,vtk-6) | |
950 | ("qtbase" ,qtbase) | |
951 | ("qtdeclarative" ,qtdeclarative) | |
1c4e6aa9 RW |
952 | ("vxl" ,vxl-1) |
953 | ("zlib" ,zlib))) | |
954 | (native-inputs | |
955 | `(("googletest" ,googletest) | |
957e0be3 | 956 | ("qttools" ,qttools) |
1c4e6aa9 RW |
957 | ("pkg-config" ,pkg-config) |
958 | ("c3d-src" | |
959 | ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3") | |
960 | (revision "1") | |
961 | (version (git-version "0" revision commit))) | |
962 | (origin | |
963 | (method git-fetch) | |
964 | (uri (git-reference | |
b0e7b699 | 965 | (url "https://github.com/pyushkevich/c3d") |
1c4e6aa9 RW |
966 | (commit commit))) |
967 | (file-name (git-file-name "c3d" version)) | |
968 | (sha256 | |
969 | (base32 | |
970 | "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3"))))) | |
971 | ;; We are using an arbitrary commit from 2017 because the latest | |
972 | ;; version breaks the build... | |
973 | ("greedy-src" | |
974 | ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3") | |
975 | (revision "1") | |
976 | (version (git-version "0" revision commit))) | |
977 | (origin | |
978 | (method git-fetch) | |
979 | (uri (git-reference | |
b0e7b699 | 980 | (url "https://github.com/pyushkevich/greedy") |
1c4e6aa9 RW |
981 | (commit commit))) |
982 | (file-name (git-file-name "greedy" version)) | |
983 | (sha256 | |
984 | (base32 | |
985 | "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab"))))))) | |
986 | (home-page "https://sourceforge.net/p/itk-snap/") | |
987 | (synopsis "Medical image segmentation") | |
988 | (description "ITK-SNAP is a tool for segmenting anatomical structures in | |
989 | medical images. It provides an automatic active contour segmentation | |
990 | pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a | |
991 | full-featured UI aimed at clinical researchers.") | |
992 | ;; This includes the submodules greedy and c3d. | |
993 | (license license:gpl3+))) | |
85c4f486 PN |
994 | |
995 | (define-public metapixel | |
996 | ;; Follow stable branch. | |
997 | (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f")) | |
998 | (package | |
999 | (name "metapixel") | |
1000 | (version (git-version "1.0.2" "1" commit)) | |
1001 | (source | |
1002 | (origin | |
1003 | (method git-fetch) | |
1004 | (uri (git-reference | |
1005 | (url "https://github.com/schani/metapixel") | |
1006 | (commit commit) | |
1007 | ;; TODO: Package rwimg and lispreader? | |
1008 | (recursive? #t))) | |
1009 | (file-name (git-file-name name version)) | |
1010 | (sha256 | |
1011 | (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309")))) | |
1012 | (build-system gnu-build-system) | |
1013 | (inputs | |
1014 | `(("giflib" ,giflib) | |
1015 | ("libjpeg" ,libjpeg-turbo) | |
1016 | ("libpng" ,libpng) | |
1017 | ("perl" ,perl))) | |
1018 | (native-inputs | |
1019 | `(("pkg-config" ,pkg-config) | |
1020 | ("docbook-xml" ,docbook-xml) | |
1021 | ("docbook-xsl" ,docbook-xsl) | |
1022 | ("xsltproc" ,libxslt))) | |
1023 | (arguments | |
1024 | `(#:tests? #f ; No tests. | |
1025 | #:make-flags (list | |
1026 | (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
1027 | (string-append "MANPAGE_XSL=" | |
1028 | (assoc-ref %build-inputs "docbook-xsl") | |
1029 | "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl")) | |
1030 | #:phases | |
1031 | (modify-phases %standard-phases | |
1032 | (delete 'configure) | |
1033 | (add-before 'install 'make-local-docbook-xml | |
1034 | (lambda* (#:key inputs #:allow-other-keys) | |
1035 | (substitute* "metapixel.xml" | |
1036 | (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd") | |
1037 | (string-append (assoc-ref inputs "docbook-xml") | |
1038 | "/xml/dtd/docbook/docbookx.dtd"))) | |
1039 | #t)) | |
1040 | (add-before 'install 'fix-directory-creation | |
1041 | (lambda* (#:key outputs #:allow-other-keys) | |
1042 | (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1")) | |
1043 | #t))))) | |
1044 | (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/") | |
1045 | (synopsis "Photomosaics generator") | |
1046 | (description "Metapixel is a program for generating photomosaics. It can | |
1047 | generate classical photomosaics, in which the source image is viewed as a | |
1048 | matrix of equally sized rectangles for each of which a matching image is | |
1b8be80e | 1049 | substituted, as well as collage-style photomosaics, in which rectangular parts |
85c4f486 PN |
1050 | of the source image at arbitrary positions (i.e. not aligned to a matrix) are |
1051 | substituted by matching images.") | |
1052 | (license license:gpl2)))) | |
a76e9d13 BT |
1053 | |
1054 | (define-public scantailor-advanced | |
1055 | (let ((commit "3d1e74e6ace413733511086934a66f4e3f7a6027")) | |
1056 | (package | |
1057 | (name "scantailor-advanced") | |
1058 | (version (string-append "1.0.16-" (string-take commit 7))) | |
1059 | (source | |
1060 | (origin | |
1061 | (method git-fetch) | |
1062 | (uri (git-reference | |
1063 | (url "https://github.com/4lex4/scantailor-advanced") | |
1064 | (commit commit))) | |
1065 | (file-name (git-file-name name version)) | |
1066 | (sha256 | |
1067 | (base32 | |
1068 | "0kixwjb2x457dq7927hkh34c803p7yh1pmn6n61rk9shqrcg492h")))) | |
1069 | (build-system qt-build-system) | |
1070 | (native-inputs | |
1071 | `(("qttools" ,qttools))) | |
1072 | (inputs | |
1073 | `(("boost" ,boost) | |
1074 | ("libjpeg" ,libjpeg-turbo) | |
1075 | ("libpng" ,libpng) | |
1076 | ("libtiff" ,libtiff) | |
1077 | ("qtbase" ,qtbase) | |
1078 | ("qtsvg" ,qtsvg) | |
1079 | ("zlib" ,zlib))) | |
1080 | (arguments | |
1081 | `(#:phases | |
1082 | (modify-phases %standard-phases | |
1083 | ;; Some tests require a display and fail with offscreen mode. | |
1084 | (add-after 'unpack 'disable-failing-tests | |
1085 | (lambda _ | |
1086 | (setenv "ARGS" "--exclude-regex \"imageproc_.*\"") | |
1087 | #t))))) | |
1088 | (home-page "https://github.com/4lex4/scantailor-advanced") | |
1089 | (synopsis "Clean up scanned pages") | |
1090 | (description "Scan Tailor is an interactive post-processing tool for | |
1091 | scanned pages. It performs operations such as page splitting, deskewing, | |
1092 | adding/removing borders, and others. You give it raw scans, and you get pages | |
1093 | ready to be printed or assembled into a PDF or DJVU file. Scanning, optical | |
1094 | character recognition, and assembling multi-page documents are out of scope of | |
1095 | this project. | |
1096 | ||
1097 | Scan Tailer Advanced is a fork of Scan Tailer that merges Scan Tailor Featured | |
1098 | and Scan Tailor Enhanced versions as well as including many more bug fixes.") | |
1099 | (license license:gpl3+)))) | |
58a5746e OM |
1100 | |
1101 | (define-public stiff | |
1102 | (package | |
1103 | (name "stiff") | |
1104 | (version "2.4.0") | |
1105 | (source | |
1106 | (origin | |
1107 | (method url-fetch) | |
1108 | (uri (string-append "https://www.astromatic.net/download/stiff/stiff-" | |
1109 | version ".tar.gz")) | |
1110 | (sha256 | |
1111 | (base32 "14m92dskzw7bwsr64ha4p0mj3ndv13gwcbfic3qxrs3zq5353s7l")))) | |
1112 | (build-system gnu-build-system) | |
1113 | (inputs | |
1114 | `(("libtiff" ,libtiff) | |
1115 | ("zlib" ,zlib) | |
1116 | ("libjpeg-turbo" ,libjpeg-turbo))) | |
1117 | (home-page "https://www.astromatic.net/software/stiff") | |
1118 | (synopsis "Convert scientific FITS images to TIFF format") | |
1119 | (description | |
1120 | "STIFF is a program that converts scientific @acronym{FITS, Flexible Image | |
1121 | Transport System} images to the more popular TIFF format for illustration | |
1122 | purposes.") | |
1123 | (license license:gpl3+))) |