class_docstr: The `Image` class provides the core object type used in nipy.
  
  An `Image` represents a volumetric brain image and provides means
  for manipulating the image data.  Most functions in the image module
  operate on `Image` objects.
  
  Notes
  -----
  Images can be created through the module functions.  See nipy.io for
  image IO such as ``load`` and ``save``
  
  Examples
  --------
  Load an image from disk
  
  >>> from nipy.testing import anatfile
  >>> from nipy.io.api import load_image
  >>> img = load_image(anatfile)
  
  Make an image from an array.  We need to make a meaningful coordinate map
  for the image.
  
  >>> arr = np.zeros((21,64,64), dtype=np.int16)
  >>> cmap = AffineTransform('kji', 'zxy', np.eye(4))
  >>> img = Image(arr, cmap)
docstr: Classmethod makes new instance of this `klass` from instance `img`
  
  Parameters
  ----------
  data : array-like
      object that as attribute ``shape`` and returns an array from
      ``np.asarray(data)``
  coordmap : `AffineTransform` object
      coordmap mapping the domain (input) voxel axes of the image to the
      range (reference, output) axes - usually mm in real world space
  metadata : dict, optional
      Freeform metadata for image.  Most common contents is ``header``
      from nifti etc loaded images.
  
  Returns
  -------
  img : `klass` instance
      New image with data from `data`, coordmap from `coordmap` maybe
      metadata from `metadata`
  
  Notes
  -----
  Subclasses of ``Image`` with different semantics for ``__init__`` will
  need to override this classmethod.
  
  Examples
  --------
  >>> from nipy import load_image
  >>> from nipy.core.api import Image
  >>> from nipy.testing import anatfile
  >>> aimg = load_image(anatfile)
  >>> arr = np.arange(24).reshape((2,3,4))
  >>> img = Image.from_image(aimg, data=arr)
code: def from_image(klass, img, data=None, coordmap=None, metadata=None):
      """Classmethod makes new instance of this `klass` from instance `img`
  
      Parameters
      ----------
      data : array-like
          object that as attribute ``shape`` and returns an array from
          ``np.asarray(data)``
      coordmap : `AffineTransform` object
          coordmap mapping the domain (input) voxel axes of the image to the
          range (reference, output) axes - usually mm in real world space
      metadata : dict, optional
          Freeform metadata for image.  Most common contents is ``header``
          from nifti etc loaded images.
  
      Returns
      -------
      img : `klass` instance
          New image with data from `data`, coordmap from `coordmap` maybe
          metadata from `metadata`
  
      Notes
      -----
      Subclasses of ``Image`` with different semantics for ``__init__`` will
      need to override this classmethod.
  
      Examples
      --------
      >>> from nipy import load_image
      >>> from nipy.core.api import Image
      >>> from nipy.testing import anatfile
      >>> aimg = load_image(anatfile)
      >>> arr = np.arange(24).reshape((2,3,4))
      >>> img = Image.from_image(aimg, data=arr)
      """
      if data is None:
          data = img._data
      if coordmap is None:
          coordmap = copy(img.coordmap)
      if metadata is None:
          metadata = copy(img.metadata)
      return klass(data, coordmap, metadata)
  
imports: import warnings
  from copy import copy
  from itertools import chain
  import numpy
  from nibabel.onetime import auto_attr
  from ..reference.array_coords import ArrayCoordMap
  from ..reference.coordinate_map import AffineTransform, CoordinateSystem, input_axis_index
label_desc: Use image node_id 21 for calling the Image obj's underlying member method code with example usage: obj.from_image(klass, img, data, coordmap, metadata) and returns: klass