@@ -536,17 +536,18 @@ def filespec_to_file_map(klass, filespec):
536536 @classmethod
537537 @kw_only_meth (1 )
538538 def from_file_map (klass , file_map , mmap = True , keep_file_open = None ):
539- '''Load image from ``file_map``
539+ ''' Class method to create image from mapping in ``file_map``
540540
541541 .. deprecated:: 2.4.1
542542 ``keep_file_open='auto'`` is redundant with `False` and has
543543 been deprecated. It will raise an error in nibabel 3.0.
544544
545545 Parameters
546546 ----------
547- file_map : None or mapping, optional
548- files mapping. If None (default) use object's ``file_map``
549- attribute instead
547+ file_map : dict
548+ Mapping with (kay, value) pairs of (``file_type``, FileHolder
549+ instance giving file-likes for each file needed for this image
550+ type.
550551 mmap : {True, False, 'c', 'r'}, optional, keyword only
551552 `mmap` controls the use of numpy memory mapping for reading image
552553 array data. If False, do not try numpy ``memmap`` for data array.
@@ -563,6 +564,10 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
563564 If ``file_map`` refers to an open file handle, this setting has no
564565 effect. The default value (``None``) will result in the value of
565566 ``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT`` being used.
567+
568+ Returns
569+ -------
570+ img : MGHImage instance
566571 '''
567572 if mmap not in (True , False , 'c' , 'r' ):
568573 raise ValueError ("mmap should be one of {True, False, 'c', 'r'}" )
@@ -577,47 +582,6 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
577582 img = klass (data , affine , header , file_map = file_map )
578583 return img
579584
580- @classmethod
581- @kw_only_meth (1 )
582- def from_filename (klass , filename , mmap = True , keep_file_open = None ):
583- ''' Class method to create image from filename ``filename``
584-
585- .. deprecated:: 2.4.1
586- ``keep_file_open='auto'`` is redundant with `False` and has
587- been deprecated. It will raise an error in nibabel 3.0.
588-
589- Parameters
590- ----------
591- filename : str
592- Filename of image to load
593- mmap : {True, False, 'c', 'r'}, optional, keyword only
594- `mmap` controls the use of numpy memory mapping for reading image
595- array data. If False, do not try numpy ``memmap`` for data array.
596- If one of {'c', 'r'}, try numpy memmap with ``mode=mmap``. A
597- `mmap` value of True gives the same behavior as ``mmap='c'``. If
598- image data file cannot be memory-mapped, ignore `mmap` value and
599- read array from file.
600- keep_file_open : { None, True, False }, optional, keyword only
601- `keep_file_open` controls whether a new file handle is created
602- every time the image is accessed, or a single file handle is
603- created and used for the lifetime of this ``ArrayProxy``. If
604- ``True``, a single file handle is created and used. If ``False``,
605- a new file handle is created every time the image is accessed.
606- The default value (``None``) will result in the value of
607- ``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT`` being used.
608-
609- Returns
610- -------
611- img : MGHImage instance
612- '''
613- if mmap not in (True , False , 'c' , 'r' ):
614- raise ValueError ("mmap should be one of {True, False, 'c', 'r'}" )
615- file_map = klass .filespec_to_file_map (filename )
616- return klass .from_file_map (file_map , mmap = mmap ,
617- keep_file_open = keep_file_open )
618-
619- load = from_filename
620-
621585 def to_file_map (self , file_map = None ):
622586 ''' Write image to `file_map` or contained ``self.file_map``
623587
0 commit comments