Skip to content

Commit 60e3a13

Browse files
committed
MNT: Complete deprecations in spatialimages
1 parent 1fb2b4e commit 60e3a13

File tree

4 files changed

+2
-45
lines changed

4 files changed

+2
-45
lines changed

nibabel/spatialimages.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
methods:
2222
2323
* .get_fdata()
24-
* .get_data() (deprecated, use get_fdata() instead)
25-
* .get_affine() (deprecated, use affine property instead)
26-
* .get_header() (deprecated, use header property instead)
2724
* .to_filename(fname) - writes data to filename(s) derived from
2825
``fname``, where the derivation may differ between formats.
2926
* to_file_map() - save image to files with which the image is already
@@ -141,7 +138,6 @@
141138
from .viewers import OrthoSlicer3D
142139
from .volumeutils import shape_zoom_affine
143140
from .fileslice import canonical_slicers
144-
from .deprecated import deprecate_with_version
145141
from .orientations import apply_orientation, inv_ornt_aff
146142

147143

@@ -307,17 +303,6 @@ def supported_np_types(obj):
307303
return set(supported)
308304

309305

310-
class Header(SpatialHeader):
311-
"""Alias for SpatialHeader; kept for backwards compatibility."""
312-
313-
@deprecate_with_version('Header class is deprecated.\n'
314-
'Please use SpatialHeader instead.'
315-
'instead.',
316-
'2.1', '4.0')
317-
def __init__(self, *args, **kwargs):
318-
super(Header, self).__init__(*args, **kwargs)
319-
320-
321306
class ImageDataError(Exception):
322307
pass
323308

@@ -527,15 +512,6 @@ def get_data_dtype(self):
527512
def set_data_dtype(self, dtype):
528513
self._header.set_data_dtype(dtype)
529514

530-
@deprecate_with_version('get_affine method is deprecated.\n'
531-
'Please use the ``img.affine`` property '
532-
'instead.',
533-
'2.1', '4.0')
534-
def get_affine(self):
535-
""" Get affine from image
536-
"""
537-
return self.affine
538-
539515
@classmethod
540516
def from_image(klass, img):
541517
""" Class method to create new instance of own class from `img`

nibabel/tests/test_ecat.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,6 @@ def test_isolation(self):
240240
aff[0, 0] = 99
241241
assert not np.all(img.affine == aff)
242242

243-
def test_get_affine_deprecated(self):
244-
with pytest.raises(ExpiredDeprecationError):
245-
self.img.get_affine()
246-
247243
def test_float_affine(self):
248244
# Check affines get converted to float
249245
img_klass = self.image_class

nibabel/tests/test_image_api.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ def validate_header_shape(self, imaker, params):
502502
class AffineMixin:
503503
""" Adds test of affine property, method
504504
505-
Add this one if your image has an ``affine`` property. If so, it should
506-
(for now) also have a ``get_affine`` method returning the same result.
505+
Add this one if your image has an ``affine`` property.
507506
"""
508507

509508
def validate_affine(self, imaker, params):
@@ -517,12 +516,6 @@ def validate_affine(self, imaker, params):
517516
with pytest.raises(AttributeError):
518517
img.affine = np.eye(4)
519518

520-
def validate_affine_deprecated(self, imaker, params):
521-
# Check deprecated affine API
522-
img = imaker()
523-
with pytest.raises(ExpiredDeprecationError):
524-
img.get_affine()
525-
526519

527520
class SerializeMixin:
528521
def validate_to_from_stream(self, imaker, params):

nibabel/tests/test_spatialimages.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import numpy as np
1616

1717
from io import BytesIO
18-
from ..spatialimages import SpatialHeader, SpatialImage, HeaderDataError, Header
18+
from ..spatialimages import SpatialHeader, SpatialImage, HeaderDataError
1919
from ..imageclasses import spatial_axes_first
2020

2121
import pytest
@@ -30,7 +30,6 @@
3030
)
3131

3232
from ..tmpdirs import InTemporaryDirectory
33-
from ..deprecator import ExpiredDeprecationError
3433
from .. import load as top_load
3534

3635
def test_header_init():
@@ -605,10 +604,3 @@ def test_load_mmap(self):
605604
func(param1, mmap='rw')
606605
with pytest.raises(ValueError):
607606
func(param1, mmap='r+')
608-
609-
610-
def test_header_deprecated():
611-
class MyHeader(Header):
612-
pass
613-
with pytest.raises(ExpiredDeprecationError):
614-
MyHeader()

0 commit comments

Comments
 (0)