Blob Blame History Raw
%global modname nibabel

Name:           python-%{modname}
Version:        2.1.0
Release:        1%{?dist}
Summary:        Python package to access a cacophony of neuro-imaging file formats

License:        MIT and PDDL-1.0
URL:            http://nipy.org/nibabel/
Source0:        https://github.com/nipy/nibabel/archive/%{version}/%{modname}-%{version}.tar.gz
BuildRequires:  git-core
BuildArch:      noarch

%description
Read / write access to some common neuroimaging file formats

This package provides read +/- write access to some common medical and
neuroimaging file formats, including: ANALYZE (plain, SPM99, SPM2 and
later), GIFTI, NIfTI1, NIfTI2, MINC1, MINC2, MGH and ECAT as well as Philips
PAR/REC. We can read and write Freesurfer geometry, and read Freesurfer
morphometry and annotation files. There is some very limited support for DICOM.
NiBabel is the successor of PyNIfTI.

The various image format classes give full or selective access to header (meta)
information and access to the image data is made available via NumPy arrays.

%package -n python2-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-nose
BuildRequires:  python2-mock
BuildRequires:  python2-six
BuildRequires:  python2-numpy
BuildRequires:  python2-scipy
BuildRequires:  python2-matplotlib
BuildRequires:  python2-pillow
BuildRequires:  python2-h5py
BuildRequires:  python2-pydicom
Requires:       python2-six
Requires:       python2-numpy
Requires:       python2-scipy
Recommends:     python2-pydicom

%description -n python2-%{modname}
Read / write access to some common neuroimaging file formats

This package provides read +/- write access to some common medical and
neuroimaging file formats, including: ANALYZE (plain, SPM99, SPM2 and
later), GIFTI, NIfTI1, NIfTI2, MINC1, MINC2, MGH and ECAT as well as Philips
PAR/REC. We can read and write Freesurfer geometry, and read Freesurfer
morphometry and annotation files. There is some very limited support for DICOM.
NiBabel is the successor of PyNIfTI.

The various image format classes give full or selective access to header (meta)
information and access to the image data is made available via NumPy arrays.

Python 2 version.

%package -n python3-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-nose
BuildRequires:  python3-mock
BuildRequires:  python3-six
BuildRequires:  python3-numpy
BuildRequires:  python3-scipy
BuildRequires:  python3-matplotlib
BuildRequires:  python3-pillow
BuildRequires:  python3-h5py
BuildRequires:  python3-pydicom
Requires:       python3-six
Requires:       python3-numpy
Requires:       python3-scipy
Recommends:     python3-pydicom

%description -n python3-%{modname}
Read / write access to some common neuroimaging file formats

This package provides read +/- write access to some common medical and
neuroimaging file formats, including: ANALYZE (plain, SPM99, SPM2 and
later), GIFTI, NIfTI1, NIfTI2, MINC1, MINC2, MGH and ECAT as well as Philips
PAR/REC. We can read and write Freesurfer geometry, and read Freesurfer
morphometry and annotation files. There is some very limited support for DICOM.
NiBabel is the successor of PyNIfTI.

The various image format classes give full or selective access to header (meta)
information and access to the image data is made available via NumPy arrays.

Python 3 version.

%prep
%autosetup -n %{modname}-%{version} -S git
rm -vrf %{modname}/externals/
# Hard fix for bundled libs
for f in $(find -type f -path ./doc -prune -o -name '*.py') bin/*; do
  sed -i \
    -e "s/from nibabel.externals.six/from six/"                                           \
    -e "s/from \.*[ ]*externals.six/from six/"                                            \
    -e "s/from \.*externals.netcdf/from scipy.io.netcdf/"                                 \
    -e "s/from nibabel.externals import OrderedDict/from collections import OrderedDict/" \
    -e "s/from \.*externals import OrderedDict/from collections import OrderedDict/"      \
  $f
  grep "externals" $f | grep "import" && exit 1
done
sed -i -e "/externals/d" setup.py

%build
%py2_build
%py3_build

%install
%py2_install
%py3_install

%check
nosetests-%{python2_version} -v
nosetests-%{python3_version} -v

%files -n python2-%{modname}
%license COPYING
%{python2_sitelib}/%{modname}*
%{python2_sitelib}/nisext/

%files -n python3-%{modname}
%license COPYING
%{_bindir}/parrec2nii
%{_bindir}/nib-ls
%{_bindir}/nib-dicomfs
%{_bindir}/nib-nifti-dx
%{python3_sitelib}/%{modname}*
%{python3_sitelib}/nisext/

%changelog
* Sat Mar 11 2017 Igor Gnatenko <ignatenko@redhat.com> - 2.1.0-1
- Update to 2.1.0

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2.0.2-4
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Nov 23 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.2-1
- Update to 2.0.2
- unversioned bir to python3

* Sat Oct 31 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.1-1
- Initial package