class_docstr: Class for basic Analyze format image
class_docstr_tok: ["Class","for","basic","Analyze","format","image"]
docstr: Class method to create image from mapping in ``file_map``
  
  Parameters
  ----------
  file_map : dict
      Mapping with (kay, value) pairs of (``file_type``, FileHolder
      instance giving file-likes for each file needed for this image
      type.
  mmap : {True, False, 'c', 'r'}, optional, keyword only
      `mmap` controls the use of numpy memory mapping for reading image
      array data.  If False, do not try numpy ``memmap`` for data array.
      If one of {'c', 'r'}, try numpy memmap with ``mode=mmap``.  A
      `mmap` value of True gives the same behavior as ``mmap='c'``.  If
      image data file cannot be memory-mapped, ignore `mmap` value and
      read array from file.
  keep_file_open : { None, True, False }, optional, keyword only
      `keep_file_open` controls whether a new file handle is created
      every time the image is accessed, or a single file handle is
      created and used for the lifetime of this ``ArrayProxy``. If
      ``True``, a single file handle is created and used. If ``False``,
      a new file handle is created every time the image is accessed.
      If ``file_map`` refers to an open file handle, this setting has no
      effect. The default value (``None``) will result in the value of
      ``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT`` being used.
  
  Returns
  -------
  img : AnalyzeImage instance
docstr_tok: ["Class","method","to","create","image","from","mapping","in","``","file_map","``","Parameters","--","--","--","--","--","file_map",":","dict","Mapping","with","(","kay",",","value",")","pairs","of","(","``","file_type","``",",","FileHolder","instance","giving","file-likes","for","each","file","needed","for","this","image","type",".","mmap",":","{","True",",","False",",","'","c","'",",","'","r","'","}",",","optional",",","keyword","only","`","mmap","`","controls","the","use","of","numpy","memory","mapping","for","reading","image","array","data",".","If","False",",","do","not","try","numpy","``","memmap","``","for","data","array",".","If","one","of","{","'","c","'",",","'","r","'","}",",","try","numpy","memmap","with","``","mode=mmap","``",".","A","`","mmap","`","value","of","True","gives","the","same","behavior","as","``","mmap=","'","c","'","``",".","If","image","data","file","can","not","be","memory-mapped",",","ignore","`","mmap","`","value","and","read","array","from","file",".","keep_file_open",":","{","None",",","True",",","False","}",",","optional",",","keyword","only","`","keep_file_open","`","controls","whether","a","new","file","handle","is","created","every","time","the","image","is","accessed",",","or","a","single","file","handle","is","created","and","used","for","the","lifetime","of","this","``","ArrayProxy","``",".","If","``","True","``",",","a","single","file","handle","is","created","and","used",".","If","``","False","``",",","a","new","file","handle","is","created","every","time","the","image","is","accessed",".","If","``","file_map","``","refers","to","an","open","file","handle",",","this","setting","has","no","effect",".","The","default","value","(","``","None","``",")","will","result","in","the","value","of","``","nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT","``","being","used",".","Returns","--","--","--","-","img",":","AnalyzeImage","instance"]
code: def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
      """Class method to create image from mapping in ``file_map``
  
      Parameters
      ----------
      file_map : dict
          Mapping with (kay, value) pairs of (``file_type``, FileHolder
          instance giving file-likes for each file needed for this image
          type.
      mmap : {True, False, 'c', 'r'}, optional, keyword only
          `mmap` controls the use of numpy memory mapping for reading image
          array data.  If False, do not try numpy ``memmap`` for data array.
          If one of {'c', 'r'}, try numpy memmap with ``mode=mmap``.  A
          `mmap` value of True gives the same behavior as ``mmap='c'``.  If
          image data file cannot be memory-mapped, ignore `mmap` value and
          read array from file.
      keep_file_open : { None, True, False }, optional, keyword only
          `keep_file_open` controls whether a new file handle is created
          every time the image is accessed, or a single file handle is
          created and used for the lifetime of this ``ArrayProxy``. If
          ``True``, a single file handle is created and used. If ``False``,
          a new file handle is created every time the image is accessed.
          If ``file_map`` refers to an open file handle, this setting has no
          effect. The default value (``None``) will result in the value of
          ``nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT`` being used.
  
      Returns
      -------
      img : AnalyzeImage instance
      """
      if mmap not in (True, False, "c", "r"):
          raise ValueError(
              "mmap should be one of {True, False, 'c', 'r'}"
          )
      hdr_fh, img_fh = klass._get_fileholders(file_map)
      with hdr_fh.get_prepare_fileobj(mode="rb") as hdrf:
          header = klass.header_class.from_fileobj(hdrf)
      hdr_copy = header.copy()
      imgf = img_fh.fileobj
      if imgf is None:
          imgf = img_fh.filename
      data = klass.ImageArrayProxy(
          imgf, hdr_copy, mmap=mmap, keep_file_open=keep_file_open
      )
      # Initialize without affine to allow header to pass through unmodified
      img = klass(data, None, header, file_map=file_map)
      # set affine from header though
      img._affine = header.get_best_affine()
      img._load_cache = {
          "header": hdr_copy,
          "affine": img._affine.copy(),
          "file_map": copy_file_map(file_map),
      }
      return img
  
imports: from __future__ import annotations
  import numpy
  from .arrayproxy import ArrayProxy
  from .arraywriters import ArrayWriter, WriterError, get_slope_inter, make_array_writer
  from .batteryrunners import Report
  from .fileholders import copy_file_map
  from .spatialimages import HeaderDataError, HeaderTypeError, SpatialHeader, SpatialImage
  from .volumeutils import apply_read_scaling, array_from_file, make_dt_codes, native_code, seek_tell, shape_zoom_affine, swapped_code
  from .wrapstruct import LabeledWrapStruct
label_desc: Use image node_id 4 for calling the AnalyzeImage obj's underlying member method code with example usage: obj.from_file_map(klass, file_map) and returns: img