|
20 | 20 | from .parrec import PARRECImage
|
21 | 21 | from .spm99analyze import Spm99AnalyzeImage
|
22 | 22 | 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 |
| - |
29 | 23 |
|
30 | 24 | # Ordered by the load/save priority.
|
31 | 25 | all_image_classes = [Nifti1Pair, Nifti1Image, Nifti2Pair,
|
|
34 | 28 | Minc1Image, Minc2Image, MGHImage,
|
35 | 29 | PARRECImage, GiftiImage, AFNIImage]
|
36 | 30 |
|
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 |
| - |
119 | 31 | # Image classes known to require spatial axes to be first in index ordering.
|
120 | 32 | # When adding an image class, consider whether the new class should be listed
|
121 | 33 | # here.
|
|
0 commit comments