@@ -76,9 +76,7 @@ class FileBasedImage(object):
76
76
properties:
77
77
78
78
* shape
79
- * affine
80
79
* header
81
- * dataobj
82
80
83
81
methods:
84
82
* .get_header() (deprecated, use header property instead)
@@ -213,9 +211,7 @@ def header(self):
213
211
def __getitem__ (self ):
214
212
''' No slicing or dictionary interface for images
215
213
'''
216
- raise TypeError ("Cannot slice image objects; consider slicing image "
217
- "array data with `img.dataobj[slice]` or "
218
- "`img.get_data()[slice]`" )
214
+ raise TypeError ("Cannot slice image objects." )
219
215
220
216
def get_header (self ):
221
217
""" Get header from image
@@ -412,35 +408,14 @@ def instance_to_filename(klass, img, filename):
412
408
413
409
Parameters
414
410
----------
415
- img : ``spatialimage`` instance
416
- In fact, an object with the API of ``spatialimage`` - specifically
417
- ``dataobj``, ``affine``, ``header`` and ``extra``.
411
+ img : ``any FileBasedImage`` instance
412
+
418
413
filename : str
419
414
Filename, implying name to which to save image.
420
415
'''
421
416
img = klass .from_image (img )
422
417
img .to_filename (filename )
423
418
424
- @classmethod
425
- def from_image (klass , img ):
426
- ''' Class method to create new instance of own class from `img`
427
-
428
- Parameters
429
- ----------
430
- img : ``spatialimage`` instance
431
- In fact, an object with the API of ``spatialimage`` -
432
- specifically ``dataobj``, ``affine``, ``header`` and ``extra``.
433
-
434
- Returns
435
- -------
436
- cimg : ``spatialimage`` instance
437
- Image, of our own class
438
- '''
439
- return klass (img .dataobj ,
440
- img .affine ,
441
- klass .header_class .from_header (img .header ),
442
- extra = img .extra .copy ())
443
-
444
419
@classmethod
445
420
def is_valid_extension (klass , ext ):
446
421
valid = tuple (ft [1 ] for ft in klass .files_types ) + klass .alternate_exts
0 commit comments