Skip to content

Commit 04ed870

Browse files
committed
Merge branch 'maint/3.0.x'
2 parents d9298ed + ff7c276 commit 04ed870

16 files changed

+92
-66
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ script:
136136
flake8 nibabel
137137
elif [ "${CHECK_TYPE}" == "doc" ]; then
138138
cd doc
139-
make html;
140-
make doctest;
139+
make html && make doctest
141140
elif [ "${CHECK_TYPE}" == "test" ]; then
142141
# Change into an innocuous directory and find tests from installation
143142
mkdir for_testing

.zenodo.json

+3
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@
323323
"name": "Reddam, Venkateswara Reddy",
324324
"orcid": "0000-0001-6817-2966"
325325
},
326+
{
327+
"name": "Baratz, Zvi"
328+
},
326329
{
327330
"name": "freec84"
328331
}

Changelog

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

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

28+
3.0.2 (Monday 9 March 2020)
29+
===========================
30+
31+
Bug fixes
32+
---------
33+
* Attempt to find versioneer version when building docs (pr/894) (CM)
34+
* Delay import of h5py until neded (backport of pr/889) (YOH, reviewed by CM)
35+
36+
Maintenance
37+
-----------
38+
* Fix typo in documentation (backport of pr/893) (Zvi Baratz, reviewed by CM)
39+
* Set minimum matplotlib to 1.5.3 to ensure wheels are available on all
40+
supported Python versions. (backport of pr/887) (CM)
41+
* Remove ``pyproject.toml`` for now. (issue/859) (CM)
42+
43+
2844
3.0.1 (Monday 27 January 2020)
2945
==============================
3046

@@ -79,7 +95,7 @@ Enhancements
7995

8096
Bug fixes
8197
---------
82-
* Sliced ``Tractogram``s no longer ``apply_affine`` to the original
98+
* Sliced ``Tractogram``\s no longer ``apply_affine`` to the original
8399
``Tractogram``'s streamlines. (pr/811) (MC, reviewed by Serge Koudoro,
84100
Philippe Poulin, CM, MB)
85101
* Change strings with invalid escapes to raw strings (pr/827) (EL, reviewed
@@ -98,7 +114,7 @@ Maintenance
98114
API changes and deprecations
99115
----------------------------
100116
* Fully remove deprecated ``checkwarns`` and ``minc`` modules. (pr/852) (CM)
101-
* The ``keep_file_open`` argument to file load operations and ``ArrayProxy``s
117+
* The ``keep_file_open`` argument to file load operations and ``ArrayProxy``\s
102118
no longer acccepts the value ``"auto"``, raising a ``ValueError``. (pr/852)
103119
(CM)
104120
* Deprecate ``ArraySequence.data`` in favor of ``ArraySequence.get_data()``,
@@ -420,7 +436,7 @@ New features
420436
* Support for MRtrix TCK streamlines file format (pr/486) (MC, reviewed by
421437
MB, Arnaud Bore, J-Donald Tournier, Jean-Christophe Houde)
422438
* Added ``get_fdata()`` as default method to retrieve scaled floating point
423-
data from ``DataobjImage``s (pr/551) (MB, reviewed by CM, SG)
439+
data from ``DataobjImage``\s (pr/551) (MB, reviewed by CM, SG)
424440

425441
Enhancements
426442
------------

doc/source/conf.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121

2222
import sys
2323
import os
24-
try:
25-
from configparser import ConfigParser
26-
except ImportError:
27-
from ConfigParser import ConfigParser # PY2
24+
from runpy import run_path
25+
from configparser import ConfigParser
2826

2927
# Check for external Sphinx extensions we depend on
3028
try:
@@ -51,9 +49,7 @@
5149
# -- General configuration ----------------------------------------------------
5250

5351
# We load the nibabel release info into a dict by explicit execution
54-
rel = {}
55-
with open(os.path.join('..', '..', 'nibabel', 'info.py'), 'r') as fobj:
56-
exec(fobj.read(), rel)
52+
rel = run_path(os.path.join('..', '..', 'nibabel', 'info.py'))
5753

5854
# Write long description from info
5955
with open('_long_description.inc', 'wt') as fobj:
@@ -62,10 +58,7 @@
6258
# Load metadata from setup.cfg
6359
config = ConfigParser()
6460
config.read(os.path.join('..', '..', 'setup.cfg'))
65-
try:
66-
metadata = config['metadata']
67-
except AttributeError:
68-
metadata = dict(config.items('metadata')) # PY2
61+
metadata = config['metadata']
6962

7063
# Add any Sphinx extension module names here, as strings. They can be
7164
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.

doc/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ contributed code and discussion (in rough order of appearance):
105105
* Dorota Jarecka
106106
* Chris Gorgolewski
107107
* Benjamin C Darwin
108+
* Zvi Baratz
108109

109110
License reprise
110111
===============

doc/tools/build_modref_templates.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# stdlib imports
66
import sys
77
import re
8+
import os
89
from os.path import join as pjoin
910

1011
# local imports
@@ -48,12 +49,25 @@ def abort(error):
4849

4950
installed_version = V(module.__version__)
5051

51-
info_file = pjoin('..', package, 'info.py')
52-
info_lines = open(info_file).readlines()
53-
source_version = '.'.join([v.split('=')[1].strip(" '\n.")
54-
for v in info_lines if re.match(
55-
'^_version_(major|minor|micro|extra)', v
56-
)])
52+
version_file = pjoin('..', package, '_version.py')
53+
source_version = None
54+
if os.path.exists(version_file):
55+
# Versioneer
56+
from runpy import run_path
57+
try:
58+
source_version = run_path(version_file)['get_versions']()['version']
59+
except (FileNotFoundError, KeyError):
60+
pass
61+
if source_version == '0+unknown':
62+
source_version = None
63+
if source_version is None:
64+
# Legacy fall-back
65+
info_file = pjoin('..', package, 'info.py')
66+
info_lines = open(info_file).readlines()
67+
source_version = '.'.join([v.split('=')[1].strip(" '\n.")
68+
for v in info_lines if re.match(
69+
'^_version_(major|minor|micro|extra)', v
70+
)])
5771
print('***', source_version)
5872

5973
if source_version != installed_version:
@@ -68,6 +82,7 @@ def abort(error):
6882
r'.*test.*$',
6983
r'\.info.*$',
7084
r'\.pkg_info.*$',
85+
r'\.py3k.*$',
7186
]
7287
docwriter.write_api_docs(outdir)
7388
docwriter.write_index(outdir, 'index', relative_to=outdir)

