Skip to content

Commit 70588f2

Browse files
Merge branch 'master' into enh/cifti2_axes
2 parents 459fa88 + abc2f43 commit 70588f2

File tree

14 files changed

+124
-39
lines changed

14 files changed

+124
-39
lines changed

COPYING

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ documentation is covered by the MIT license.
1818

1919
The MIT License
2020

21-
Copyright (c) 2009-2014 Matthew Brett <matthew.brett@gmail.com>
21+
Copyright (c) 2009-2019 Matthew Brett <matthew.brett@gmail.com>
2222
Copyright (c) 2010-2013 Stephan Gerhard <git@unidesign.ch>
2323
Copyright (c) 2006-2014 Michael Hanke <michael.hanke@gmail.com>
2424
Copyright (c) 2011 Christian Haselgrove <christian.haselgrove@umassmed.edu>
2525
Copyright (c) 2010-2011 Jarrod Millman <jarrod.millman@gmail.com>
26-
Copyright (c) 2011-2014 Yaroslav Halchenko <debian@onerussian.com>
26+
Copyright (c) 2011-2019 Yaroslav Halchenko <debian@onerussian.com>
27+
Copyright (c) 2015-2019 Chris Markiewicz <effigies@gmail.com>
2728

2829
Permission is hereby granted, free of charge, to any person obtaining a copy
2930
of this software and associated documentation files (the "Software"), to deal

Changelog

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ The full VCS changelog is available here:
1818
Nibabel releases
1919
****************
2020

21-
Most work on NiBabel so far has been by Matthew Brett (MB), Michael Hanke (MH)
22-
Ben Cipollini (BC), Marc-Alexandre Côté (MC), Chris Markiewicz (CM), Stephan
23-
Gerhard (SG), Eric Larson (EL), Yaroslav Halchenko (YOH) and Chris Cheng (CC).
21+
Most work on NiBabel so far has been by Matthew Brett (MB), Chris Markiewicz
22+
(CM), Michael Hanke (MH), Marc-Alexandre Côté (MC), Ben Cipollini (BC), Paul
23+
McCarthy (PM), Chris Cheng (CC), Yaroslav Halchenko (YOH), Satra Ghosh (SG),
24+
Eric Larson (EL), Demien Wasserman, and Stephan Gerhard.
2425

2526
References like "pr/298" refer to github pull request numbers.
2627

@@ -116,16 +117,16 @@ Enhancements
116117
* Simplfiy MGHImage and add footer fields (pr/569) (CM, reviewed by MB)
117118
* Force sform/qform codes to be ints, rather than numpy types (pr/575) (Paul
118119
McCarthy, reviewed by MB, CM)
119-
* Auto-fill color table in FreeSurfer annotation file (pr/592) (Paul McCarthy,
120+
* Auto-fill color table in FreeSurfer annotation file (pr/592) (PM,
120121
reviewed by CM, MB)
121122
* Set default intent code for CIFTI2 images (pr/604) (Mathias Goncalves,
122-
reviewed by CM, Satra Ghosh, MB, Tim Coalson)
123+
reviewed by CM, SG, MB, Tim Coalson)
123124
* Raise informative error on empty files (pr/611) (Pradeep Raamana, reviewed
124125
by CM, MB)
125126
* Accept degenerate filenames such as ``.nii`` (pr/621) (Dimitri
126127
Papadopoulos-Orfanos, reviewed by Yaroslav Halchenko)
127128
* Take advantage of ``IndexedGzipFile`` ``drop_handles`` flag to release
128-
filehandles by default (pr/614) (Paul McCarthy, reviewed by CM, MB)
129+
filehandles by default (pr/614) (PM, reviewed by CM, MB)
129130

