From 938ab5f4a7a2bce84f6b29c167ecdc74de90b405 Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Thu, 20 Jan 2022 17:38:47 +0100 Subject: [PATCH 04/18] gnu: Add python-nibabel. * gnu/packages/python-science.scm (python-nibabel): New variable. --- gnu/packages/python-science.scm | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 40e31f1526..d8abf2f471 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -54,6 +54,7 @@ (define-module (gnu packages python-science) #:use-module (gnu packages sphinx) #:use-module (gnu packages statistics) #:use-module (gnu packages time) + #:use-module (gnu packages version-control) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) @@ -1095,3 +1096,65 @@ (define-public python-eeglabio (synopsis "I/O support for EEGLAB files in Python") (description "I/O support for EEGLAB files in Python.") (license license:bsd-3))) + +(define-public python-nibabel + (package + (name "python-nibabel") + (version "3.2.1") + (source (origin + (method url-fetch) + (uri (pypi-uri "nibabel" version)) + (sha256 + (base32 + "17n23w7y0hiz2vma5si7wy184d59bp14zd8nr6hi203ldd1gjbsd")))) + (build-system python-build-system) + (arguments + (list #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-tests + (lambda _ + ;; Some tests have a setup function, but it is not called + ;; (!) + (for-each (lambda (fix) + (let ((file (open-file (string-append + "nibabel/streamlines/tests/test_" + (car fix) ".py") "a"))) + (format file " +~a()" + (cdr fix)) + (close-port file))) + '(("array_sequence" . "setup_module") + ("streamlines" . "setup") + ("tck" . "setup_module") + ("tractogram" . "setup_module") + ("trk" . "setup_module")))))))) + (propagated-inputs (list python-numpy python-packaging)) + (native-inputs (list python-coverage + python-gitpython + python-pytest + python-pytest-cov + python-pytest-doctestplus + python-twine)) + (home-page "https://nipy.org/nibabel/") + (synopsis "Access a multitude of neuroimaging data formats") + (description + "This package provides read +/- write access to some common +medical and neuroimaging file formats, including: +@url{http://www.grahamwideman.com/gw/brain/analyze/formatdoc.htm, +ANALYZE} (plain, SPM99, SPM2 and later), +@url{https://www.nitrc.org/projects/gifti, GIFTI}, +@url{http://nifti.nimh.nih.gov/nifti-1/, NIfTI1}, +@url{http://nifti.nimh.nih.gov/nifti-2/, NIfTI2}, +@url{https://www.nitrc.org/projects/cifti/, CIFTI-2}, +@url{https://en.wikibooks.org/wiki/MINC/Reference/MINC1_File_Format_Reference, +MINC1}, +@url{https://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_File_Format_Reference, +MINC2}, @url{https://afni.nimh.nih.gov/pub/dist/src/README.attributes, AFNI +BRIK/HEAD}, +@url{https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat, MGH} and +@url{http://xmedcon.sourceforge.net/Docs/Ecat, ECAT} as well as Philips +PAR/REC. We can read and write @url{https://surfer.nmr.mgh.harvard.edu/, +FreeSurfer} geometry, annotation and morphometry files. There is some very +limited support for @url{http://medical.nema.org/, DICOM}. NiBabel is the +successor of @url{http://niftilib.sourceforge.net/pynifti/, PyNIfTI}.") + (license license:expat))) -- 2.34.0