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: Create an `Image` object from array and `CoordinateMap` object.
  
  Images are often created through the ``load_image`` function in the nipy
  base namespace.
  
  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.
  
  See Also
  --------
  load_image : load ``Image`` from a file
  save_image : save ``Image`` to a file
code: def __init__(self, data, coordmap, metadata=None):
      """Create an `Image` object from array and `CoordinateMap` object.
  
      Images are often created through the ``load_image`` function in the nipy
      base namespace.
  
      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.
  
      See Also
      --------
      load_image : load ``Image`` from a file
      save_image : save ``Image`` to a file
      """
      if metadata is None:
          metadata = {}
      else:  # Shallow copy
          metadata = copy(metadata)
      ndim = len(data.shape)
      if not isinstance(coordmap, AffineTransform):
          raise ValueError("coordmap must be an AffineTransform")
      # self._data is an array-like object.  It must have a shape attribute
      # (see above) and return an array from np.array(data)
      self._data = data
      self.coordmap = coordmap
      if coordmap.function_domain.ndim != ndim:
          raise ValueError(
              "the number of axes implied by the coordmap do "
              "not match the number of axes of the data"
          )
      self.metadata = 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 8 to create a new Image object  with example: obj = Image(data, coordmap, metadata)