130131
Bug fixes
131132
---------
@@ -135,7 +136,7 @@ Bug fixes
135136
CM, MB)
136137
* Accept lower-case orientation codes in TRK files (pr/600) (Kesshi Jordan,
137138
MB, reviewed by MB, MC, CM)
138-
* Annotation file reading (pr/592) (Paul McCarthy, reviewed by CM, MB)
139+
* Annotation file reading (pr/592) (PM, reviewed by CM, MB)
139140
* Fix buffer size calculation in ArraySequence (pr/597) (Serge Koudoro,
140141
reviewed by MC, MB, Eleftherios Garyfallidis, CM)
141142
* Resolve ``UnboundLocalError`` in Python 3 (pr/607) (Jakub Kaczmarzyk,
@@ -175,14 +176,14 @@ Bug fixes
175176

176177
* Set L/R labels in orthoview correctly (pr/564) (CM)
177178
* Defer use of ufunc / memmap test - allows "freezing" (pr/572) (MB, reviewed
178-
by Satra Ghosh)
179+
by SG)
179180
* Fix doctest failures with pre-release numpy (pr/582) (MB, reviewed by CM)
180181

181182
Maintenance
182183
-----------
183184

184-
* Update documentation around NIfTI qform/sform codes (pr/576) (Paul McCarthy,
185-
reviewed by MB, CM) + (pr/580) (Bennet Fauber, reviewed by Paul McCarthy)
185+
* Update documentation around NIfTI qform/sform codes (pr/576) (PM,
186+
reviewed by MB, CM) + (pr/580) (Bennet Fauber, reviewed by PM)
186187
* Skip precision test on macOS, newer numpy (pr/583) (MB, reviewed by CM)
187188
* Simplify AppVeyor script, removing conda (pr/584) (MB, reviewed by CM)
188189

@@ -192,12 +193,11 @@ Maintenance
192193
New features
193194
------------
194195

195-
* CIFTI support (pr/249) (Satra Ghosh, Michiel Cottaar, BC, CM, Demian
196-
Wassermann, MB)
196+
* CIFTI support (pr/249) (SG, Michiel Cottaar, BC, CM, Demian Wasserman, MB)
197197
* Support for MRtrix TCK streamlines file format (pr/486) (MC, reviewed by
198198
MB, Arnaud Bore, J-Donald Tournier, Jean-Christophe Houde)
199199
* Added ``get_fdata()`` as default method to retrieve scaled floating point
200-
data from ``DataobjImage``s (pr/551) (MB, reviewed by CM, Satra Ghosh)
200+
data from ``DataobjImage``s (pr/551) (MB, reviewed by CM, SG)
201201
202202
Enhancements
203203
------------
@@ -211,19 +211,19 @@ Enhancements
211211
* Allow dtype specifiers as fileslice input (pr/485) (MB)
212212
* Support "headerless" ArrayProxy specification, enabling memory-efficient
213213
ArrayProxy reshaping (pr/521) (CM)
214-
* Allow unknown NIfTI intent codes, add FSL codes (pr/528) (Paul McCarthy)
214+
* Allow unknown NIfTI intent codes, add FSL codes (pr/528) (PM)
215215
* Improve error handling for ``img.__getitem__`` (pr/533) (Ariel Rokem)
216216
* Delegate reorientation to SpatialImage classes (pr/544) (Mark Hymers, CM,
217217
reviewed by MB)
218218
* Enable using ``indexed_gzip`` to reduce memory usage when reading from
219-
gzipped NIfTI and MGH files (pr/552) (Paul McCarthy, reviewed by MB, CM)
219+
gzipped NIfTI and MGH files (pr/552) (PM, reviewed by MB, CM)
220220

221221
Bug fixes
222222
---------
223223

