Skip to content

Commit 8522d9d

Browse files
committed
Merge pull request #377 from effigies/candidate2.0.2
REL: Bugfix release 2.0.2
2 parents 1287aaf + 1eca265 commit 8522d9d

38 files changed

+558
-1516
lines changed

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ Basile Pinsard <[email protected]> bpinsard <[email protected]>
2929
3030
Ben Cipollini <[email protected]> Ben Cipollini <[email protected]>
3131
Chris Markiewicz <[email protected]> Christopher J. Markiewicz <[email protected]>
32+
Chris Markiewicz <[email protected]> Christopher J. Markiewicz <[email protected]>
33+
Chris Markiewicz <[email protected]> Chris Johnson <[email protected]>

.travis.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ env:
88
global:
99
- DEPENDS="numpy scipy matplotlib h5py"
1010
- PYDICOM=1
11+
- INSTALL_TYPE="setup"
1112
python:
1213
- 2.6
1314
- 3.2
1415
- 3.3
1516
- 3.4
17+
- 3.5
1618
matrix:
1719
include:
1820
- python: 2.7
@@ -26,20 +28,37 @@ matrix:
2628
- python: 2.7
2729
env:
2830
- DEPENDS="numpy==1.5.1 pydicom==0.9.7"
31+
# pydicom 1.0 (currently unreleased)
32+
- python: 2.7
33+
env:
34+
- PYDICOM="v1.0"
2935
# Documentation doctests
3036
- python: 2.7
3137
env:
3238
- DOC_DOC_TEST=1
39+
- python: 2.7
40+
env:
41+
- INSTALL_TYPE=sdist
42+
- python: 2.7
43+
env:
44+
- INSTALL_TYPE=wheel
45+
- python: 2.7
46+
env:
47+
- INSTALL_TYPE=requirements
3348
before_install:
49+
- source tools/travis_tools.sh
3450
- virtualenv --python=python venv
3551
- source venv/bin/activate
3652
- python --version # just to check
37-
- pip install nose # always
38-
- pip install --no-index -f http://travis-wheels.scikit-image.org $DEPENDS
53+
- pip install -U pip # upgrade to latest pip to find 3.5 wheels
54+
- retry pip install nose # always
55+
- wheelhouse_pip_install $DEPENDS
3956
# pydicom <= 0.9.8 doesn't install on python 3
4057
- if [ "${TRAVIS_PYTHON_VERSION:0:1}" == "2" ]; then
4158
if [ "$PYDICOM" == "1" ]; then
4259
pip install pydicom;
60+
elif [ "$PYDICOM" == "v1.0" ]; then
61+
pip install git+https://github.com/darcymason/pydicom.git@43f278444d5cb2e4648135d3edcd430c363c6975;
4362
fi
4463
fi
4564
- if [ "${COVERAGE}" == "1" ]; then
@@ -51,7 +70,21 @@ before_install:
5170
fi
5271
# command to install dependencies
5372
install:
54-
- python setup.py install
73+
- |
74+
if [ "$INSTALL_TYPE" == "setup" ]; then
75+
python setup.py install
76+
elif [ "$INSTALL_TYPE" == "sdist" ]; then
77+
python setup_egg.py egg_info # check egg_info while we're here
78+
python setup_egg.py sdist
79+
wheelhouse_pip_install dist/*.tar.gz
80+
elif [ "$INSTALL_TYPE" == "wheel" ]; then
81+
pip install wheel
82+
python setup_egg.py bdist_wheel
83+
wheelhouse_pip_install dist/*.whl
84+
elif [ "$INSTALL_TYPE" == "requirements" ]; then
85+
wheelhouse_pip_install -r requirements.txt
86+
python setup.py install
87+
fi
5588
# Point to nibabel data directory
5689
- export NIBABEL_DATA_DIR="$PWD/nibabel-data"
5790
# command to run tests, e.g. python setup.py test

Changelog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ and Stephan Gerhard (SG).
2424

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

27+
* 2.0.2 (Monday 23 November 2015)
28+
29+
* Fix for integer overflow on large images (pr/325) (MB);
30+
* Fix for Freesurfer nifti files with unusual dimensions (pr/332) (Chris
31+
Markiewicz);
32+
* Fix typos on benchmarks and tests (pr/336, pr/340, pr/347) (Chris
33+
Markiewicz);
34+
* Fix Windows install script (pr/339) (MB);
35+
* Support for Python 3.5 (pr/363) (MB) and numpy 1.10 (pr/358) (Chris
36+
Markiewicz);
37+
* Update pydicom imports to permit version 1.0 (pr/379) (Chris Markiewicz);
38+
* Workaround for Python 3.5.0 gzip regression (pr/383) (Ben Cipollini).
39+
* tripwire.TripWire object now raises subclass of AttributeError when trying
40+
to get an attribute, rather than a direct subclass of Exception. This
41+
prevents Python 3.5 triggering the tripwire when doing inspection prior to
42+
running doctests.
43+
* Minor API change for tripwire.TripWire object; code that checked for
44+
AttributeError will now also catch TripWireError.
45+
2746
* 2.0.1 (Saturday 27 June 2015)
2847

2948
Contributions from Ben Cipollini, Chris Markiewicz, Alexandre Gramfort,

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include AUTHOR COPYING Makefile* MANIFEST.in setup* README.*
2-
include Changelog TODO
2+
include Changelog TODO requirements.txt
33
recursive-include doc *
44
recursive-include bin *
55
recursive-include tools *

doc/source/devel/advanced_testing.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. -*- mode: rst -*-
2+
.. ex: set sts=4 ts=4 sw=4 et tw=79:
3+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
4+
#
5+
# See COPYING file distributed along with the NiBabel package for the
6+
# copyright and license terms.
7+
#
8+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
9+
10+
.. _advanced_testing:
11+
12+
************
13+
Advanced Testing
14+
************
15+
16+
Setup
17+
-----
18+
19+
Before running advanced tests, please update all submodules of nibabel, by running ``git submodule update --init``
20+
21+
22+
Long-running tests
23+
------------------
24+
25+
Long-running tests are not enabled by default, and can be resource-intensive. To run these tests:
26+
27+
* Set environment variable ``NIPY_EXTRA_TESTS=slow``
28+
* Run ``nosetests``.
29+
30+
Note that some tests may require a machine with >4GB of RAM.
31+
32+
.. include:: ../links_names.txt

doc/source/devel/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Developer documentation page
1414
add_image_format
1515
devdiscuss
1616
make_release
17+
advanced_testing

doc/source/devel/make_release.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,9 @@ Release checklist
130130
* Check on different platforms, particularly windows and PPC. Look at the
131131
`nipy buildbot`_ automated test runs for this.
132132

133-
* Check the documentation doctests::
133+
* Check the documentation doctests (forcing Python 2)::
134134

135-
cd doc
136-
make doctest
137-
cd ..
135+
make -C doc doctest SPHINXBUILD="python $(which sphinx-build)"
138136

139137
This should also be tested by `nibabel on travis`_.
140138

doc/source/index.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ contributed code and discussion (in rough order of appearance):
4747
* Bago Amirbekian
4848
* Brendan Moloney
4949
* Félix C. Morency
50-
* Chris Johnson
50+
* Chris Markiewicz
5151
* JB Poline
5252
* Nolan Nichols
5353
* Nguyen, Ly
@@ -61,8 +61,7 @@ contributed code and discussion (in rough order of appearance):
6161
* Demian Wassermann
6262
* Philippe Gervais
6363
* Justin Lecher
64-
* Ben Cippolini
65-
* Chris Markiewicz
64+
* `Ben Cipollini`_
6665
* Clemens C. C. Bauer
6766

6867
License reprise

doc/source/installation.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ Just install the modules by invoking::
114114
If sudo is not configured (or even installed) you might have to use
115115
``su`` instead.
116116

117-
Now fire up Python and try importing the module to see if everything is fine.
117+
118+
Validating your install
119+
-----------------------
120+
121+
For a basic test of your installation, fire up Python and try importing the module to see if everything is fine.
118122
It should look something like this::
119123

120124
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
@@ -123,4 +127,9 @@ It should look something like this::
123127
>>> import nibabel
124128
>>>
125129

130+
131+
To run the nibabel test suite, from the terminal run ``nosetests nibabel`` or ``python -c "import nibabel; nibabel.test()``.
132+
133+
To run an extended test suite that validates ``nibabel`` for long-running and resource-intensive cases, please see :ref:`advanced_testing`.
134+
126135
.. include:: links_names.txt

doc/source/links_names.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
and name substitutions. It may be included in many files,
66
therefore it should only contain link targets and name
77
substitutions. Try grepping for "^\.\. _" to find plausible
8-
candidates for this list.
8+
candidates for this list.
99
1010
1111
.. NOTE: reST targets are
@@ -233,6 +233,7 @@
233233
.. _Michael Hanke: http://mih.voxindeserto.de
234234
.. _Gaël Varoquaux: http://gael-varoquaux.info/
235235
.. _Stephan Gerhard: http://www.unidesign.ch
236+
.. _Ben Cipollini: http://bcipolli.github.io/
236237

237238
.. Substitutions
238239
.. |emdash| unicode:: U+02014

nibabel/benchmarks/bench_array_to_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def bench_array_to_file():
5050
mtime = measure('array_to_file(arr, BytesIO(), np.int16)', repeat)
5151
print('%30s %6.2f' % ('Save float64 to int16, infs', mtime))
5252
# Int16 input, float output
53-
arr = np.random.random_integers(low=-1000,high=-1000, size=img_shape)
53+
arr = np.random.random_integers(low=-1000, high=1000, size=img_shape)
5454
arr = arr.astype(np.int16)
5555
mtime = measure('array_to_file(arr, BytesIO(), np.float32)', repeat)
5656
print('%30s %6.2f' % ('Save Int16 to float32', mtime))

nibabel/benchmarks/bench_finite_range.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def bench_finite_range():
4242
mtime = measure('finite_range(arr)', repeat)
4343
print('%30s %6.2f' % ('float64 many infs', mtime))
4444
# Int16 input, float output
45-
arr = np.random.random_integers(low=-1000,high=-1000, size=img_shape)
45+
arr = np.random.random_integers(low=-1000, high=1000, size=img_shape)
4646
arr = arr.astype(np.int16)
4747
mtime = measure('finite_range(arr)', repeat)
4848
print('%30s %6.2f' % ('int16', mtime))

nibabel/benchmarks/bench_load_save.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def bench_load_save():
5656
mtime = measure('img.from_file_map(img.file_map)', repeat)
5757
print('%30s %6.2f' % ('Load from int16, NaNs', mtime))
5858
# Int16 input, float output
59-
arr = np.random.random_integers(low=-1000,high=-1000, size=img_shape)
59+
arr = np.random.random_integers(low=-1000, high=1000, size=img_shape)
6060
arr = arr.astype(np.int16)
6161
img = Nifti1Image(arr, np.eye(4))
6262
sio = BytesIO()

nibabel/fileslice.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,15 @@ def strided_scalar(shape, scalar=0.):
764764
strided_arr : array
765765
Array of shape `shape` for which all values == `scalar`, built by
766766
setting all strides of `strided_arr` to 0, so the scalar is broadcast
767-
out to the full array `shape`.
767+
out to the full array `shape`. `strided_arr` is flagged as not
768+
`writeable`.
769+
770+
The array is set read-only to avoid a numpy error when broadcasting -
771+
see https://github.com/numpy/numpy/issues/6491
768772
"""
769773
shape = tuple(shape)
770774
scalar = np.array(scalar)
771775
strides = [0] * len(shape)
772-
return np.lib.stride_tricks.as_strided(scalar, shape, strides)
776+
strided_scalar = np.lib.stride_tricks.as_strided(scalar, shape, strides)
777+
strided_scalar.flags.writeable = False
778+
return strided_scalar

nibabel/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
_version_major = 2
1010
_version_minor = 0
1111
_version_micro = 2
12-
_version_extra = 'dev'
13-
#_version_extra = ''
12+
#_version_extra = 'dev'
13+
_version_extra = ''
1414

1515
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
1616
__version__ = "%s.%s.%s%s" % (_version_major,

nibabel/nicom/dicomwrappers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ def wrapper_from_file(file_like, *args, **kwargs):
4949
dcm_w : ``dicomwrappers.Wrapper`` or subclass
5050
DICOM wrapper corresponding to DICOM data type
5151
"""
52-
import dicom
52+
try:
53+
from dicom import read_file
54+
except ImportError:
55+
from pydicom.dicomio import read_file
5356

5457
with BinOpener(file_like) as fobj:
55-
dcm_data = dicom.read_file(fobj, *args, **kwargs)
58+
dcm_data = read_file(fobj, *args, **kwargs)
5659
return wrapper_from_data(dcm_data)
5760

5861

nibabel/nicom/tests/test_csareader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ def test_csa_header_read():
3131
assert_true(csa.is_mosaic(hdr))
3232
# Get a shallow copy of the data, lacking the CSA marker
3333
# Need to do it this way because del appears broken in pydicom 0.9.7
34-
from dicom.dataset import Dataset
34+
try:
35+
from dicom.dataset import Dataset
36+
except ImportError:
37+
from pydicom.dataset import Dataset
3538
data2 = Dataset()
3639
for element in DATA:
3740
if (element.tag.group, element.tag.elem) != (0x29, 0x10):

nibabel/nicom/tests/test_dicomreaders.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ def test_passing_kwds():
4040
# Check that we correctly pass keywords to dicom
4141
dwi_glob = 'siemens_dwi_*.dcm.gz'
4242
csa_glob = 'csa*.bin'
43-
import dicom
43+
try:
44+
from dicom.filereader import InvalidDicomError
45+
except ImportError:
46+
from pydicom.filereader import InvalidDicomError
4447
for func in (didr.read_mosaic_dwi_dir, didr.read_mosaic_dir):
4548
data, aff, bs, gs = func(IO_DATA_PATH, dwi_glob)
4649
# This should not raise an error
@@ -49,14 +52,14 @@ def test_passing_kwds():
4952
dwi_glob,
5053
dicom_kwargs=dict(force=True))
5154
assert_array_equal(data, data2)
52-
# This should raise an error in dicom.read_file
55+
# This should raise an error in pydicom.dicomio.read_file
5356
assert_raises(TypeError,
5457
func,
5558
IO_DATA_PATH,
5659
dwi_glob,
5760
dicom_kwargs=dict(not_a_parameter=True))
5861
# These are invalid dicoms, so will raise an error unless force=True
59-
assert_raises(dicom.filereader.InvalidDicomError,
62+
assert_raises(InvalidDicomError,
6063
func,
6164
IO_DATA_PATH,
6265
csa_glob)

nibabel/nicom/tests/test_dicomwrappers.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@
99

1010
import numpy as np
1111

12+
have_dicom = True
1213
try:
13-
import dicom
14+
import dicom as pydicom
15+
read_file = pydicom.read_file
1416
except ImportError:
15-
have_dicom = False
16-
else:
17-
have_dicom = True
17+
try:
18+
import pydicom
19+
except ImportError:
20+
have_dicom = False
21+
else:
22+
from pydicom.dicomio import read_file
1823
dicom_test = np.testing.dec.skipif(not have_dicom,
1924
'could not import pydicom')
2025

@@ -32,8 +37,8 @@
3237
DATA_FILE = pjoin(IO_DATA_PATH, 'siemens_dwi_1000.dcm.gz')
3338
DATA_FILE_PHILIPS = pjoin(IO_DATA_PATH, 'philips_mprage.dcm.gz')
3439
if have_dicom:
35-
DATA = dicom.read_file(gzip.open(DATA_FILE))
36-
DATA_PHILIPS = dicom.read_file(gzip.open(DATA_FILE_PHILIPS))
40+
DATA = read_file(gzip.open(DATA_FILE))
41+
DATA_PHILIPS = read_file(gzip.open(DATA_FILE_PHILIPS))
3742
else:
3843
DATA = None
3944
DATA_PHILIPS = None
@@ -166,7 +171,7 @@ def test_wrapper_from_data():
166171

167172
@dicom_test
168173
def test_wrapper_args_kwds():
169-
# Test we can pass args, kwargs to dicom.read_file
174+
# Test we can pass args, kwargs to read_file
170175
dcm = didw.wrapper_from_file(DATA_FILE)
171176
data = dcm.get_data()
172177
# Passing in non-default arg for defer_size
@@ -177,7 +182,7 @@ def test_wrapper_args_kwds():
177182
assert_array_equal(data, dcm2.get_data())
178183
# Trying to read non-dicom file raises pydicom error, usually
179184
csa_fname = pjoin(IO_DATA_PATH, 'csa2_b0.bin')
180-
assert_raises(dicom.filereader.InvalidDicomError,
185+
assert_raises(pydicom.filereader.InvalidDicomError,
181186
didw.wrapper_from_file,
182187
csa_fname)
183188
# We can force the read, in which case rubbish returns

0 commit comments

Comments
 (0)