class_docstr: Class to contain ND image as list of (N-1)D images 
docstr: Create an image list from an `image` by slicing over `axis`
  
  Parameters
  ----------
  image : object
      object with ``coordmap`` attribute
  axis : str or int
      axis of `image` that should become the axis indexed by the image
      list.
  dropout : bool, optional
      When taking slices from an image, we will leave an output dimension
      to the coordmap that has no corresponding input dimension.  If
      `dropout` is True, drop this output dimension.
  
  Returns
  -------
  ilist : ``ImageList`` instance
docstr_tok: ["Create","an","image","list","from","an","`","image","`","by","slicing","over","`","axis","`","Parameters","--","--","--","--","--","image",":","object","object","with","``","coordmap","``","attribute","axis",":","str","or","int","axis","of","`","image","`","that","should","become","the","axis","indexed","by","the","image","list",".","dropout",":","bool",",","optional","When","taking","slices","from","an","image",",","we","will","leave","an","output","dimension","to","the","coordmap","that","has","no","corresponding","input","dimension",".","If","`","dropout","`","is","True",",","drop","this","output","dimension",".","Returns","--","--","--","-","ilist",":","``","ImageList","``","instance"]
code: def from_image(klass, image, axis=None, dropout=True):
      """Create an image list from an `image` by slicing over `axis`
  
      Parameters
      ----------
      image : object
          object with ``coordmap`` attribute
      axis : str or int
          axis of `image` that should become the axis indexed by the image
          list.
      dropout : bool, optional
          When taking slices from an image, we will leave an output dimension
          to the coordmap that has no corresponding input dimension.  If
          `dropout` is True, drop this output dimension.
  
      Returns
      -------
      ilist : ``ImageList`` instance
      """
      if axis is None:
          raise ValueError("Must specify image axis")
      # Get corresponding input, output dimension indices
      in_ax, out_ax = io_axis_indices(image.coordmap, axis)
      if in_ax is None:
          raise AxisError(
              f"No corresponding input dimension for {axis}"
          )
      dropout = dropout and out_ax is not None
      if dropout:
          out_ax_name = image.reference.coord_names[out_ax]
      imlist = []
      for img in iter_axis(image, in_ax):
          if dropout:
              cmap = drop_io_dim(img.coordmap, out_ax_name)
              img = Image(img.get_fdata(), cmap, img.metadata)
          imlist.append(img)
      return klass(imlist)
  
file_path: nipy/nipy/core/image/image_list.py
imports: import warnings
  import numpy
  from ..reference.coordinate_map import AxisError, drop_io_dim, io_axis_indices
  from .image import Image, is_image, iter_axis
label_desc: Use image node_id 2 for calling the ImageList obj's underlying member method code with example usage: obj.from_image(klass, image, axis, dropout) and returns: klass