224224
* Miscellaneous MINC reader fixes (pr/493) (Robert D. Vincent, reviewed by CM,
225225
MB)
226-
* Fix corner case in ``wrapstruct.get`` (pr/516) (Paul McCarthy, reviewed by
226+
* Fix corner case in ``wrapstruct.get`` (pr/516) (PM, reviewed by
227227
CM, MB)
228228

229229
Maintenance
@@ -524,7 +524,7 @@ Special thanks to Chris Burns, Jarrod Millman and Yaroslav Halchenko.
524524

525525
* New feature release
526526
* Python 3.2 support
527-
* Substantially enhanced gifti reading support (SG)
527+
* Substantially enhanced gifti reading support (Stephan Gerhard)
528528
* Refactoring of trackvis read / write to allow reading and writing of voxel
529529
points and mm points in tracks. Deprecate use of negative voxel sizes;
530530
set voxel_order field in trackvis header. Thanks to Chris Filo

doc/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ discussions, release procedure and more.
2727
Authors and Contributors
2828
========================
2929

30-
The main authors of NiBabel are `Matthew Brett`_, `Michael Hanke`_, `Ben
31-
Cipollini`_, `Marc-Alexandre Côté`_, Chris Markiewicz, `Stephan Gerhard`_ and
32-
`Eric Larson`_. The authors are grateful to the following people who have
30+
Most work on NiBabel so far has been by `Matthew Brett`_, Chris Markiewicz,
31+
`Michael Hanke`_, `Marc-Alexandre Côté`_, `Ben Cipollini`_, Paul McCarthy and
32+
Chris Cheng. The authors are grateful to the following people who have
3333
contributed code and discussion (in rough order of appearance):
3434

3535
* `Yaroslav O. Halchenko`_

nibabel/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
192192

193193
# Main setup parameters
194194
NAME = 'nibabel'
195-
MAINTAINER = "Matthew Brett, Michael Hanke, Eric Larson, Chris Markiewicz"
195+
MAINTAINER = "Chris Markiewicz"
196196
MAINTAINER_EMAIL = "neuroimaging@python.org"
197197
DESCRIPTION = description
198198
LONG_DESCRIPTION = long_description

nibabel/nicom/dicomreaders.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def slices_to_series(wrappers):
146146
out_vol_lists = []
147147
for vol_list in volume_lists:
148148
if len(vol_list) > 1:
149-
vol_list.sort(_slice_sorter)
149+
vol_list.sort(key=_slice_sorter)
150150
zs = [s.slice_indicator for s in vol_list]
151151
if len(set(zs)) < len(zs): # not unique zs
152152
# third pass
@@ -163,12 +163,12 @@ def slices_to_series(wrappers):
163163
return out_vol_lists
164164

165165

166-
def _slice_sorter(s1, s2):
167-
return cmp(s1.slice_indicator, s2.slice_indicator)
166+
def _slice_sorter(s):
167+
return s.slice_indicator
168168

169169

170-
def _instance_sorter(s1, s2):
171-
return cmp(s1.instance_number, s2.instance_number)
170+
def _instance_sorter(s):
171+
return s.instance_number
172172

173173

174174
def _third_pass(wrappers):
@@ -182,9 +182,9 @@ def _third_pass(wrappers):
182182
'missing InstanceNumber')
183183
if len(set(inos)) < len(inos):
184184
raise DicomReadError(msg_fmt % 'some or all slices with '
185-
'the sane InstanceNumber')
185+
'the same InstanceNumber')
186186
# sort by instance number
187-
wrappers.sort(_instance_sorter)
187+
wrappers.sort(key=_instance_sorter)
188188
# start loop, in which we start a new volume, each time we see a z
189189
# we've seen already in the current volume
190190
dw = wrappers[0]

nibabel/nicom/dicomwrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def voxel_sizes(self):
201201
zs = self.get('SpacingBetweenSlices')
202202
if zs is None:
203203
zs = self.get('SliceThickness')
204-
if zs is None:
204+
if zs is None or zs == '':
205205
zs = 1
206206
# Protect from python decimals in pydicom 0.9.7
207207
zs = float(zs)

nibabel/nicom/tests/data/0.dcm

221 KB
Binary file not shown.

nibabel/nicom/tests/data/1.dcm

221 KB
Binary file not shown.
40.7 KB
Binary file not shown.

nibabel/nicom/tests/test_dicomreaders.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
33
"""
44

5+
from os.path import join as pjoin, abspath
6+
57
import numpy as np
68

79
from .. import dicomreaders as didr
@@ -68,3 +70,12 @@ def test_passing_kwds():
6870
IO_DATA_PATH,
6971
csa_glob,
7072
dicom_kwargs=dict(force=True))
73+
74+
@dicom_test
75+
def test_slices_to_series():
76+
dicom_files = (pjoin(IO_DATA_PATH, "%d.dcm" % i) for i in range(2))
77+
wrappers = [didr.wrapper_from_file(f) for f in dicom_files]
78+
series = didr.slices_to_series(wrappers)
79+
assert_equal(len(series), 1)
80+
assert_equal(len(series[0]), 2)
81+

0 commit comments

Comments
 (0)