8
8
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
9
9
''' Common interface for any image format--volume or surface, binary or xml.'''
10
10
11
- import os .path
12
11
import warnings
13
12
14
- import numpy as np
15
-
16
13
from .externals .six import string_types
17
14
from .fileholders import FileHolder
18
15
from .filename_parser import (types_filenames , TypesFilenamesError ,
@@ -92,8 +89,8 @@ class FileBasedImage(object):
92
89
* instance_to_filename(img, fname) - save ``img`` instance to
93
90
filename ``fname``.
94
91
95
- It also has a ``header`` - some standard set of meta-data that is specific to
96
- the image format, and ``extra`` - a dictionary container for any other
92
+ It also has a ``header`` - some standard set of meta-data that is specific
93
+ to the image format, and ``extra`` - a dictionary container for any other
97
94
metadata.
98
95
99
96
You cannot slice an image, and trying to slice an image generates an
@@ -115,9 +112,9 @@ class FileBasedImage(object):
115
112
116
113
img.from_filename(fname)
117
114
118
- The image stores its associated files in its ``file_map`` attribute. In order
119
- to just save an image, for which you know there is an associated filename, or
120
- other storage, you can do::
115
+ The image stores its associated files in its ``file_map`` attribute. In
116
+ order to just save an image, for which you know there is an associated
117
+ filename, or other storage, you can do::
121
118
122
119
img.to_file_map()
123
120
@@ -148,6 +145,7 @@ class FileBasedImage(object):
148
145
example, the Analyze data format needs an ``image`` and a ``header``
149
146
file type for storage:
150
147
148
+ >>> import numpy as np
151
149
>>> import nibabel as nib
152
150
>>> data = np.arange(24, dtype='f4').reshape((2,3,4))
153
151
>>> img = nib.AnalyzeImage(data, np.eye(4))
0 commit comments