X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/02e1acfb2a65783d63e526da798337c91b40a5f1..6e05adbb8f0396ef2bffef9cf56248e68aa8a3df:/gnu/packages/image-processing.scm diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm index a4365f6009..9158e14938 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -4,10 +4,13 @@ ;;; Copyright © 2014 Ludovic Courtès ;;; Copyright © 2014 Mark H Weaver ;;; Copyright © 2016 Eric Bavier -;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice +;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2018 Björn Höfling ;;; Copyright © 2018 Lprndn ;;; Copyright © 2019 Efraim Flashner +;;; Copyright © 2020 Vincent Legoll +;;; Copyright © 2020 Vinicius Monego +;;; Copyright © 2020 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,7 +39,10 @@ #:use-module (gnu packages algebra) #:use-module (gnu packages bison) #:use-module (gnu packages boost) + #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages curl) + #:use-module (gnu packages docbook) #:use-module (gnu packages documentation) #:use-module (gnu packages flex) #:use-module (gnu packages fontutils) @@ -59,8 +65,11 @@ #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages qt) #:use-module (gnu packages serialization) + #:use-module (gnu packages tbb) #:use-module (gnu packages tls) + #:use-module (gnu packages version-control) #:use-module (gnu packages video) #:use-module (gnu packages xiph) #:use-module (gnu packages xml) @@ -71,7 +80,7 @@ (define-public dcmtk (package (name "dcmtk") - (version "3.6.4") + (version "3.6.5") (source (origin (method url-fetch) @@ -80,12 +89,12 @@ "dcmtk" (string-join (string-split version #\.) "") "/dcmtk-" version ".tar.gz")) (sha256 - (base32 "1h22z8g0kmvhg8lgkbikyzyphhvxvq6018a00yd6i4g0z9ag6gx9")))) + (base32 "1fdyz5wwjp4grys61mxb2ia9fi6i3ax6s43l16xnv291bxk7hld0")))) (build-system cmake-build-system) (inputs `(;; Our ICU is too recent: “error: ‘UChar’ does not name a type“. ;; ("icu4c" ,icu4c) - ("libjpeg" ,libjpeg) + ("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng) ("libtiff" ,libtiff) ("libxml2" ,libxml2) @@ -133,7 +142,7 @@ licences similar to the Modified BSD licence.")))) ("gts" ,gts) ("hdf5" ,hdf5) ("itpp" ,itpp) - ("libjpeg" ,libjpeg) + ("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng) ("libtiff" ,libtiff) ("libxml" ,libxml2) @@ -157,6 +166,78 @@ without compromising the original code base and it makes use of a wide variety of external libraries that provide additional functionality.") (license license:gpl3+))) +(define-public opencolorio + (package + (name "opencolorio") + (version "1.1.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/AcademySoftwareFoundation/OpenColorIO") + (commit (string-append "v" version)))) + (sha256 + (base32 "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb")) + (file-name (git-file-name name version)) + (modules '((guix build utils))) + (snippet + `(begin + ;; Remove bundled tarballs, patches, and .jars(!). XXX: Upstream + ;; claims to have fixed USE_EXTERNAL_YAML, but it still fails with: + ;; https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/517 + ;; When removing it, also remove it from the licence field comment. + (for-each delete-file-recursively + (filter + (lambda (full-name) + (let ((file (basename full-name))) + (not (or (string-prefix? "yaml-cpp-0.3" file) + (string=? "unittest.h" file))))) + (find-files "ext" ".*"))) + + #t)))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + (list (string-append "-DCMAKE_CXX_FLAGS=" + "-Wno-error=deprecated-declarations " + "-Wno-error=unused-function") + "-DOCIO_BUILD_STATIC=OFF" + ;; "-DUSE_EXTERNAL_YAML=ON" + "-DUSE_EXTERNAL_TINYXML=ON" + "-DUSE_EXTERNAL_LCMS=ON") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-test-suite + (lambda _ + (substitute* "src/core_tests/CMakeLists.txt" + (("/bin/sh") (which "bash"))) + #t))))) + (native-inputs + `(("git" ,git) + ("pkg-config" ,pkg-config))) + (inputs + ;; XXX Adding freeglut, glew, ilmbase, mesa, and openimageio for + ;; ocioconvert fails: error: conflicting declaration ?typedef void + ;; (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*) + `(("lcms" ,lcms) + ("openexr" ,openexr) + ("tinyxml" ,tinyxml))) + (home-page "https://opencolorio.org") + (synopsis "Color management for visual effects and animation") + (description + "OpenColorIO, or OCIO, is a complete color management solution geared +towards motion picture production, with an emphasis on visual effects and +computer animation. It provides a straightforward and consistent user +experience across all supporting applications while allowing for sophisticated +back-end configuration options suitable for high-end production usage. + +OCIO is compatible with the @acronym{ACES, Academy Color Encoding +Specification} and is @acronym{LUT, look-up table}-format agnostic, supporting +many popular formats.") + (license (list license:expat ; docs/ociotheme/static, ext/yaml-cpp-* + license:zlib ; src/core/md5 + license:bsd-3)))) ; the rest + (define-public vtk (package (name "vtk") @@ -194,7 +275,7 @@ of external libraries that provide additional functionality.") ("expat" ,expat) ("freetype" ,freetype) ("hdf5" ,hdf5) - ("jpeg" ,libjpeg) + ("jpeg" ,libjpeg-turbo) ("jsoncpp" ,jsoncpp) ("libogg" ,libogg) ("libtheora" ,libtheora) @@ -243,6 +324,8 @@ integrates with various databases on GUI toolkits such as Qt and Tk.") (sha256 (base32 "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3")) + (patches + (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch")) (modules '((guix build utils))) (snippet '(begin @@ -369,7 +452,7 @@ integrates with various databases on GUI toolkits such as Qt and Tk.") (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp))))))))) (native-inputs `(("pkg-config" ,pkg-config) - ("xorg-server" ,xorg-server) ; For running the tests + ("xorg-server" ,xorg-server-for-tests) ; For running the tests ("opencv-extra" ,(origin (method git-fetch) @@ -389,7 +472,7 @@ integrates with various databases on GUI toolkits such as Qt and Tk.") (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch")) (sha256 (base32 "1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2")))))) - (inputs `(("libjpeg" ,libjpeg) + (inputs `(("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng) ("jasper" ,jasper) ;; ffmpeg 4.0 causes core dumps in tests. @@ -450,7 +533,7 @@ vision algorithms. It can be used to do things like: ("gobject-introspection" ,gobject-introspection))) (inputs `(("glib" ,glib) - ("libjpeg" ,libjpeg) + ("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng) ("librsvg" ,librsvg) ("libtiff" ,libtiff) @@ -482,6 +565,43 @@ quickly, especially on machines with more than one CPU core. This is primarily due to its architecture which automatically parallelises the image workflows.") (license license:lgpl2.1+))) +(define-public gmic + (package + (name "gmic") + (version "2.9.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://gmic.eu/files/source/gmic_" + version ".tar.gz")) + (sha256 + (base32 "14acph914a8lp6qqfmp319ggqjg3i3hmalmnpk3mp07m7vpv2p9q")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f)) ;there are no tests + (native-inputs + `(("pkg-config" ,pkg-config))) + (inputs + `(("curl" ,curl) + ("fftw" ,fftw) + ("graphicsmagick" ,graphicsmagick) + ("libjpeg-turbo" ,libjpeg-turbo) + ("libpng" ,libpng) + ("libtiff" ,libtiff) + ("libx11" ,libx11) + ;;("opencv" ,opencv) ;OpenCV is currently broken in the CI + ("openexr" ,openexr) + ("zlib" ,zlib))) + (home-page "https://gmic.eu/") + (synopsis "Full-featured framework for digital image processing") + (description "G'MIC is a full-featured framework for digital image +processing. It provides several user interfaces to convert / manipulate +/ filter / visualize generic image datasets, ranging from 1D scalar +signals to 3D+t sequences of multi-spectral volumetric images, hence +including 2D color images.") + ;; Dual-licensed, either license applies. + (license (list license:cecill license:cecill-c)))) + (define-public nip2 (package (name "nip2") @@ -512,7 +632,7 @@ due to its architecture which automatically parallelises the image workflows.") ("gtk+-2" ,gtk+-2) ("libxml2" ,libxml2) ("libexif" ,libexif) - ("libjpeg" ,libjpeg) ; required by vips.pc + ("libjpeg" ,libjpeg-turbo) ;required by vips.pc ("librsvg" ,librsvg) ("fftw" ,fftw) ("libgsf" ,libgsf) @@ -544,7 +664,7 @@ recalculates.") (origin (method git-fetch) (uri (git-reference - (url "https://github.com/vxl/vxl.git") + (url "https://github.com/vxl/vxl") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 @@ -569,7 +689,7 @@ recalculates.") (inputs `(("libgeotiff" ,libgeotiff) ("libtiff" ,libtiff) - ("libjpeg" ,libjpeg) + ("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng) ("zlib" ,zlib))) (home-page "https://github.com/vxl/vxl/") @@ -577,3 +697,321 @@ recalculates.") (description "VXL (the Vision-something-Libraries) is a collection of C++ libraries designed for computer vision research and implementation.") (license license:bsd-3))) + +(define-public vxl-1 + (package (inherit vxl) + (name "vxl") + (version "1.18.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/vxl/vxl") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1g4mr2cc58jwm0vasscbd4y5380wj3ahkvq121z4gs83fhavvxgz")) + (modules '((guix build utils))) + (snippet + '(begin + (for-each delete-file-recursively + '("v3p/bzlib/" + "v3p/geotiff/" + "v3p/png/" + "v3p/tiff/" + "v3p/zlib/")) + (substitute* "v3p/CMakeLists.txt" + (("add_subdirectory\\((tiff|png|jpeg|zlib|bzlib|geotiff)\\)") + "")) + #t)))) + (arguments + `(#:configure-flags + ;; Needed for itk-snap + (list "-DVNL_CONFIG_LEGACY_METHODS=ON"))))) + +(define-public insight-toolkit + (package + (name "insight-toolkit") + (version "5.0.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" + "releases/download/v" version "/InsightToolkit-" + version ".tar.xz")) + (sha256 + (base32 "0bs63mk4q8jmx38f031jy5w5n9yy5ng9x8ijwinvjyvas8cichqi")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; tests require network access and external data + #:configure-flags + '("-DITK_USE_GPU=ON" + "-DITK_USE_SYSTEM_LIBRARIES=ON" + "-DITK_USE_SYSTEM_GOOGLETEST=ON" + "-DITK_BUILD_SHARED=ON" + ;; This prevents "GTest::GTest" from being added to the ITK_LIBRARIES + ;; variable in the installed CMake files. This is necessary as other + ;; packages using insight-toolkit could not be configured otherwise. + "-DGTEST_ROOT=gtest") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'do-not-tune + (lambda _ + (substitute* "CMake/ITKSetStandardCompilerFlags.cmake" + (("-mute=native") "")) + #t))))) + (inputs + `(("eigen" ,eigen) + ("expat" ,expat) + ("fftw" ,fftw) + ("fftwf" ,fftwf) + ("hdf5" ,hdf5) + ("libjpeg" ,libjpeg-turbo) + ("libpng" ,libpng) + ("libtiff" ,libtiff) + ("mesa" ,mesa-opencl) + ("perl" ,perl) + ("python" ,python) + ("tbb" ,tbb) + ("vxl" ,vxl-1) + ("zlib" ,zlib))) + (native-inputs + `(("googletest" ,googletest) + ("pkg-config" ,pkg-config))) + (home-page "https://github.com/InsightSoftwareConsortium/ITK/") + (synopsis "Scientific image processing, segmentation and registration") + (description "The Insight Toolkit (ITK) is a toolkit for N-dimensional +scientific image processing, segmentation, and registration. Segmentation is +the process of identifying and classifying data found in a digitally sampled +representation. Typically the sampled representation is an image acquired +from such medical instrumentation as CT or MRI scanners. Registration is the +task of aligning or developing correspondences between data. For example, in +the medical environment, a CT scan may be aligned with a MRI scan in order to +combine the information contained in both.") + (license license:asl2.0))) + +(define-public insight-toolkit-4 + (package (inherit insight-toolkit) + (version "4.13.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/InsightSoftwareConsortium/ITK/" + "releases/download/v" version "/InsightToolkit-" + version ".tar.xz")) + (sha256 + (base32 "19cgfpd63gqrvc3m27m394gy2d7w79g5y6lvznb5qqr49lihbgns")))) + (arguments + `(#:tests? #f ; tests require network access and external data + #:configure-flags + '("-DITKV3_COMPATIBILITY=ON" ; needed for itk-snap + "-DITK_USE_GPU=ON" + "-DITK_USE_SYSTEM_LIBRARIES=ON" + "-DITK_USE_SYSTEM_GOOGLETEST=ON" + "-DITK_USE_SYSTEM_VXL=ON"))))) + +(define-public insight-toolkit-4.12 + (package (inherit insight-toolkit-4) + (version "4.12.2") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/itk/itk/4.12/" + "InsightToolkit-" version ".tar.xz")) + (sha256 + (base32 "1qw9mxbh083siljygahl4gdfv91xvfd8hfl7ghwii19f60xrvn2w")))))) + +(define-public itk-snap + (package + (name "itk-snap") + (version "3.8.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.code.sf.net/p/itk-snap/src") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "15i5ixpryfrbf3vrrb5rici8fb585f25k0v1ljds16bp1f1msr4q")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + (list "-DSNAP_VERSION_GIT_SHA1=release" + "-DSNAP_VERSION_GIT_BRANCH=release" + "-DSNAP_VERSION_GIT_TIMESTAMP=0" + "-DSNAP_PACKAGE_QT_PLUGINS=OFF" + "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") + #:phases + (modify-phases %standard-phases + ;; During the installation phase all libraries provided by all + ;; dependencies will be copied to the lib directory. That's insane, + ;; so we disable this. + (add-after 'unpack 'do-not-copy-dependencies + (lambda _ + (substitute* "CMakeLists.txt" + (("install_qt5_executable\ +\\(\\$\\{SNAP_MAIN_INSTALL_DIR\\}/\\$\\{SNAP_EXE\\}\\)") + "")) + #t)) + (add-after 'unpack 'disable-gui-tests + (lambda _ + ;; The GUI tests just time out. + (substitute* "CMakeLists.txt" + ((" (Workspace|DiffSpace|ProbeIntensity|RegionCompetition\ +|RandomForest|RandomForestBailOut)") + "")) + #t)) + (add-after 'unpack 'make-reproducible + (lambda _ + (substitute* "CMakeLists.txt" + (("TODAY\\(SNAP_VERSION_COMPILE_DATE\\)") + "SET(SNAP_VERSION_COMPILE_DATE \"(removed for reproducibility)\")")) + #t)) + (add-after 'unpack 'prepare-submodules + (lambda* (#:key inputs #:allow-other-keys) + (rmdir "Submodules/c3d") + (copy-recursively (assoc-ref inputs "c3d-src") + "Submodules/c3d") + (substitute* '("Submodules/c3d/adapters/BiasFieldCorrectionN4.cxx" + "Submodules/c3d/adapters/ApplyMetric.cxx") + (("vcl_") "std::")) + (rmdir "Submodules/greedy") + (symlink (assoc-ref inputs "greedy-src") + "Submodules/greedy") + #t)) + (add-after 'unpack 'fix-includes + (lambda _ + (substitute* "GUI/Model/RegistrationModel.cxx" + (("") + "")) + #t)) + (add-before 'check 'prepare-tests + (lambda _ + ;; Needed by at least one test. + (setenv "HOME" "/tmp") + #t)) + (add-after 'install 'wrap-executable + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (wrap-program (string-append out "/bin/itksnap") + `("QT_PLUGIN_PATH" ":" prefix + ,(map (lambda (label) + (string-append (assoc-ref inputs label) + "/lib/qt5/plugins")) + '("qtbase" "qtdeclarative")))) + #t)))))) + (inputs + `(("curl" ,curl) + ("fftw" ,fftw) + ("fftwf" ,fftwf) + ("glu" ,glu) + ("hdf5" ,hdf5) + ("mesa" ,mesa-opencl) + ;; This package does not build with either insight-toolkit 5.0.0 and + ;; not with 4.13. It really needs to be 4.12. + ("itk" ,insight-toolkit-4.12) + ("vtk" ,vtk-6) + ("qtbase" ,qtbase) + ("qtdeclarative" ,qtdeclarative) + ("vxl" ,vxl-1) + ("zlib" ,zlib))) + (native-inputs + `(("googletest" ,googletest) + ("qttools" ,qttools) + ("pkg-config" ,pkg-config) + ("c3d-src" + ,(let* ((commit "f521358db26e00002c911cc47bf463b043942ad3") + (revision "1") + (version (git-version "0" revision commit))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pyushkevich/c3d") + (commit commit))) + (file-name (git-file-name "c3d" version)) + (sha256 + (base32 + "0kyv3rxrxwr8c3sa9zv01lsnhk95b27gx1s870k3yi8qp52h7bx3"))))) + ;; We are using an arbitrary commit from 2017 because the latest + ;; version breaks the build... + ("greedy-src" + ,(let* ((commit "97e340f7e8e66597599144947775e6039e79a0d3") + (revision "1") + (version (git-version "0" revision commit))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pyushkevich/greedy") + (commit commit))) + (file-name (git-file-name "greedy" version)) + (sha256 + (base32 + "0k5bc9za4jrc8z9dj08z1rkcp5xf0gnd1d2jmi1w9ny4vxh2q2ab"))))))) + (home-page "https://sourceforge.net/p/itk-snap/") + (synopsis "Medical image segmentation") + (description "ITK-SNAP is a tool for segmenting anatomical structures in +medical images. It provides an automatic active contour segmentation +pipeline, along with supporting a manual segmentation toolbox. ITK-SNAP has a +full-featured UI aimed at clinical researchers.") + ;; This includes the submodules greedy and c3d. + (license license:gpl3+))) + +(define-public metapixel + ;; Follow stable branch. + (let ((commit "98ee9daa093b6c334941242e63f90b1c2876eb4f")) + (package + (name "metapixel") + (version (git-version "1.0.2" "1" commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/schani/metapixel") + (commit commit) + ;; TODO: Package rwimg and lispreader? + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0r7n3a6bvcxkbpda4mwmrpicii09iql5z69nkjqygkwxw7ny3309")))) + (build-system gnu-build-system) + (inputs + `(("giflib" ,giflib) + ("libjpeg" ,libjpeg-turbo) + ("libpng" ,libpng) + ("perl" ,perl))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("docbook-xml" ,docbook-xml) + ("docbook-xsl" ,docbook-xsl) + ("xsltproc" ,libxslt))) + (arguments + `(#:tests? #f ; No tests. + #:make-flags (list + (string-append "PREFIX=" (assoc-ref %outputs "out")) + (string-append "MANPAGE_XSL=" + (assoc-ref %build-inputs "docbook-xsl") + "/xml/xsl/docbook-xsl-*/manpages/docbook.xsl")) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'install 'make-local-docbook-xml + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "metapixel.xml" + (("http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd") + (string-append (assoc-ref inputs "docbook-xml") + "/xml/dtd/docbook/docbookx.dtd"))) + #t)) + (add-before 'install 'fix-directory-creation + (lambda* (#:key outputs #:allow-other-keys) + (mkdir-p (string-append (assoc-ref outputs "out") "/share/man/man1")) + #t))))) + (home-page "https://www.complang.tuwien.ac.at/schani/metapixel/") + (synopsis "Photomosaics generator") + (description "Metapixel is a program for generating photomosaics. It can +generate classical photomosaics, in which the source image is viewed as a +matrix of equally sized rectangles for each of which a matching image is +substitued, as well as collage-style photomosaics, in which rectangular parts +of the source image at arbitrary positions (i.e. not aligned to a matrix) are +substituted by matching images.") + (license license:gpl2))))