Skip to content

Commit 14db79e

Browse files
authored
Merge pull request #1078 from nipy/rel/3.2.2
REL: 3.2.2
2 parents 3c2961b + 96e1229 commit 14db79e

24 files changed

+92
-37
lines changed

.github/CODE_OF_CONDUCT.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ implementation of methods, on finding technical solutions, establishing best pra
3030
otherwise. We are accepting of all who wish to take part in our activities, fostering an
3131
environment where anyone can participate and everyone can make a difference.
3232

33-
#### Be collaborative!
33+
#### Collaborative
3434

3535
Our work will be used by other people, and in turn we will depend on the work of others. When we
3636
make something for the benefit of others, we are willing to explain to others how it works, so that
3737
they can build on the work to make it even better. We are willing to provide constructive criticism
3838
on the work of others and accept criticism of our own work, as the experiences and skill sets of
3939
other members contribute to the whole of our efforts.
4040

41-
#### Be inquisitive!
41+
#### Inquisitive
4242

4343
Nobody knows everything! Asking questions early avoids many problems later, so questions are
4444
encouraged, though they may be directed to the appropriate forum. Those who are asked should be
@@ -51,7 +51,7 @@ efforts of others, keeping in mind that often-times the labor was completed simp
5151
the community. We are attentive in our communications, whether in person or online, and we are
5252
tactful when approaching differing views.
5353

54-
#### Be careful in the words that you choose:
54+
#### Careful in the words we choose
5555

5656
We value courtesy, kindness and inclusiveness in all our interactions. Therefore, we take
5757
responsibility for our own speech. In particular, we avoid:
@@ -66,7 +66,7 @@ responsibility for our own speech. In particular, we avoid:
6666
* Repeated harassment of others. In general, if someone asks you to stop, then stop.
6767
* Advocating for, or encouraging, any of the above behaviour.
6868

69-
#### Try to be concise in communication
69+
#### Concise
7070

7171
Keep in mind that what you write once will be read by many others. Writing a short email means
7272
people can understand the conversation as efficiently as possible. Even short emails should always

.mailmap

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Christopher J. Markiewicz <[email protected]> Christopher J. Markiewicz <e
2626
Cindee Madison <[email protected]> CindeeM <[email protected]>
2727
Cindee Madison <[email protected]> cindeem <[email protected]>
2828
Demian Wassermann <[email protected]> Demian Wassermann <[email protected]>
29-
Dimitri Papadopoulos Orfanos <[email protected]> Dimitri Papadopoulos <[email protected]>
29+
Dimitri Papadopoulos Orfanos <[email protected]> <[email protected]>
30+
Dimitri Papadopoulos Orfanos <[email protected]> <[email protected]>
3031
Eric Larson <[email protected]> Eric89GXL <[email protected]>
3132
Eric Larson <[email protected]> larsoner <[email protected]>
3233
Fernando Pérez-García <[email protected]> Fernando <[email protected]>

.zenodo.json