nibabel/affines.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def obliquity(affine):
306306
This implementation is inspired by `AFNI's implementation
307307
<https://github.com/afni/afni/blob/b6a9f7a21c1f3231ff09efbd861f8975ad48e525/src/thd_coords.c#L660-L698>`_.
308308
For further details about *obliquity*, check `AFNI's documentation
309-
<https://sscc.nimh.nih.gov/sscc/dglen/Obliquity>_.
309+
<https://sscc.nimh.nih.gov/sscc/dglen/Obliquity>`_.
310310
311311
Parameters
312312
----------

nibabel/brikhead.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __init__(self, file_like, header, *, mmap=True, keep_file_open=None):
248248
a new file handle is created every time the image is accessed.
249249
If ``file_like`` refers to an open file handle, this setting has no
250250
effect. The default value (``None``) will result in the value of
251-
``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT` being used.
251+
``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT`` being used.
252252
"""
253253
super(AFNIArrayProxy, self).__init__(file_like,
254254
header,
@@ -530,7 +530,7 @@ def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
530530
a new file handle is created every time the image is accessed.
531531
If ``file_like`` refers to an open file handle, this setting has no
532532
effect. The default value (``None``) will result in the value of
533-
``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT` being used.
533+
``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT`` being used.
534534
"""
535535
with file_map['header'].get_prepare_fileobj('rt') as hdr_fobj:
536536
hdr = klass.header_class.from_fileobj(hdr_fobj)
@@ -550,6 +550,7 @@ def filespec_to_file_map(klass, filespec):
550550
afni.nimh.nih.gov/pub/dist/doc/program_help/README.compression.html.
551551
Thus, if you have AFNI files my_image.HEAD and my_image.BRIK.gz and you
552552
want to load the AFNI BRIK / HEAD pair, you can specify:
553+
553554
* The HEAD filename - e.g., my_image.HEAD
554555
* The BRIK filename w/o compressed extension - e.g., my_image.BRIK
555556
* The full BRIK filename - e.g., my_image.BRIK.gz

nibabel/cifti2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
Cifti2TransformationMatrixVoxelIndicesIJKtoXYZ,
2727
Cifti2Vertices, Cifti2Volume, CIFTI_BRAIN_STRUCTURES,
2828
Cifti2HeaderError, CIFTI_MODEL_TYPES, load, save)
29-
from .cifti2_axes import (Axis, BrainModelAxis, ParcelsAxis, SeriesAxis, LabelAxis, ScalarAxis)
29+
from .cifti2_axes import (Axis, BrainModelAxis, ParcelsAxis, SeriesAxis, LabelAxis, ScalarAxis)

nibabel/cifti2/cifti2.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _to_xml_element(self):
171171

172172

173173
class Cifti2LabelTable(xml.XmlSerializable, MutableMapping):
174-
""" CIFTI-2 label table: a sequence of ``Cifti2Label``s
174+
""" CIFTI-2 label table: a sequence of ``Cifti2Label``\s
175175
176176
* Description - Used by NamedMap when IndicesMapToDataType is
177177
"CIFTI_INDEX_TYPE_LABELS" in order to associate names and display colors
@@ -926,8 +926,8 @@ class Cifti2MatrixIndicesMap(xml.XmlSerializable, MutableSequence):
926926
* Text Content: [NA]
927927
* Parent Element - Matrix
928928
929-
Attribute
930-
---------
929+
Attributes
930+
----------
931931
applies_to_matrix_dimension : list of ints
932932
Dimensions of this matrix that follow this mapping
933933
indices_map_to_data_type : str one of CIFTI_MAP_TYPES

nibabel/cifti2/cifti2_axes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
(except for SeriesAxis objects, which have to remain monotonically increasing or decreasing).
2424
2525
Creating new CIFTI-2 axes
26-
-----------------------
26+
-------------------------
2727
New Axis objects can be constructed by providing a description for what is contained
2828
in each row/column of the described tensor. For each Axis sub-class this descriptor is:
2929
@@ -250,7 +250,7 @@ def __init__(self, name, voxel=None, vertex=None, affine=None,
250250
factory methods:
251251
252252
- :py:meth:`~BrainModelAxis.from_mask`: creates surface or volumetric BrainModelAxis axis
253-
from respectively 1D or 3D masks
253+
from respectively 1D or 3D masks
254254
- :py:meth:`~BrainModelAxis.from_surface`: creates a surface BrainModelAxis axis
255255
256256
The resulting BrainModelAxis axes can be concatenated by adding them together.

nibabel/gifti/gifti.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,21 @@ class GiftiCoordSystem(xml.XmlSerializable):
207207
Attributes
208208
----------
209209
dataspace : int
210-
From the spec: "Contains the stereotaxic space of a DataArray's data
210+
From the spec: Contains the stereotaxic space of a DataArray's data
211211
prior to application of the transformation matrix. The stereotaxic
212212
space should be one of:
213-
NIFTI_XFORM_UNKNOWN
214-
NIFTI_XFORM_SCANNER_ANAT
215-
NIFTI_XFORM_ALIGNED_ANAT
216-
NIFTI_XFORM_TALAIRACH
217-
NIFTI_XFORM_MNI_152"
213+
214+
- NIFTI_XFORM_UNKNOWN
215+
- NIFTI_XFORM_SCANNER_ANAT
216+
- NIFTI_XFORM_ALIGNED_ANAT
217+
- NIFTI_XFORM_TALAIRACH
218+
- NIFTI_XFORM_MNI_152
219+
218220
xformspace : int
219221
Spec: "Contains the stereotaxic space of a DataArray's data after
220222
application of the transformation matrix. See the DataSpace element for
221223
a list of stereotaxic spaces."
224+
222225
xform : array-like shape (4, 4)
223226
Affine transformation matrix
224227
"""

