Skip to content

Commit 1b7a4a0

Browse files
committed
MNT: Remove imagclasses.{ext,class}_map
1 parent eeaa4ba commit 1b7a4a0

File tree

3 files changed

+2
-99
lines changed

3 files changed

+2
-99
lines changed

nibabel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
from .orientations import (io_orientation, orientation_affine,
6262
flip_axis, OrientationError,
6363
apply_orientation, aff2axcodes)
64-
from .imageclasses import class_map, ext_map, all_image_classes
64+
from .imageclasses import all_image_classes
6565
from . import mriutils
6666
from . import streamlines
6767
from . import viewers

nibabel/imageclasses.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
from .parrec import PARRECImage
2121
from .spm99analyze import Spm99AnalyzeImage
2222
from .spm2analyze import Spm2AnalyzeImage
23-
from .volumeutils import Recoder
24-
from .deprecated import deprecate_with_version
25-
26-
from .optpkg import optional_package
27-
_, have_scipy, _ = optional_package('scipy')
28-
2923

3024
# Ordered by the load/save priority.
3125
all_image_classes = [Nifti1Pair, Nifti1Image, Nifti2Pair,
@@ -34,88 +28,6 @@
3428
Minc1Image, Minc2Image, MGHImage,
3529
PARRECImage, GiftiImage, AFNIImage]
3630

37-
38-
# DEPRECATED: mapping of names to classes and class functionality
39-
class ClassMapDict(dict):
40-
41-
@deprecate_with_version('class_map is deprecated.',
42-
'2.1', '4.0')
43-
def __getitem__(self, *args, **kwargs):
44-
return super(ClassMapDict, self).__getitem__(*args, **kwargs)
45-
46-
47-
class_map = ClassMapDict(
48-
analyze={'class': AnalyzeImage, # Image class
49-
'ext': '.img', # characteristic image extension
50-
'has_affine': False, # class can store an affine
51-
'makeable': True, # empty image can be easily made in memory
52-
'rw': True}, # image can be written
53-
spm99analyze={'class': Spm99AnalyzeImage,
54-
'ext': '.img',
55-
'has_affine': True,
56-
'makeable': True,
57-
'rw': have_scipy},
58-
spm2analyze={'class': Spm2AnalyzeImage,
59-
'ext': '.img',
60-
'has_affine': True,
61-
'makeable': True,
62-
'rw': have_scipy},
63-
nifti_pair={'class': Nifti1Pair,
64-
'ext': '.img',
65-
'has_affine': True,
66-
'makeable': True,
67-
'rw': True},
68-
nifti_single={'class': Nifti1Image,
69-
'ext': '.nii',
70-
'has_affine': True,
71-
'makeable': True,
72-
'rw': True},
73-
minc={'class': Minc1Image,
74-
'ext': '.mnc',
75-
'has_affine': True,
76-
'makeable': True,
77-
'rw': False},
78-
mgh={'class': MGHImage,
79-
'ext': '.mgh',
80-
'has_affine': True,
81-
'makeable': True,
82-
'rw': True},
83-
mgz={'class': MGHImage,
84-
'ext': '.mgz',
85-
'has_affine': True,
86-
'makeable': True,
87-
'rw': True},
88-
par={'class': PARRECImage,
89-
'ext': '.par',
90-
'has_affine': True,
91-
'makeable': False,
92-
'rw': False},
93-
afni={'class': AFNIImage,
94-
'ext': '.brik',
95-
'has_affine': True,
96-
'makeable': False,
97-
'rw': False})
98-
99-
100-
class ExtMapRecoder(Recoder):
101-
102-
@deprecate_with_version('ext_map is deprecated.',
103-
'2.1', '4.0')
104-
def __getitem__(self, *args, **kwargs):
105-
return super(ExtMapRecoder, self).__getitem__(*args, **kwargs)
106-
107-
108-
# mapping of extensions to default image class names
109-
ext_map = ExtMapRecoder((
110-
('nifti_single', '.nii'),
111-
('nifti_pair', '.img', '.hdr'),
112-
('minc', '.mnc'),
113-
('mgh', '.mgh'),
114-
('mgz', '.mgz'),
115-
('par', '.par'),
116-
('brik', '.brik')
117-
))
118-
11931
# Image classes known to require spatial axes to be first in index ordering.
12032
# When adding an image class, consider whether the new class should be listed
12133
# here.

nibabel/tests/test_imageclasses.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
from nibabel.nifti2 import Nifti2Image
1515

1616
from nibabel import imageclasses
17-
from nibabel.imageclasses import spatial_axes_first, class_map, ext_map
17+
from nibabel.imageclasses import spatial_axes_first
1818

1919
from nibabel.optpkg import optional_package
20-
from nibabel.deprecator import ExpiredDeprecationError
2120

2221
have_h5py = optional_package('h5py')[1]
2322

@@ -49,11 +48,3 @@ def test_spatial_axes_first():
4948
img = nib.load(pjoin(DATA_DIR, fname))
5049
assert len(img.shape) == 4
5150
assert not spatial_axes_first(img)
52-
53-
54-
def test_deprecations():
55-
with pytest.raises(ExpiredDeprecationError):
56-
class_map['nifti_single']
57-
with pytest.raises(ExpiredDeprecationError):
58-
nifti_ext = ext_map['.nii']
59-

0 commit comments

Comments
 (0)