+18-7
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@
141141
"orcid": "0000-0001-9791-4404"
142142
},
143143
{
144-
"name": "Lepp\u00e4kangas, Jaakko"
144+
"name": "S\u00f3lon, Anibal"
145145
},
146146
{
147-
"name": "S\u00f3lon, Anibal"
147+
"name": "Lepp\u00e4kangas, Jaakko"
148148
},
149149
{
150150
"name": "van den Bosch, Jasper J.F."
@@ -228,6 +228,11 @@
228228
{
229229
"name": "St-Jean, Samuel"
230230
},
231+
{
232+
"affiliation": "CEA",
233+
"name": "Papadopoulos Orfanos, Dimitri",
234+
"orcid": "0000-0002-1242-8990"
235+
},
231236
{
232237
"name": "Panfilov, Egor",
233238
"orcid": "0000-0002-2500-6375"
@@ -286,6 +291,9 @@
286291
{
287292
"name": "Baratz, Zvi"
288293
},
294+
{
295+
"name": "Van, Andrew"
296+
},
289297
{
290298
"affiliation": "Hospital for Sick Children",
291299
"name": "Darwin, Benjamin C"
@@ -298,11 +306,6 @@
298306
{
299307
"name": "Gauthier, Carl"
300308
},
301-
{
302-
"affiliation": "CEA",
303-
"name": "Papadopoulos Orfanos, Dimitri",
304-
"orcid": "0000-0002-1242-8990"
305-
},
306309
{
307310
"name": "Solovey, Igor"
308311
},
@@ -326,6 +329,11 @@
326329
"affiliation": "National Technical University of Athens, Greece",
327330
"name": "Raktivan, Konstantinos"
328331
},
332+
{
333+
"affiliation": "Charite Universitatsmedizin Berlin, Germany",
334+
"name": "Waller, Lea",
335+
"orcid": "0000-0002-3239-6957"
336+
},
329337
{
330338
"name": "Cal\u00e1bkov\u00e1, Mark\u00e9ta"
331339
},
@@ -346,6 +354,9 @@
346354
{
347355
"name": "Roos, Thomas"
348356
},
357+
{
358+
"name": "Hrn\u010diar, Tom\u00e1\u0161"
359+
},
349360
{
350361
"affiliation": "National Institute of Mental Health and Neuro-Sciences, India",
351362
"name": "Reddam, Venkateswara Reddy",

Changelog

+30
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,36 @@ Eric Larson (EL), Demian Wassermann, Stephan Gerhard and Ross Markello (RM).
2525

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

28+
3.2.2 (Monday 7 February 2022)
29+
=================================
30+
31+
Bug fix release in the 3.2.x series.
32+
33+
Bug fixes
34+
---------
35+
* Reshape CIFTI-2 affines to 4x4 when encoded as row-major sequence (pr/1059)
36+
(Andrew Van, reviewed by CM)
37+
* Suggest nibabel.save() on calls to deprecated giftiio.write() (pr/1055)
38+
(Anibal Solon, reviewed by CM)
39+
* Various bugs and style issues detected by LGTM (pr/1043, pr/1048)
40+
(Dimitri Papadopoulos, reviewed by CM)
41+
* Resolve unclosed file warning in GiftiImage (pr/1038) (Lea Waller, reviewed by CM)
42+
* Fix typos preventing deprecation warnings from being raised (pr/991)
43+
(Jonathan Daniel, reviewed by MB)
44+
* Work around numpy SystemError to maintain expected error types (pr/1051) (CM)
45+
* Use more constrained mock when testing optpkg (pr/983) (CM, reviewed by YOH)
46+
47+
Maintenance
48+
-----------
49+
* Add setuptools requirement to match usage (pr/1009)
50+
(Tomáš Hrnčiar, reviewed by CM)
51+
* Fix grammar of headings in CoC (pr/996) (MB, reviewed by CM, Ariel Rokem)
52+
* Set minimum pydicom to 1.0.0 (pr/1050) (CM)
53+
* Submit coverage to codecov via pinned PyPI package (pr/1008) (CM)
54+
* Upgrade versioneer to 0.19 (pr/967) (CM)
55+
* Migrate to GitHub actions (pr/972) (CM, reviewed by Serge Koudoro)
56+
57+
2858
3.2.1 (Saturday 28 November 2020)
2959
=================================
3060

doc/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292

9393
# General information about the project.
9494
project = u'NiBabel'
95-
copyright = f"2006-2020, {metadata['maintainer']} <{metadata['author_email']}>"
95+
copyright = f"2006-2022, {metadata['maintainer']} <{metadata['author_email']}>"
9696

9797
# The version info for the project you're documenting, acts as replacement for
9898
# |version| and |release|, also used in various other places throughout the

doc/source/index.rst

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ contributed code and discussion (in rough order of appearance):
114114
* Markéta Calábková
115115
* Carl Gauthier
116116
* Julian Klug
117+
* Lea Waller
118+
* Tomáš Hrnčiar
119+
* Andrew Van
117120

118121
License reprise
119122
===============

min-requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
22
numpy ==1.14
33
packaging ==14.3
4+
setuptools

nibabel/cifti2/cifti2.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,7 @@ def get_index_map(self, index):
11561156
a2md = self._get_indices_from_mim(v)
11571157
if index in a2md:
11581158
return v
1159-
else:
1160-
raise Cifti2HeaderError("Index not mapped")
1159+
raise Cifti2HeaderError("Index not mapped")
11611160

11621161
def _validate_new_mim(self, value):
11631162
if value.applies_to_matrix_dimension is None:

nibabel/cifti2/parse_cifti2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ def flush_chardata(self):
538538
# conversion to numpy array
539539
c = BytesIO(data.strip().encode('utf-8'))
540540
transform = self.struct_state[-1]
541-
transform.matrix = np.loadtxt(c, dtype=np.float64)
541+
matrix = np.loadtxt(c, dtype=np.float64)
542+
transform.matrix = matrix.reshape(4, 4)
542543
c.close()
543544

544545
elif self.write_to == 'Label':

nibabel/cifti2/tests/test_cifti2io_header.py

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
datafiles = [DATA_FILE2, DATA_FILE3, DATA_FILE4, DATA_FILE5, DATA_FILE6]
4242

4343

44+
def test_space_separated_affine():
45+
img = ci.Cifti2Image.from_filename(
46+
pjoin(NIBABEL_TEST_DATA, "row_major.dconn.nii"))
47+
48+
4449
def test_read_nifti2():
4550
# Error trying to read a CIFTI-2 image from a NIfTI2-only image.
4651
filemap = ci.Cifti2Image.make_file_map()

nibabel/cmdline/dicomfs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_paths(self):
7171
for study in dft.get_studies(self.dicom_path, self.followlinks):
7272
pd = paths.setdefault(study.patient_name_or_uid(), {})
7373
patient_info = 'patient information\n'
74-
patient_info = f'name: {study.patient_name}\n'
74+
patient_info += f'name: {study.patient_name}\n'
7575
patient_info += f'ID: {study.patient_id}\n'
7676
patient_info += f'birth date: {study.patient_birth_date}\n'
7777
patient_info += f'sex: {study.patient_sex}\n'
@@ -172,9 +172,9 @@ def open(self, path, flags):
172172
elif isinstance(matched_path, tuple):
173173
self.fhs[i] = matched_path[1]()
174174
else:
175-
raise -errno.EFTYPE
175+
return -errno.EFTYPE
176176
return FileHandle(i)
177-
raise -errno.ENFILE
177+
return -errno.ENFILE
178178

179179
# not done
180180
def read(self, path, size, offset, fh):

nibabel/filebasedimages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def __init__(self, header=None, extra=None, file_map=None):
202202
def header(self):
203203
return self._header
204204

205-
def __getitem__(self):
205+
def __getitem__(self, key):
206206
""" No slicing or dictionary interface for images
207207
"""
208208
raise TypeError("Cannot slice image objects.")

nibabel/gifti/gifti.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def from_dict(klass, data_dict):
4343

4444
@deprecate_with_version(
4545
'get_metadata method deprecated. '
46-
"Use the metadata property instead."
46+
"Use the metadata property instead.",
4747
'2.1', '4.0')
4848
def get_metadata(self):
4949
return self.metadata
@@ -155,7 +155,7 @@ def __init__(self, key=0, red=None, green=None, blue=None, alpha=None):
155155

156156
@deprecate_with_version(
157157
'get_rgba method deprecated. '
158-
"Use the rgba property instead."
158+
"Use the rgba property instead.",
159159
'2.1', '4.0')
160160
def get_rgba(self):
161161
return self.rgba
@@ -523,7 +523,7 @@ def print_summary(self):
523523

524524
@deprecate_with_version(
525525
'get_metadata method deprecated. '
526-
"Use the metadata property instead."
526+
"Use the metadata property instead.",
527527
'2.1', '4.0')
528528
def get_metadata(self):
529529
return self.meta.metadata
@@ -877,8 +877,8 @@ def to_file_map(self, file_map=None):
877877
"""
878878
if file_map is None:
879879
file_map = self.file_map
880-
f = file_map['image'].get_prepare_fileobj('wb')
881-
f.write(self.to_xml())
880+
with file_map['image'].get_prepare_fileobj('wb') as f:
881+
f.write(self.to_xml())
882882

883883
@classmethod
884884
def from_file_map(klass, file_map, buffer_size=35000000):

nibabel/gifti/giftiio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def read(filename):
3434

3535

3636
@deprecate_with_version('giftiio.write function deprecated. '
37-
"Use nibabel.load() instead.",
37+
"Use nibabel.save() instead.",
3838
'2.1', '4.0')
3939
def write(image, filename):
4040
""" Save the current image to a new file

nibabel/gifti/tests/test_gifti.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import numpy as np
88

9+
from nibabel.tmpdirs import InTemporaryDirectory
10+
911
from ... import load
1012
from .. import (GiftiImage, GiftiDataArray, GiftiLabel,
1113
GiftiLabelTable, GiftiMetaData, GiftiNVPairs,
@@ -40,7 +42,7 @@ def test_agg_data():
4042

4143
assert_array_equal(surf_gii_img.agg_data('pointset'), point_data)
4244
assert_array_equal(surf_gii_img.agg_data('triangle'), triangle_data)
43-
assert_array_equal(func_gii_img.agg_data('time series'), func_data)
45+
assert_array_equal(func_gii_img.agg_data('time series'), func_data)
4446
assert_array_equal(shape_gii_img.agg_data('shape'), shape_data)
4547

4648
assert surf_gii_img.agg_data('time series') == ()
@@ -443,3 +445,11 @@ def test_darray_dtype_coercion_failures():
443445
da_copy = gii_copy.darrays[0]
444446
assert np.dtype(da_copy.data.dtype) == np.dtype(darray_dtype)
445447
assert_array_equal(da_copy.data, da.data)
448+
449+
450+
def test_gifti_file_close():
451+
gii = load(test_data('gifti', 'ascii.gii'))
452+
with pytest.WarningsRecorder() as record:
453+
with InTemporaryDirectory():
454+
gii.to_filename('test.gii')
455+
assert not any(isinstance(r.message, ResourceWarning) for r in record.list)

nibabel/pydicom_compat.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
# Module has (apparently) unused imports; stop flake8 complaining
2424
# flake8: noqa
2525

26-
import numpy as np
2726
from .deprecated import deprecate_with_version
2827

2928
have_dicom = True
1.84 KB
Binary file not shown.

nibabel/volumeutils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ class BinOpener(Opener):
15511551
__doc__ = Opener.__doc__
15521552

15531553
@deprecate_with_version('BinOpener class deprecated. '
1554-
"Please use Opener class instead."
1554+
"Please use Opener class instead.",
15551555
'2.1', '4.0')
15561556
def __init__(self, *args, **kwargs):
15571557
return super(BinOpener, self).__init__(*args, **kwargs)

nisext/py3builder.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
""" distutils utilities for porting to python 3 within 2-compatible tree """
22

33

4-
import sys
5-
import re
6-
74
try:
85
from distutils.command.build_py import build_py_2to3
96
except ImportError:

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
22
numpy >=1.14
33
packaging >=14.3
4+
setuptools

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ python_requires = >=3.6
3232
install_requires =
3333
numpy >=1.14
3434
packaging >=14.3
35+
setuptools
3536
zip_safe = False
3637
packages = find:
3738

@@ -58,6 +59,7 @@ style =
5859
test =
5960
coverage
6061
pytest !=5.3.4
62+
pytest <7 ; python_version == "3.6"
6163
pytest-cov
6264
pytest-doctestplus !=0.9.0
6365
all =

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"""Build helper."""
1111

1212
import sys
13-
import os
1413

1514
from setuptools import setup
1615
import versioneer

tools/make_tarball.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import commands
66
import os
7-
import sys
8-
import shutil
97

108
from toollib import *
119

tools/mpkg_wrapper.py

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
__docformat__ = 'restructuredtext'
1717

1818
import sys
19-
import setuptools
20-
import bdist_mpkg
2119

2220
def main():
2321
del sys.argv[0]

0 commit comments

Comments
 (0)