code: def as_image(image_input):
      """Load image from filename or pass through image instance
  
      Parameters
      ----------
      image_input : str or Image instance
         image or string filename of image.  If a string, load image and
         return.  If an image, pass through without modification
  
      Returns
      -------
      img : Image or Image-like instance
         Input object if `image_input` seemed to be an image, loaded Image
         object if `image_input` was a string.
  
      Raises
      ------
      TypeError : if neither string nor image-like passed
  
      Examples
      --------
      >>> from nipy.testing import anatfile
      >>> from nipy.io.api import load_image
      >>> img = as_image(anatfile)
      >>> img2 = as_image(img)
      >>> img2 is img
      True
      """
      if is_image(image_input):
          return image_input
      if isinstance(image_input, str):
          return load(image_input)
      raise TypeError(
          "Expecting an image-like object or filename string"
      )
  
file_path: nipy/nipy/io/files.py
imports: import os
  import nibabel
  import numpy
  from nibabel.spatialimages import HeaderDataError
  from ..core.image.image import is_image
  from .nibcompat import get_affine, get_dataobj, get_header
  from .nifti_ref import nifti2nipy, nipy2nifti
label_desc: Use image node_id 4 for calling a global function with example usage: as_image(image_input) and returns: image_input, load