Skip to content

Commit fbaeacc

Browse files
authored
Merge branch 'master' into loadsave-pathlib_compat
2 parents e0fff5c + debf173 commit fbaeacc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+899
-432
lines changed

.azure-pipelines/windows.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
vmImage: ${{ parameters.vmImage }}
1111
variables:
1212
EXTRA_WHEELS: "https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
13+
DEPENDS: numpy scipy matplotlib h5py pydicom
1314
strategy:
1415
matrix:
1516
${{ insert }}: ${{ parameters.matrix }}
@@ -20,11 +21,14 @@ jobs:
2021
versionSpec: '$(PYTHON_VERSION)'
2122
addToPath: true
2223
architecture: '$(PYTHON_ARCH)'
24+
- script: |
25+
echo %PYTHONHASHSEED%
26+
displayName: 'Display hash seed'
2327
- script: |
2428
python -m pip install --upgrade pip setuptools>=30.3.0 wheel
2529
displayName: 'Update build tools'
2630
- script: |
27-
python -m pip install --find-links %EXTRA_WHEELS% numpy scipy matplotlib h5py pydicom
31+
python -m pip install --find-links %EXTRA_WHEELS% %DEPENDS%
2832
python -m pip install nose mock coverage codecov
2933
displayName: 'Install dependencies'
3034
- script: |

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "nibabel-data/nitest-cifti2"]
1717
path = nibabel-data/nitest-cifti2
1818
url = https://github.com/demianw/nibabel-nitest-cifti2.git
19+
[submodule "nibabel-data/nitest-dicom"]
20+
path = nibabel-data/nitest-dicom
21+
url = https://github.com/effigies/nitest-dicom

.pep8speaks.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
scanner:
2+
diff_only: True # Only show errors caused by the patch
3+
linter: flake8
4+
5+
message: # Customize the comment made by the bot
6+
opened: # Messages when a new PR is submitted
7+
header: "Hello @{name}, thank you for submitting the Pull Request!"
8+
footer: "To test for issues locally, `pip install flake8` and then run `flake8 nibabel`."
9+
updated: # Messages when new commits are added to the PR
10+
header: "Hello @{name}, Thank you for updating!"
11+
footer: "To test for issues locally, `pip install flake8` and then run `flake8 nibabel`."
12+
no_errors: "Cheers! There are no style issues detected in this Pull Request. :beers: "

.travis.yml

+48-59
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,39 @@ dist: xenial
88
sudo: true
99
language: python
1010

