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> | |
882d579d | 7 | ;;; Copyright © 2018, 2019 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> |
6949f45c | 10 | ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il> |
504c285d JD |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages image-processing) | |
28 | #:use-module ((guix licenses) #:prefix license:) | |
29 | #:use-module (guix packages) | |
30 | #:use-module (guix utils) | |
31 | #:use-module (guix download) | |
6c56e9c4 | 32 | #:use-module (guix git-download) |
cdb2a211 | 33 | #:use-module (guix build-system cmake) |
504c285d JD |
34 | #:use-module (guix build-system gnu) |
35 | #:use-module (gnu packages) | |
cdb2a211 | 36 | #:use-module (gnu packages algebra) |
e506b5e9 | 37 | #:use-module (gnu packages bison) |
cdb2a211 | 38 | #:use-module (gnu packages boost) |
d7701e1b | 39 | #:use-module (gnu packages check) |
504c285d | 40 | #:use-module (gnu packages compression) |
1c4e6aa9 | 41 | #:use-module (gnu packages curl) |
504c285d | 42 | #:use-module (gnu packages documentation) |
e506b5e9 | 43 | #:use-module (gnu packages flex) |
fb226b43 | 44 | #:use-module (gnu packages fontutils) |
02e1acfb | 45 | #:use-module (gnu packages geo) |
5bbd6931 | 46 | #:use-module (gnu packages ghostscript) |
fb226b43 | 47 | #:use-module (gnu packages gl) |
5bbd6931 | 48 | #:use-module (gnu packages glib) |
cdb2a211 JD |
49 | #:use-module (gnu packages gnome) |
50 | #:use-module (gnu packages graphics) | |
51 | #:use-module (gnu packages graphviz) | |
5bbd6931 | 52 | #:use-module (gnu packages gstreamer) |
62834314 | 53 | #:use-module (gnu packages gtk) |
504c285d | 54 | #:use-module (gnu packages image) |
5bbd6931 | 55 | #:use-module (gnu packages imagemagick) |
cdb2a211 | 56 | #:use-module (gnu packages maths) |
5bbd6931 | 57 | #:use-module (gnu packages pdf) |
cdb2a211 | 58 | #:use-module (gnu packages perl) |
62834314 | 59 | #:use-module (gnu packages photo) |
cdb2a211 | 60 | #:use-module (gnu packages pkg-config) |
62834314 | 61 | #:use-module (gnu packages protobuf) |
cdb2a211 | 62 | #:use-module (gnu packages python) |
44d10b1f | 63 | #:use-module (gnu packages python-xyz) |
1c4e6aa9 | 64 | #:use-module (gnu packages qt) |
fb226b43 | 65 | #:use-module (gnu packages serialization) |
d7701e1b | 66 | #:use-module (gnu packages tbb) |
8486a80d | 67 | #:use-module (gnu packages tls) |
62834314 | 68 | #:use-module (gnu packages video) |
fb226b43 | 69 | #:use-module (gnu packages xiph) |
cdb2a211 | 70 | #:use-module (gnu packages xml) |
ebe0271a | 71 | #:use-module (gnu packages xorg) |
18696f7a RW |
72 | #:use-module (ice-9 match) |
73 | #:use-module (srfi srfi-1)) | |
504c285d | 74 | |
504c285d JD |
75 | (define-public dcmtk |
76 | (package | |
77 | (name "dcmtk") | |
6a04c8ff | 78 | (version "3.6.5") |
882d579d TGR |
79 | (source |
80 | (origin | |
81 | (method url-fetch) | |
82 | (uri | |
83 | (string-append "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/" | |
84 | "dcmtk" (string-join (string-split version #\.) "") | |
85 | "/dcmtk-" version ".tar.gz")) | |
86 | (sha256 | |
6a04c8ff | 87 | (base32 "1fdyz5wwjp4grys61mxb2ia9fi6i3ax6s43l16xnv291bxk7hld0")))) |
882d579d | 88 | (build-system cmake-build-system) |
504c285d | 89 | (inputs |
8486a80d TGR |
90 | `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“. |
91 | ;; ("icu4c" ,icu4c) | |
92 | ("libjpeg" ,libjpeg) | |
504c285d | 93 | ("libpng" ,libpng) |
882d579d | 94 | ("libtiff" ,libtiff) |
8486a80d TGR |
95 | ("libxml2" ,libxml2) |
96 | ("openssl" ,openssl) | |
504c285d JD |
97 | ("zlib" ,zlib))) |
98 | (native-inputs | |
882d579d | 99 | `(("doxygen" ,doxygen))) ; for HTML documentation |
d2ad4f2e | 100 | (home-page "https://dcmtk.org") |
504c285d JD |
101 | (synopsis "Libraries and programs implementing parts of the DICOM standard") |
102 | (description "DCMTK is a collection of libraries and applications | |
103 | implementing large parts the DICOM standard. It includes software for | |
104 | examining, constructing and converting DICOM image files, handling offline | |
105 | media, sending and receiving images over a network connection, as well as | |
106 | demonstrative image storage and worklist servers.") | |
107 | (license (license:fsf-free | |
108 | "file://COPYRIGHT" | |
109 | "A union of the Apache 2.0 licence and various non-copyleft | |
110 | licences similar to the Modified BSD licence.")))) | |
cdb2a211 JD |
111 | |
112 | (define-public mia | |
113 | (package | |
114 | (name "mia") | |
11861d2b | 115 | (version "2.4.6") |
cdb2a211 JD |
116 | (source (origin |
117 | (method url-fetch) | |
118 | (uri (string-append "mirror://sourceforge/mia/mia/" | |
119 | (version-major+minor version) | |
120 | "/mia-" version ".tar.xz")) | |
121 | (sha256 | |
122 | (base32 | |
11861d2b | 123 | "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb")))) |
cdb2a211 JD |
124 | (build-system cmake-build-system) |
125 | (arguments | |
126 | `(#:configure-flags | |
127 | (list "-DMIA_CREATE_NIPYPE_INTERFACES=0" | |
cdb2a211 JD |
128 | "-DCMAKE_CXX_FLAGS=-fpermissive"))) |
129 | (inputs | |
130 | `(("boost" ,boost) | |
131 | ("dcmtk" ,dcmtk) | |
132 | ("doxygen" ,doxygen) | |
133 | ("eigen" ,eigen) | |
134 | ("fftw" ,fftw) | |
135 | ("fftwf" ,fftwf) | |
136 | ("gsl" ,gsl) | |
137 | ("gts" ,gts) | |
138 | ("hdf5" ,hdf5) | |
139 | ("itpp" ,itpp) | |
140 | ("libjpeg" ,libjpeg) | |
141 | ("libpng" ,libpng) | |
142 | ("libtiff" ,libtiff) | |
143 | ("libxml" ,libxml2) | |
144 | ("libxml++" ,libxml++) | |
145 | ("maxflow" ,maxflow) | |
146 | ("niftilib" ,niftilib) | |
147 | ("nlopt" ,nlopt) | |
148 | ("openexr" ,openexr) | |
149 | ("python-lxml" ,python2-lxml) | |
150 | ("vtk" ,vtk))) | |
151 | (native-inputs | |
152 | `(("pkg-config" ,pkg-config) | |
153 | ("python" ,python-2))) | |
154 | (home-page "http://mia.sourceforge.net") | |
155 | (synopsis "Toolkit for gray scale medical image analysis") | |
156 | (description "MIA provides a combination of command line tools, plug-ins, | |
157 | and libraries that make it possible run image processing tasks interactively | |
158 | in a command shell and to prototype using the shell's scripting language. It | |
159 | is built around a plug-in structure that makes it easy to add functionality | |
160 | without compromising the original code base and it makes use of a wide variety | |
161 | of external libraries that provide additional functionality.") | |
162 | (license license:gpl3+))) | |
fb226b43 JD |
163 | |
164 | (define-public vtk | |
165 | (package | |
166 | (name "vtk") | |
8f8bc406 | 167 | (version "8.2.0") |
fb226b43 JD |
168 | (source (origin |
169 | (method url-fetch) | |
f1d4f264 | 170 | (uri (string-append "https://vtk.org/files/release/" |
fb226b43 JD |
171 | (version-major+minor version) |
172 | "/VTK-" version ".tar.gz")) | |
173 | (sha256 | |
174 | (base32 | |
8f8bc406 | 175 | "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl")))) |
fb226b43 JD |
176 | (build-system cmake-build-system) |
177 | (arguments | |
178 | '(#:build-type "Release" ;Build without '-g' to save space. | |
179 | ;; -DVTK_USE_SYSTEM_NETCDF:BOOL=TRUE requires netcdf_cxx | |
180 | #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE" | |
181 | "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE" | |
182 | "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE" | |
183 | "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE" | |
184 | "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE" | |
185 | "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE" | |
186 | "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE" | |
187 | "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE" | |
188 | "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE" | |
189 | "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE") | |
190 | #:tests? #f)) ;XXX: no "test" target | |
191 | (inputs | |
192 | `(("libXt" ,libxt) | |
6a6db57f | 193 | ("xorgproto" ,xorgproto) |
fb226b43 JD |
194 | ("libX11" ,libx11) |
195 | ("libxml2" ,libxml2) | |
196 | ("mesa" ,mesa) | |
197 | ("glu" ,glu) | |
198 | ("expat" ,expat) | |
199 | ("freetype" ,freetype) | |
200 | ("hdf5" ,hdf5) | |
201 | ("jpeg" ,libjpeg) | |
202 | ("jsoncpp" ,jsoncpp) | |
203 | ("libogg" ,libogg) | |
204 | ("libtheora" ,libtheora) | |
205 | ("png" ,libpng) | |
206 | ("tiff" ,libtiff) | |
207 | ("zlib" ,zlib))) | |
f1d4f264 | 208 | (home-page "https://vtk.org/") |
fb226b43 JD |
209 | (synopsis "Libraries for 3D computer graphics") |
210 | (description | |
211 | "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics, | |
212 | image processing and visualization. It supports a wide variety of | |
213 | visualization algorithms including: scalar, vector, tensor, texture, and | |
214 | volumetric methods; and advanced modeling techniques such as: implicit | |
215 | modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay | |
216 | triangulation. VTK has an extensive information visualization framework, has | |
217 | a suite of 3D interaction widgets, supports parallel processing, and | |
218 | integrates with various databases on GUI toolkits such as Qt and Tk.") | |
219 | (license license:bsd-3))) | |
62834314 | 220 | |
18696f7a RW |
221 | ;; itksnap needs an older variant of VTK. |
222 | (define-public vtk-6 | |
223 | (package (inherit vtk) | |
224 | (version "6.3.0") | |
225 | (source (origin | |
226 | (method url-fetch) | |
227 | (uri (string-append "https://vtk.org/files/release/" | |
228 | (version-major+minor version) | |
229 | "/VTK-" version ".tar.gz")) | |
230 | (sha256 | |
231 | (base32 | |
232 | "0pla1r5mvkgl4sl213gfdhzrypdgai0h3z5mfgm6p9jz9hsr794j")))) | |
233 | (inputs | |
234 | `(("jsoncpp" ,jsoncpp-for-tensorflow) | |
235 | ,@(alist-delete "jsoncpp" (package-inputs vtk)))))) | |
236 | ||
62834314 BH |
237 | (define-public opencv |
238 | (package | |
239 | (name "opencv") | |
63856931 | 240 | (version "3.4.3") |
62834314 | 241 | (source (origin |
6c56e9c4 EF |
242 | (method git-fetch) |
243 | (uri (git-reference | |
244 | (url "https://github.com/opencv/opencv") | |
245 | (commit version))) | |
246 | (file-name (git-file-name name version)) | |
62834314 BH |
247 | (sha256 |
248 | (base32 | |
6c56e9c4 | 249 | "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3")) |
62834314 BH |
250 | (modules '((guix build utils))) |
251 | (snippet | |
252 | '(begin | |
253 | ;; Remove external libraries. We have all available in Guix: | |
254 | (delete-file-recursively "3rdparty") | |
255 | ||
256 | ;; Milky icon set is non-free: | |
257 | (delete-file-recursively "modules/highgui/src/files_Qt/Milky") | |
258 | ||
259 | ;; Some jars found: | |
260 | (for-each delete-file | |
261 | '("modules/java/test/pure_test/lib/junit-4.11.jar" | |
6c56e9c4 EF |
262 | "samples/java/sbt/sbt/sbt-launch.jar")) |
263 | #t)))) | |
62834314 BH |
264 | (build-system cmake-build-system) |
265 | (arguments | |
266 | `(#:configure-flags | |
267 | (list "-DWITH_IPP=OFF" | |
268 | "-DWITH_ITT=OFF" | |
6949f45c | 269 | "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64 |
fdeb2def | 270 | "-DENABLE_PRECOMPILED_HEADERS=OFF" |
62834314 BH |
271 | |
272 | ;; CPU-Features: | |
273 | ;; See cmake/OpenCVCompilerOptimizations.cmake | |
274 | ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations | |
275 | ;; BASELINE is the minimum optimization all CPUs must support | |
276 | ;; | |
ebe0271a EF |
277 | ;; DISPATCH is the list of optional dispatches. |
278 | "-DCPU_BASELINE=SSE2" | |
62834314 | 279 | |
ebe0271a EF |
280 | ,@(match (%current-system) |
281 | ("x86_64-linux" | |
282 | '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX" | |
283 | "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2")) | |
284 | ("armhf-linux" | |
285 | '("-DCPU_BASELINE_DISABLE=NEON")) ; causes build failures | |
286 | ("aarch64-linux" | |
287 | '("-DCPU_BASELINE=NEON" | |
288 | "-DCPU_DISPATCH=NEON;VFPV3;FP16")) | |
289 | (_ '())) | |
62834314 BH |
290 | |
291 | "-DBUILD_PERF_TESTS=OFF" | |
6949f45c | 292 | "-DBUILD_TESTS=ON" |
62834314 | 293 | |
b5baf952 | 294 | (string-append "-DOPENCV_EXTRA_MODULES_PATH=" (getcwd) |
6c56e9c4 | 295 | "/opencv-contrib/modules") |
62834314 BH |
296 | |
297 | ;;Define test data: | |
b5baf952 | 298 | (string-append "-DOPENCV_TEST_DATA_PATH=" (getcwd) |
6c56e9c4 | 299 | "/opencv-extra/testdata") |
62834314 BH |
300 | |
301 | ;; Is ON by default and would try to rebuild 3rd-party protobuf, | |
302 | ;; which we had removed, which would lead to an error: | |
303 | "-DBUILD_PROTOBUF=OFF" | |
304 | ||
305 | ;; Rebuild protobuf files, because we have a slightly different | |
306 | ;; version than the included one. If we would not update, we | |
307 | ;; would get a compile error later: | |
308 | "-DPROTOBUF_UPDATE_FILES=ON" | |
309 | ||
310 | ;; xfeatures2d disabled, because it downloads extra binaries from | |
311 | ;; https://github.com/opencv/opencv_3rdparty | |
312 | ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake | |
313 | ;; Cmp this bug entry: | |
314 | ;; https://github.com/opencv/opencv_contrib/issues/1131 | |
315 | "-DBUILD_opencv_xfeatures2d=OFF") | |
316 | #:phases | |
317 | (modify-phases %standard-phases | |
318 | (add-after 'unpack 'disable-broken-tests | |
319 | (lambda _ | |
320 | ;; These tests fails with: | |
321 | ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent config | |
322 | ;; I think we have no OpenGL support with the Xvfb. | |
323 | (substitute* '("modules/viz/test/test_tutorial3.cpp" | |
324 | "modules/viz/test/test_main.cpp" | |
325 | "modules/viz/test/tests_simple.cpp" | |
326 | "modules/viz/test/test_viz3d.cpp") | |
327 | (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post) | |
328 | (string-append pre "DISABLED_" post))) | |
329 | ||
330 | ;; This one fails with "unknown file: Failure" | |
331 | ;; But I couldn't figure out which file was missing: | |
6c56e9c4 | 332 | (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp" |
62834314 BH |
333 | (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)" |
334 | all pre post) | |
335 | (string-append pre "DISABLED_" post))) | |
336 | ||
337 | ;; Failure reason: Bad accuracy | |
338 | ;; Incorrect count of accurate poses [2nd case]: 90.000000 / 94.000000 | |
6c56e9c4 | 339 | (substitute* "../opencv-contrib/modules/rgbd/test/test_odometry.cpp" |
62834314 BH |
340 | (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post) |
341 | (string-append pre "DISABLED_" post))) | |
342 | #t)) | |
343 | ||
62834314 BH |
344 | (add-after 'unpack 'unpack-submodule-sources |
345 | (lambda* (#:key inputs #:allow-other-keys) | |
346 | (mkdir "../opencv-extra") | |
347 | (mkdir "../opencv-contrib") | |
6c56e9c4 EF |
348 | (copy-recursively (assoc-ref inputs "opencv-extra") |
349 | "../opencv-extra") | |
350 | (invoke "tar" "xvf" | |
351 | (assoc-ref inputs "opencv-contrib") | |
352 | "--strip-components=1" | |
353 | "-C" "../opencv-contrib"))) | |
62834314 BH |
354 | |
355 | (add-after 'set-paths 'add-ilmbase-include-path | |
356 | (lambda* (#:key inputs #:allow-other-keys) | |
357 | ;; OpenEXR propagates ilmbase, but its include files do not appear | |
358 | ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to | |
359 | ;; the CPATH to satisfy the dependency on "ImathVec.h". | |
360 | (setenv "CPATH" | |
361 | (string-append (assoc-ref inputs "ilmbase") | |
362 | "/include/OpenEXR" | |
363 | ":" (or (getenv "CPATH") ""))) | |
364 | #t)) | |
365 | (add-before 'check 'start-xserver | |
366 | (lambda* (#:key inputs #:allow-other-keys) | |
367 | (let ((xorg-server (assoc-ref inputs "xorg-server")) | |
368 | (disp ":1")) | |
369 | (setenv "HOME" (getcwd)) | |
370 | (setenv "DISPLAY" disp) | |
371 | ;; There must be a running X server and make check doesn't start one. | |
372 | ;; Therefore we must do it. | |
373 | (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp))))))))) | |
374 | (native-inputs | |
6c56e9c4 | 375 | `(("pkg-config" ,pkg-config) |
ff337525 | 376 | ("xorg-server" ,xorg-server-for-tests) ; For running the tests |
62834314 BH |
377 | ("opencv-extra" |
378 | ,(origin | |
6c56e9c4 EF |
379 | (method git-fetch) |
380 | (uri (git-reference | |
381 | (url "https://github.com/opencv/opencv_extra") | |
382 | (commit version))) | |
383 | (file-name (git-file-name "opencv_extra" version)) | |
62834314 | 384 | (sha256 |
6c56e9c4 | 385 | (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp")))) |
62834314 BH |
386 | ("opencv-contrib" |
387 | ,(origin | |
6c56e9c4 EF |
388 | (method git-fetch) |
389 | (uri (git-reference | |
390 | (url "https://github.com/opencv/opencv_contrib") | |
391 | (commit version))) | |
392 | (file-name (git-file-name "opencv_contrib" version)) | |
8e21fa0b | 393 | (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch")) |
62834314 | 394 | (sha256 |
6c56e9c4 | 395 | (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2")))))) |
62834314 BH |
396 | (inputs `(("libjpeg" ,libjpeg) |
397 | ("libpng" ,libpng) | |
398 | ("jasper" ,jasper) | |
399 | ;; ffmpeg 4.0 causes core dumps in tests. | |
400 | ("ffmpeg" ,ffmpeg-3.4) | |
401 | ("libtiff" ,libtiff) | |
402 | ("hdf5" ,hdf5) | |
403 | ("libgphoto2" ,libgphoto2) | |
404 | ("libwebp" ,libwebp) | |
405 | ("zlib" ,zlib) | |
406 | ("gtkglext" ,gtkglext) | |
407 | ("openexr" ,openexr) | |
408 | ("ilmbase" ,ilmbase) | |
409 | ("gtk+" ,gtk+-2) | |
410 | ("python-numpy" ,python-numpy) | |
411 | ("protobuf" ,protobuf) | |
412 | ("vtk" ,vtk) | |
413 | ("python" ,python))) | |
5834e4b7 BH |
414 | ;; These three CVEs are not a problem of OpenCV, see: |
415 | ;; https://github.com/opencv/opencv/issues/10998 | |
416 | (properties '((lint-hidden-cve . ("CVE-2018-7712" | |
417 | "CVE-2018-7713" | |
418 | "CVE-2018-7714")))) | |
62834314 BH |
419 | (synopsis "Computer vision library") |
420 | (description "OpenCV is a library aimed at | |
421 | real-time computer vision, including several hundred computer | |
422 | vision algorithms. It can be used to do things like: | |
423 | ||
424 | @itemize | |
425 | @item image and video input and output | |
426 | @item image and video processing | |
427 | @item displaying | |
428 | @item feature recognition | |
429 | @item segmentation | |
430 | @item facial recognition | |
431 | @item stereo vision | |
432 | @item structure from motion | |
433 | @item augmented reality | |
434 | @item machine learning | |
435 | @end itemize\n") | |
436 | (home-page "https://opencv.org/") | |
437 | (license license:bsd-3))) | |
5bbd6931 L |
438 | |
439 | (define-public vips | |
440 | (package | |
441 | (name "vips") | |
7e52321f TGR |
442 | (version "8.7.4") |
443 | (source | |
444 | (origin | |
445 | (method url-fetch) | |
446 | (uri (string-append | |
447 | "https://github.com/libvips/libvips/releases/download/v" | |
448 | version "/vips-" version ".tar.gz")) | |
449 | (sha256 | |
450 | (base32 "01gjhcrl6zj7mcj1al717v5jsniahplqhz1xkfh2j78vyfl1hxff")))) | |
5bbd6931 L |
451 | (build-system gnu-build-system) |
452 | (native-inputs | |
453 | `(("pkg-config" ,pkg-config) | |
454 | ("gobject-introspection" ,gobject-introspection))) | |
455 | (inputs | |
456 | `(("glib" ,glib) | |
457 | ("libjpeg" ,libjpeg) | |
458 | ("libpng" ,libpng) | |
459 | ("librsvg" ,librsvg) | |
460 | ("libtiff" ,libtiff) | |
461 | ("libexif" ,libexif) | |
462 | ("giflib" ,giflib) | |
463 | ("libgsf" ,libgsf) | |
464 | ("fftw" ,fftw) | |
465 | ("poppler" ,poppler) | |
466 | ("pango" ,pango) | |
467 | ("lcms" ,lcms) | |
468 | ("matio" ,matio) | |
469 | ("libwebp" ,libwebp) | |
470 | ("niftilib" ,niftilib) | |
471 | ("openexr" ,openexr) | |
472 | ("orc" ,orc) | |
473 | ("imagemagick" ,imagemagick) | |
474 | ("libxml2" ,libxml2) | |
475 | ("expat" ,expat) | |
476 | ("hdf5" ,hdf5))) | |
477 | (home-page "https://libvips.github.io/libvips/") | |
85e2f212 | 478 | (synopsis "Multithreaded image processing system with low memory needs") |
37c1cf89 | 479 | (description |
85e2f212 TGR |
480 | "VIPS is a demand-driven, horizontally threaded image processing library. |
481 | It's particularly good at processing large images, working with colour, | |
482 | scientific analysis, and general research & development. | |
483 | ||
484 | Compared to most image processing libraries VIPS needs little RAM and runs | |
485 | quickly, especially on machines with more than one CPU core. This is primarily | |
486 | due to its architecture which automatically parallelises the image workflows.") | |
5bbd6931 | 487 | (license license:lgpl2.1+))) |
e506b5e9 L |
488 | |
489 | (define-public nip2 | |
490 | (package | |
491 | (name "nip2") | |
f2d3d742 | 492 | (version "8.7.1") |
e506b5e9 L |
493 | (source |
494 | (origin | |
495 | (method url-fetch) | |
496 | (uri (string-append "https://github.com/libvips/nip2/releases/download/v" | |
497 | version "/nip2-" version ".tar.gz" )) | |
498 | (sha256 | |
f2d3d742 | 499 | (base32 "0l7n427njif53npqn02gfjjly8y3khbrkzqxp10j5vp9h97psgiw")))) |
e506b5e9 L |
500 | (build-system gnu-build-system) |
501 | (arguments | |
502 | `(#:phases | |
503 | (modify-phases %standard-phases | |
f2d3d742 | 504 | ;; test_conv.ws keep failing so disabling for now. |
e506b5e9 L |
505 | (add-after 'unpack 'disable-test-conv |
506 | (lambda _ | |
507 | (delete-file "test/workspaces/test_conv.ws") | |
508 | #t)) | |
509 | (add-before 'check 'set-home | |
510 | (lambda _ | |
511 | (setenv "HOME" "/tmp") #t))))) | |
512 | (inputs | |
513 | `(("vips" ,vips) | |
514 | ("glib" ,glib) | |
515 | ("libtiff" ,libtiff) | |
516 | ("gtk+-2" ,gtk+-2) | |
517 | ("libxml2" ,libxml2) | |
518 | ("libexif" ,libexif) | |
f2d3d742 | 519 | ("libjpeg" ,libjpeg) ; required by vips.pc |
e506b5e9 L |
520 | ("librsvg" ,librsvg) |
521 | ("fftw" ,fftw) | |
522 | ("libgsf" ,libgsf) | |
523 | ("imagemagick" ,imagemagick) | |
524 | ("orc" ,orc) | |
525 | ("matio" ,matio) | |
526 | ("lcms" ,lcms) | |
527 | ("libwebp" ,libwebp) | |
528 | ("openexr" ,openexr) | |
529 | ("poppler" ,poppler) | |
530 | ("gsl" ,gsl))) | |
531 | (native-inputs | |
532 | `(("flex" ,flex) | |
533 | ("bison" ,bison) | |
534 | ("pkg-config" ,pkg-config))) | |
535 | (home-page "https://github.com/libvips/nip2") | |
536 | (synopsis "Spreadsheet-like GUI for libvips") | |
537 | (description "This package provide a graphical user interface (GUI) for | |
538 | the VIPS image processing library. It's a little like a spreadsheet: you | |
539 | create a set of formula connecting your objects together, and on a change nip2 | |
540 | recalculates.") | |
541 | (license license:gpl2+))) | |
02e1acfb RW |
542 | |
543 | (define-public vxl | |
544 | (package | |
545 | (name "vxl") | |
546 | (version "2.0.2") | |
547 | (source | |
548 | (origin | |
549 | (method git-fetch) | |
550 | (uri (git-reference | |
551 | (url "https://github.com/vxl/vxl.git") | |
552 | (commit (string-append "v" version)))) | |
553 | (file-name (git-file-name name version)) | |
554 | (sha256 | |
555 | (base32 "0949hw57szq8943f1whwqaz591xjmb19kj803hcv74hdai2b0ycg")) | |
556 | (modules '((guix build utils))) | |
557 | ;; TODO: vxl includes an old version of dcmtk. It won't build with | |
558 | ;; version 3.6.x. | |
559 | (snippet | |
560 | '(begin | |
561 | (for-each delete-file-recursively | |
562 | '("v3p/bzlib/" | |
563 | "v3p/geotiff/" | |
564 | "v3p/jpeg/" | |
565 | "v3p/png/" | |
566 | "v3p/tiff/" | |
567 | "v3p/zlib/")) | |
568 | (substitute* "v3p/CMakeLists.txt" | |
569 | (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)") | |
570 | "")) | |
571 | #t)))) | |
572 | (build-system cmake-build-system) | |
573 | (inputs | |
574 | `(("libgeotiff" ,libgeotiff) | |
575 | ("libtiff" ,libtiff) | |
576 | ("libjpeg" ,libjpeg) | |
577 | ("libpng" ,libpng) | |
578 | ("zlib" ,zlib))) | |
579 | (home-page "https://github.com/vxl/vxl/") | |
580 | (synopsis "Collection of C++ libraries for computer vision") | |
581 | (description "VXL (the Vision-something-Libraries) is a collection of C++ | |
582 | libraries designed for computer vision research and implementation.") | |
583 | (license license:bsd-3))) | |
4243af4e RW |
584 | |
585 | (define-public vxl-1 | |
586 | (package (inherit vxl) | |
587 | (name "vxl") | |
588 | (version "1.18.0") | |
589 | (source | |
590 | (origin | |
591 | (method git-fetch) | |
592 | (uri (git-reference | |
593 | (url "https://github.com/vxl/vxl.git") | |
594 | (commit (string-append "v" version)))) | |
595 | (file-name (git-file-name name version)) | |
596 | (sha256 | |
597 | (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz")) | |
598 | (modules '((guix build utils))) | |
599 | (snippet | |
600 | '(begin | |
601 | (for-each delete-file-recursively | |
602 | '("v3p/bzlib/" | |
603 | "v3p/geotiff/" | |
604 | "v3p/png/" | |
605 | "v3p/tiff/" | |
606 | "v3p/zlib/")) | |
607 | (substitute* "v3p/CMakeLists.txt" | |
608 | (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)") | |
609 | "")) | |
610 | #t)))) | |
611 | (arguments | |
612 | `(#:configure-flags | |
613 | ;; Needed for itk-snap | |
614 | (list "-DVNL_CONFIG_LEGACY_METHODS=ON"))))) | |
d7701e1b RW |
615 | |
616 | (define-public insight-toolkit | |
617 | (package | |
618 | (name "insight-toolkit") | |
619 | (version "5.0.0") | |
620 | (source | |
621 | (origin | |
622 | (method url-fetch) | |
623 | (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" | |
624 | "releases/download/v" version "/InsightToolkit-" | |
625 | version ".tar.xz")) | |
626 | (sha256 | |
627 | (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi")))) | |
628 | (build-system cmake-build-system) | |
629 | (arguments | |
630 | `(#:tests? #f ; tests require network access and external data | |
631 | #:configure-flags | |
632 | '("-DITK_USE_GPU=ON" | |
633 | "-DITK_USE_SYSTEM_LIBRARIES=ON" | |
634 | "-DITK_USE_SYSTEM_GOOGLETEST=ON" | |
635 | "-DITK_BUILD_SHARED=ON" | |
636 | ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES | |
637 | ;; variable in the installed CMake files. This is necessary as other | |
638 | ;; packages using insight-toolkit could not be configured otherwise. | |
639 | "-DGTEST_ROOT=gtest") | |
640 | #:phases | |
641 | (modify-phases %standard-phases | |
642 | (add-after 'unpack 'do-not-tune | |
643 | (lambda _ | |
644 | (substitute* "CMake/ITKSetStandardCompilerFlags.cmake" | |
645 | (("-mute=native") "")) | |
646 | #t))))) | |
647 | (inputs | |
648 | `(("eigen" ,eigen) | |
649 | ("expat" ,expat) | |
650 | ("fftw" ,fftw) | |
651 | ("fftwf" ,fftwf) | |
652 | ("hdf5" ,hdf5) | |
653 | ("libjpeg" ,libjpeg) | |
654 | ("libpng" ,libpng) | |
655 | ("libtiff" ,libtiff) | |
656 | ("mesa" ,mesa-opencl) | |
657 | ("perl" ,perl) | |
658 | ("python" ,python) | |
659 | ("tbb" ,tbb) | |
660 | ("vxl" ,vxl-1) | |
661 | ("zlib" ,zlib))) | |
662 | (native-inputs | |
663 | `(("googletest" ,googletest) | |
664 | ("pkg-config" ,pkg-config))) | |
665 | (home-page "https://github.com/InsightSoftwareConsortium/ITK/") | |
666 | (synopsis "Scientific image processing, segmentation and registration") | |
667 | (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional | |
668 | scientific image processing, segmentation, and registration. Segmentation is | |
669 | the process of identifying and classifying data found in a digitally sampled | |
670 | representation. Typically the sampled representation is an image acquired | |
671 | from such medical instrumentation as CT or MRI scanners. Registration is the | |
672 | task of aligning or developing correspondences between data. For example, in | |
673 | the medical environment, a CT scan may be aligned with a MRI scan in order to | |
674 | combine the information contained in both.") | |
675 | (license license:asl2.0))) | |
8f4d457d RW |
676 | |
677 | (define-public insight-toolkit-4 | |
678 | (package (inherit insight-toolkit) | |
679 | (version "4.13.2") | |
680 | (source | |
681 | (origin | |
682 | (method url-fetch) | |
683 | (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" | |
684 | "releases/download/v" version "/InsightToolkit-" | |
685 | version ".tar.xz")) | |
686 | (sha256 | |
687 | (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns")))) | |
688 | (arguments | |
689 | `(#:tests? #f ; tests require network access and external data | |
690 | #:configure-flags | |
691 | '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap | |
692 | "-DITK_USE_GPU=ON" | |
693 | "-DITK_USE_SYSTEM_LIBRARIES=ON" | |
694 | "-DITK_USE_SYSTEM_GOOGLETEST=ON" | |
695 | "-DITK_USE_SYSTEM_VXL=ON"))))) | |
07f36b0c RW |
696 | |
697 | (define-public insight-toolkit-4.12 | |
698 | (package (inherit insight-toolkit-4) | |
699 | (version "4.12.2") | |
700 | (source | |
701 | (origin | |
702 | (method url-fetch) | |
703 | (uri (string-append "mirror://sourceforge/itk/itk/4.12/" | |
704 | "InsightToolkit-" version ".tar.xz")) | |
705 | (sha256 | |
706 | (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w")))))) | |
1c4e6aa9 RW |
707 | |
708 | (define-public itk-snap | |
709 | (package | |
710 | (name "itk-snap") | |
711 | (version "3.8.0") | |
712 | (source | |
713 | (origin | |
714 | (method git-fetch) | |
715 | (uri (git-reference | |
716 | (url "https://git.code.sf.net/p/itk-snap/src") | |
717 | (commit (string-append "v" version)))) | |
718 | (file-name (git-file-name name version)) | |
719 | (sha256 | |
720 | (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q")))) | |
721 | (build-system cmake-build-system) | |
722 | (arguments | |
723 | `(#:configure-flags | |
724 | (list "-DSNAP_VERSION_GIT_SHA1=release" | |
725 | "-DSNAP_VERSION_GIT_BRANCH=release" | |
726 | "-DSNAP_VERSION_GIT_TIMESTAMP=0" | |
727 | "-DSNAP_PACKAGE_QT_PLUGINS=OFF" | |
0fe041bd | 728 | "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") |
1c4e6aa9 RW |
729 | #:phases |
730 | (modify-phases %standard-phases | |
731 | ;; During the installation phase all libraries provided by all | |
732 | ;; dependencies will be copied to the lib directory. That's insane, | |
733 | ;; so we disable this. | |
734 | (add-after 'unpack 'do-not-copy-dependencies | |
735 | (lambda _ | |
736 | (substitute* "CMakeLists.txt" | |
737 | (("install_qt5_executable\ | |
738 | \\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)") | |
739 | "")) | |
740 | #t)) | |
741 | (add-after 'unpack 'disable-gui-tests | |
742 | (lambda _ | |
743 | ;; The GUI tests just time out. | |
744 | (substitute* "CMakeLists.txt" | |
745 | ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\ | |
746 | |RandomForest|RandomForestBailOut)") | |
747 | "")) | |
748 | #t)) | |
749 | (add-after 'unpack 'make-reproducible | |
750 | (lambda _ | |
751 | (substitute* "CMakeLists.txt" | |
752 | (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)") | |
753 | "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")")) | |
754 | #t)) | |
755 | (add-after 'unpack 'prepare-submodules | |
756 | (lambda* (#:key inputs #:allow-other-keys) | |
757 | (rmdir "Submodules/c3d") | |
758 | (copy-recursively (assoc-ref inputs "c3d-src") | |
759 | "Submodules/c3d") | |
760 | (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx" | |
761 | "Submodules/c3d/adapters/ApplyMetric.cxx") | |
762 | (("vcl_") "std::")) | |
763 | (rmdir "Submodules/greedy") | |
764 | (symlink (assoc-ref inputs "greedy-src") | |
765 | "Submodules/greedy") | |
766 | #t)) | |
767 | (add-after 'unpack 'fix-includes | |
768 | (lambda _ | |
769 | (substitute* "GUI/Model/RegistrationModel.cxx" | |
770 | (("<vnl_symmetric_eigensystem.h>") | |
771 | "<vnl/algo/vnl_symmetric_eigensystem.h>")) | |
772 | #t)) | |
773 | (add-before 'check 'prepare-tests | |
774 | (lambda _ | |
775 | ;; Needed by at least one test. | |
776 | (setenv "HOME" "/tmp") | |
777 | #t)) | |
778 | (add-after 'install 'wrap-executable | |
779 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
780 | (let ((out (assoc-ref outputs "out"))) | |
781 | (wrap-program (string-append out "/bin/itksnap") | |
782 | `("QT_PLUGIN_PATH" ":" prefix | |
783 | ,(map (lambda (label) | |
784 | (string-append (assoc-ref inputs label) | |
785 | "/lib/qt5/plugins")) | |
786 | '("qtbase" "qtdeclarative")))) | |
787 | #t)))))) | |
788 | (inputs | |
789 | `(("curl" ,curl) | |
790 | ("fftw" ,fftw) | |
791 | ("fftwf" ,fftwf) | |
792 | ("glu" ,glu) | |
793 | ("hdf5" ,hdf5) | |
794 | ("mesa" ,mesa-opencl) | |
795 | ;; This package does not build with either insight-toolkit 5.0.0 and | |
796 | ;; not with 4.13. It really needs to be 4.12. | |
797 | ("itk" ,insight-toolkit-4.12) | |
798 | ("vtk" ,vtk-6) | |
799 | ("qtbase" ,qtbase) | |
800 | ("qtdeclarative" ,qtdeclarative) | |
801 | ("qttools" ,qttools) | |
802 | ("vxl" ,vxl-1) | |
803 | ("zlib" ,zlib))) | |
804 | (native-inputs | |
805 | `(("googletest" ,googletest) | |
806 | ("pkg-config" ,pkg-config) | |
807 | ("c3d-src" | |
808 | ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3") | |
809 | (revision "1") | |
810 | (version (git-version "0" revision commit))) | |
811 | (origin | |
812 | (method git-fetch) | |
813 | (uri (git-reference | |
814 | (url "https://github.com/pyushkevich/c3d.git") | |
815 | (commit commit))) | |
816 | (file-name (git-file-name "c3d" version)) | |
817 | (sha256 | |
818 | (base32 | |
819 | "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3"))))) | |
820 | ;; We are using an arbitrary commit from 2017 because the latest | |
821 | ;; version breaks the build... | |
822 | ("greedy-src" | |
823 | ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3") | |
824 | (revision "1") | |
825 | (version (git-version "0" revision commit))) | |
826 | (origin | |
827 | (method git-fetch) | |
828 | (uri (git-reference | |
829 | (url "https://github.com/pyushkevich/greedy.git") | |
830 | (commit commit))) | |
831 | (file-name (git-file-name "greedy" version)) | |
832 | (sha256 | |
833 | (base32 | |
834 | "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab"))))))) | |
835 | (home-page "https://sourceforge.net/p/itk-snap/") | |
836 | (synopsis "Medical image segmentation") | |
837 | (description "ITK-SNAP is a tool for segmenting anatomical structures in | |
838 | medical images. It provides an automatic active contour segmentation | |
839 | pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a | |
840 | full-featured UI aimed at clinical researchers.") | |
841 | ;; This includes the submodules greedy and c3d. | |
842 | (license license:gpl3+))) |