code: def time_slice_diffs_image(img, time_axis="t", slice_axis="slice"):
      """Time-point to time-point differences over volumes and slices of image
  
      Parameters
      ----------
      img : Image
          The image on which to perform time-point differences
      time_axis : str or int, optional
          Axis indexing time-points. Default is 't'. If `time_axis` is an integer,
          gives the index of the input (domain) axis of `img`. If `time_axis` is a str,
          can be an input (domain) name, or an output (range) name, that maps to
          an input (domain) name.
      slice_axis : str or int, optional
          Axis indexing MRI slices. If `slice_axis` is an integer, gives the
          index of the input (domain) axis of `img`. If `slice_axis` is a str,
          can be an input (domain) name, or an output (range) name, that maps to
          an input (domain) name.
  
      Returns
      -------
      results : dict
  
          `arr` refers to the array as loaded from `img`
  
          ``T`` is the number of time points (``img.shape[time_axis]``)
  
          ``S`` is the number of slices (``img.shape[slice_axis]``)
  
          ``v`` is the shape of a volume (``rollimg(img, time_axis)[0].shape``)
  
          ``d2[t]`` is the volume of squared differences between voxels at
          time point ``t`` and time point ``t+1``
  
          `results` has keys:
  
          * 'volume_mean_diff2' : (T-1,) array
             array containing the mean (over voxels in volume) of the
             squared difference from one time point to the next
          * 'slice_mean_diff2' : (T-1, S) array
             giving the mean (over voxels in slice) of the difference from
             one time point to the next, one value per slice, per
             timepoint
          * 'volume_means' : (T,) array
             mean over voxels for each volume ``vol[t] for t in 0:T``
          * 'slice_diff2_max_vol' : v[:] image
             image volume, of same shape as input time point volumes, where each
             slice is is the slice from ``d2[t]`` for t in 0:T-1, that has the
             largest variance across ``t``.  Thus each slice in the volume may
             well result from a different difference time point.
          * 'diff2_mean_vol`` : v[:] image
             image volume with the mean of ``d2[t]`` across t for t in 0:T-1.
      """
      img = as_image(img)
      img_class = img.__class__
      time_in_ax, time_out_ax = io_axis_indices(img.coordmap, time_axis)
      if None in (time_in_ax, time_out_ax):
          raise AxisError(
              'Cannot identify matching input output axes with "%s"'
              % time_axis
          )
      slice_in_ax, slice_out_ax = io_axis_indices(
          img.coordmap, slice_axis
      )
      if None in (slice_in_ax, slice_out_ax):
          raise AxisError(
              'Cannot identify matching input output axes with "%s"'
              % slice_axis
          )
      vol_coordmap = drop_io_dim(img.coordmap, time_axis)
      results = time_slice_diffs(
          img.get_fdata(), time_in_ax, slice_in_ax
      )
      for key in ("slice_diff2_max_vol", "diff2_mean_vol"):
          vol = img_class(results[key], vol_coordmap)
          results[key] = vol
      return results
  
imports: import numpy
  from ...core.reference.coordinate_map import AxisError, drop_io_dim, io_axis_indices
  from ...io.api import as_image
label_desc: Use image node_id 2 for calling a global function with example usage: time_slice_diffs_image(img, time_axis, slice_axis) and returns: results