11-
cache:
12-
directories:
13-
- $HOME/.cache/pip
11+
cache: pip
1412
env:
1513
global:
16-
- DEPENDS="six numpy scipy matplotlib h5py pillow pydicom"
17-
- OPTIONAL_DEPENDS=""
14+
- SETUP_REQUIRES="pip setuptools>=30.3.0 wheel"
15+
- DEPENDS="numpy scipy matplotlib h5py pillow pydicom indexed_gzip"
1816
- INSTALL_TYPE="setup"
1917
- CHECK_TYPE="test"
2018
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
2119
- PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"
2220
- EXTRA_PIP_FLAGS="--find-links=$EXTRA_WHEELS"
2321
- PRE_PIP_FLAGS="--pre $EXTRA_PIP_FLAGS --find-links $PRE_WHEELS"
22+
2423
python:
2524
- 3.6
2625
- 3.7
26+
2727
matrix:
2828
include:
29-
# Absolute minimum dependencies
29+
# Basic dependencies only
3030
- python: 3.5
3131
env:
32-
- DEPENDS="-r min-requirements.txt setuptools==30.3.0"
32+
- DEPENDS="-r requirements.txt"
33+
# Clean install
34+
- python: 3.5
35+
env:
36+
- DEPENDS=""
37+
- CHECK_TYPE=skiptests
3338
# Absolute minimum dependencies
3439
- python: 3.5
3540
env:
41+
- SETUP_REQUIRES="setuptools==30.3.0"
3642
- DEPENDS="-r min-requirements.txt"
37-
- CHECK_TYPE="import"
3843
# Absolute minimum dependencies plus oldest MPL
39-
# Check these against:
40-
# nibabel/info.py
41-
# doc/source/installation.rst
42-
# requirements.txt
4344
- python: 3.5
4445
env:
4546
- DEPENDS="-r min-requirements.txt matplotlib==1.3.1"
@@ -51,8 +52,8 @@ matrix:
5152
- python: 3.5
5253
env:
5354
- DEPENDS="numpy git+https://github.com/pydicom/pydicom.git@master"
54-
# test 3.5 against pre-release builds of everything
55-
- python: 3.5
55+
# test 3.7 against pre-release builds of everything
56+
- python: 3.7
5657
env:
5758
- EXTRA_PIP_FLAGS="$PRE_PIP_FLAGS"
5859
- python: 3.5
@@ -61,9 +62,6 @@ matrix:
6162
- python: 3.5
6263
env:
6364
- INSTALL_TYPE=wheel
64-
- python: 3.5
65-
env:
66-
- INSTALL_TYPE=requirements
6765
- python: 3.5
6866
env:
6967
- INSTALL_TYPE=archive
@@ -73,62 +71,55 @@ matrix:
7371
# Documentation doctests
7472
- python: 3.5
7573
env:
76-
- CHECK_TYPE="doc_doctests"
77-
# Run tests with indexed_gzip present
78-
- python: 3.5
79-
env:
80-
- OPTIONAL_DEPENDS="indexed_gzip"
74+
- CHECK_TYPE="doc"
75+
76+
# Set up virtual environment, build package, build from depends
8177
before_install:
82-
- travis_retry python -m pip install --upgrade pip
83-
- travis_retry pip install --upgrade virtualenv
78+
- travis_retry python -m pip install --upgrade pip virtualenv
8479
- virtualenv --python=python venv
8580
- source venv/bin/activate
8681
- python --version # just to check
87-
- travis_retry pip install -U pip setuptools>=27.0 wheel
88-
- travis_retry pip install coverage
89-
- if [ "${CHECK_TYPE}" == "test" ]; then
90-
travis_retry pip install nose mock;
91-
fi
92-
- if [ "${CHECK_TYPE}" == "style" ]; then
93-
travis_retry pip install flake8;
82+
- travis_retry pip install -U $SETUP_REQUIRES
83+
- |
84+
if [ "$INSTALL_TYPE" == "sdist" ]; then
85+
python setup.py egg_info # check egg_info while we're here
86+
python setup.py sdist
87+
export ARCHIVE=$( ls dist/*.tar.gz )
88+
elif [ "$INSTALL_TYPE" == "wheel" ]; then
89+
python setup.py bdist_wheel
90+
export ARCHIVE=$( ls dist/*.whl )
91+
elif [ "$INSTALL_TYPE" == "archive" ]; then
92+
export ARCHIVE="package.tar.gz"
93+
git archive -o $ARCHIVE HEAD
9494
fi
95-
- travis_retry pip install $EXTRA_PIP_FLAGS $DEPENDS $OPTIONAL_DEPENDS
95+
- if [ -n "$DEPENDS" ]; then pip install $EXTRA_PIP_FLAGS $DEPENDS; fi
96+
9697
# command to install dependencies
9798
install:
9899
- |
99100
if [ "$INSTALL_TYPE" == "setup" ]; then
100101
python setup.py install
101-
elif [ "$INSTALL_TYPE" == "sdist" ]; then
102-
python setup_egg.py egg_info # check egg_info while we're here
103-
python setup_egg.py sdist
104-
pip install $EXTRA_PIP_FLAGS dist/*.tar.gz
105-
elif [ "$INSTALL_TYPE" == "wheel" ]; then
106-
python setup_egg.py bdist_wheel
107-
pip install $EXTRA_PIP_FLAGS dist/*.whl
108-
elif [ "$INSTALL_TYPE" == "requirements" ]; then
109-
pip install $EXTRA_PIP_FLAGS -r requirements.txt
110-
python setup.py install
111-
elif [ "$INSTALL_TYPE" == "archive" ]; then
112-
git archive -o package.tar.gz HEAD
113-
pip install $EXTRA_PIP_FLAGS package.tar.gz
102+
else
103+
pip install $EXTRA_PIP_FLAGS $ARCHIVE
114104
fi
105+
# Basic import check
106+
- python -c 'import nibabel; print(nibabel.__version__)'
107+
- if [ "$CHECK_TYPE" == "skiptests" ]; then exit 0; fi
108+
109+
before_script:
115110
# Point to nibabel data directory
116111
- export NIBABEL_DATA_DIR="$PWD/nibabel-data"
112+
# Because nibabel is already installed, will just look up the extra
113+
- pip install $EXTRA_PIP_FLAGS "nibabel[$CHECK_TYPE]"
114+
117115
# command to run tests, e.g. python setup.py test
118116
script:
119117
- |
120118
if [ "${CHECK_TYPE}" == "style" ]; then
121119
# Run styles only on core nibabel code.
122120
flake8 nibabel
123-
elif [ "${CHECK_TYPE}" == "import" ]; then
124-
# Import nibabel without attempting to test
125-
# Allows us to check missing dependencies masked by testing libraries
126-
printf 'import nibabel\nprint(nibabel.__version__)\n' > import_only.py
127-
cat import_only.py
128-
coverage run import_only.py
129-
elif [ "${CHECK_TYPE}" == "doc_doctests" ]; then
121+
elif [ "${CHECK_TYPE}" == "doc" ]; then
130122
cd doc
131-
pip install -r ../doc-requirements.txt
132123
make html;
133124
make doctest;
134125
elif [ "${CHECK_TYPE}" == "test" ]; then
@@ -140,12 +131,10 @@ script:
140131
else
141132
false
142133
fi
143-
after_success:
144-
- |
145-
if [ "${CHECK_TYPE}" == "test" ]; then
146-
travis_retry pip install codecov
147-
codecov
148-
fi
134+
135+
after_script:
136+
- travis_retry pip install codecov
137+
- codecov
149138

150139
notifications:
151140
webhooks: http://nipy.bic.berkeley.edu:54856/travis

.zenodo.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@
8787
{
8888
"name": "Moloney, Brendan"
8989
},
90+
{
91+
"affiliation": "MIT",
92+
"name": "Goncalves, Mathias",
93+
"orcid": "0000-0002-7252-7771"
94+
},
9095
{
9196
"name": "Burns, Christopher"
9297
},
@@ -130,11 +135,6 @@
130135
{
131136
"name": "Baker, Eric M."
132137
},
133-
{
134-
"affiliation": "MIT",
135-
"name": "Goncalves, Mathias",
136-
"orcid": "0000-0002-7252-7771"
137-
},
138138
{
139139
"name": "Hayashi, Soichi"
140140
},
@@ -244,6 +244,11 @@
244244
"name": "P\u00e9rez-Garc\u00eda, Fernando",
245245
"orcid": "0000-0001-9090-3024"
246246
},
247+
{
248+
"affiliation": "Center for Magnetic Resonance Research, University of Minnesota",
249+
"name": "Braun, Henry",
250+
"orcid": "0000-0001-7003-9822"
251+
},
247252
{
248253
"name": "Solovey, Igor"
249254
},

Changelog

+27
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ Eric Larson (EL), Demian Wassermann, and Stephan Gerhard.
2525

2626
References like "pr/298" refer to github pull request numbers.
2727

28+
2.5.1 (Monday 23 September 2019)
29+
================================
30+
31+
Enhancements
32+
------------
33+
* Ignore endianness in ``nib-diff`` if values match (pr/799) (YOH, reviewed
34+
by CM)
35+
36+
Bug fixes
37+
---------
38+
* Correctly handle Philips DICOMs w/ derived volume (pr/795) (Mathias
39+
Goncalves, reviewed by CM)
40+
* Raise CSA tag limit to 1000, parametrize for future relaxing (pr/798,
41+
backported to 2.5.x in pr/800) (Henry Braun, reviewed by CM, MB)
42+
* Coerce data types to match NIfTI intent codes when writing GIFTI data
43+
arrays (pr/806) (CM, reported by Tom Holroyd)
44+
45+
Maintenance
46+
-----------
47+
* Require h5py 2.10 for Windows + Python < 3.6 to resolve unexpected dtypes
48+
in Minc2 data (pr/804) (CM, reviewed by YOH)
49+
50+
API changes and deprecations
51+
----------------------------
52+
* Deprecate ``nicom.dicomwrappers.Wrapper.get_affine()`` in favor of ``affine``
53+
property; final removal in nibabel 4.0 (pr/796) (YOH, reviewed by CM)
54+
2855
2.5.0 (Sunday 4 August 2019)
2956
============================
3057

azure-pipelines.yml

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ jobs:
1111
py35-x64:
1212
PYTHON_VERSION: '3.5'
1313
PYTHON_ARCH: 'x64'
14+
py35-h5py-check:
15+
PYTHON_VERSION: '3.5'
16+
PYTHON_ARCH: 'x64'
17+
PYTHONHASHSEED: 283137131
18+
DEPENDS: "h5py==2.9.0"
1419
py36-x86:
1520
PYTHON_VERSION: '3.6'
1621
PYTHON_ARCH: 'x86'

doc/source/coordinate_systems.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ From scanner to subject
215215

216216
If the subject is lying in the usual position for a brain scan, face up
217217
and head first in the scanner, then scanner-left/right is also the left-right
218-
axis of the subject's head, scanner-floor/ceiling is the anterior-posterior
218+
axis of the subject's head, scanner-floor/ceiling is the posterior-anterior
219219
axis of the head and scanner-bore is the inferior-superior axis of the head.
220220

221221
Sometimes the subject is not lying in the standard position. For example, the
@@ -231,14 +231,14 @@ position of the subject. The most common subject-centered scanner coordinate
231231
system in neuroimaging is called "scanner RAS" (right, anterior, superior).
232232
Here the scanner axes are reordered and flipped so that the first axis is the
233233
scanner axis that is closest to the left to right axis of the subject, the
234-
second is the closest scanner axis to the anterior-posterior axis of the
234+
second is the closest scanner axis to the posterior-anterior axis of the
235235
subject, and the third is the closest scanner axis to the inferior-superior
236236
axis of the subject. For example, if the subject was lying face to the right
237237
in the scanner, then the first (X) axis of the reference system would be
238238
scanner-floor/ceiling, but reversed so that positive values are towards the
239239
floor. This axis goes from left to right in the subject, with positive values
240240
to the right. The second (Y) axis would be scanner-left/right
241-
(anterior-posterior in the subject), and the Z axis would be scanner-bore
241+
(posterior-anterior in the subject), and the Z axis would be scanner-bore
242242
(inferior-superior).
243243

244244
Naming reference spaces

doc/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ contributed code and discussion (in rough order of appearance):
9898
* Matt Cieslak
9999
* Egor Pafilov
100100
* Jath Palasubramaniam
101+
* Henry Braun
101102

102103
License reprise
103104
===============

nibabel-data/nitest-dicom

Submodule nitest-dicom added at ff6844f

nibabel/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
img2 = nib.load('other_file.nii.gz')
2424
img3 = nib.load('spm_file.img')
2525
26-
data = img1.get_data()
26+
data = img1.get_fdata()
2727
affine = img1.affine
2828
2929
print(img1)

nibabel/_h5py_compat.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys
2+
import os
3+
from .optpkg import optional_package
4+
5+
# PY35: A bug affected Windows installations of h5py in Python3 versions <3.6
6+
# due to random dictionary ordering, causing float64 data arrays to sometimes be
7+
# loaded as longdouble (also 64 bit on Windows). This caused stochastic failures
8+
# to correctly handle data caches, and possibly other subtle bugs we never
9+
# caught. This was fixed in h5py 2.10.
10+
# Please see https://github.com/nipy/nibabel/issues/665 for details.
11+
min_h5py = '2.10' if os.name == 'nt' and (3,) <= sys.version_info < (3, 6) else None
12+
h5py, have_h5py, setup_module = optional_package('h5py', min_version=min_h5py)

0 commit comments

Comments
 (0)