nibabel/nifti1.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1775,18 +1775,18 @@ def __init__(self, dataobj, affine, header=None,
17751775
self._affine2header()
17761776
# Copy docstring
17771777
__init__.__doc__ = analyze.AnalyzeImage.__init__.__doc__ + '''
1778-
Notes
1779-
-----
1780-
1781-
If both a `header` and an `affine` are specified, and the `affine` does
1782-
not match the affine that is in the `header`, the `affine` will be used,
1783-
but the ``sform_code`` and ``qform_code`` fields in the header will be
1784-
re-initialised to their default values. This is performed on the basis
1785-
that, if you are changing the affine, you are likely to be changing the
1786-
space to which the affine is pointing. The :meth:`set_sform` and
1787-
:meth:`set_qform` methods can be used to update the codes after an image
1788-
has been created - see those methods, and the :ref:`manual
1789-
<default-sform-qform-codes>` for more details. '''
1778+
Notes
1779+
-----
1780+
1781+
If both a `header` and an `affine` are specified, and the `affine` does
1782+
not match the affine that is in the `header`, the `affine` will be used,
1783+
but the ``sform_code`` and ``qform_code`` fields in the header will be
1784+
re-initialised to their default values. This is performed on the basis
1785+
that, if you are changing the affine, you are likely to be changing the
1786+
space to which the affine is pointing. The :meth:`set_sform` and
1787+
:meth:`set_qform` methods can be used to update the codes after an image
1788+
has been created - see those methods, and the :ref:`manual
1789+
<default-sform-qform-codes>` for more details. '''
17901790

17911791
def update_header(self):
17921792
''' Harmonize header with image data and affine

nibabel/streamlines/tck.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ class TckFile(TractogramFile):
3030
-----
3131
MRtrix (so its file format: TCK) considers streamlines coordinates
3232
to be in world space (RAS+ and mm space). MRtrix refers to that space
33-
as the "real" or "scanner" space [1]_.
33+
as the "real" or "scanner" space [#]_.
3434
35-
Moreover, when streamlines are mapped back to voxel space [2]_, a
35+
Moreover, when streamlines are mapped back to voxel space [#]_, a
3636
streamline point located at an integer coordinate (i,j,k) is considered
3737
to be at the center of the corresponding voxel. This is in contrast with
3838
TRK's internal convention where it would have referred to a corner.
3939
4040
NiBabel's streamlines internal representation follows the same
4141
convention as MRtrix.
4242
43-
References
44-
----------
45-
[1] http://www.nitrc.org/pipermail/mrtrix-discussion/2014-January/000859.html
46-
[2] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
43+
.. [#] http://www.nitrc.org/pipermail/mrtrix-discussion/2014-January/000859.html
44+
.. [#] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
4745
"""
4846
# Constants
4947
MAGIC_NUMBER = "mrtrix tracks"

nibabel/streamlines/tractogram.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ class Tractogram(object):
263263
choice as long as you provide the correct `affine_to_rasmm` matrix, at
264264
construction time. When applied to streamlines coordinates, that
265265
transformation matrix should bring the streamlines back to world space
266-
(RAS+ and mm space) [1]_.
266+
(RAS+ and mm space) [#]_.
267267
268-
Moreover, when streamlines are mapped back to voxel space [2]_, a
268+
Moreover, when streamlines are mapped back to voxel space [#]_, a
269269
streamline point located at an integer coordinate (i,j,k) is considered
270270
to be at the center of the corresponding voxel. This is in contrast with
271271
other conventions where it might have referred to a corner.
@@ -292,8 +292,8 @@ class Tractogram(object):
292292
293293
References
294294
----------
295-
[1] http://nipy.org/nibabel/coordinate_systems.html#naming-reference-spaces
296-
[2] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
295+
.. [#] http://nipy.org/nibabel/coordinate_systems.html#naming-reference-spaces
296+
.. [#] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
297297
"""
298298
def __init__(self, streamlines=None,
299299
data_per_streamline=None,
@@ -515,9 +515,9 @@ class LazyTractogram(Tractogram):
515515
choice as long as you provide the correct `affine_to_rasmm` matrix, at
516516
construction time. When applied to streamlines coordinates, that
517517
transformation matrix should bring the streamlines back to world space
518-
(RAS+ and mm space) [1]_.
518+
(RAS+ and mm space) [#]_.
519519
520-
Moreover, when streamlines are mapped back to voxel space [2]_, a
520+
Moreover, when streamlines are mapped back to voxel space [#]_, a
521521
streamline point located at an integer coordinate (i,j,k) is considered
522522
to be at the center of the corresponding voxel. This is in contrast with
523523
other conventions where it might have referred to a corner.
@@ -553,8 +553,8 @@ class LazyTractogram(Tractogram):
553553
554554
References
555555
----------
556-
[1] http://nipy.org/nibabel/coordinate_systems.html#naming-reference-spaces
557-
[2] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
556+
.. [#] http://nipy.org/nibabel/coordinate_systems.html#naming-reference-spaces
557+
.. [#] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
558558
"""
559559
def __init__(self, streamlines=None,
560560
data_per_streamline=None,

pyproject.toml

-3
This file was deleted.

0 commit comments

Comments
 (0)