code: def parse_fname_axes(img_fname, time_axis, slice_axis):
      """Load `img_fname`, check `time_axis`, `slice_axis` or use default
  
      Parameters
      ----------
      img_fname : str
         filename of image on which to do diagnostics
      time_axis : None or str or int, optional
          Axis indexing time-points. None is default, will be replaced by a value
          of '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 : None or 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.  If None (the default) then 1) try the name
          'slice' to select the axis - if this fails, and `fname` refers to an
          Analyze type image (such as Nifti), then 2) default to the third image
          axis, otherwise 3) raise a ValueError
  
      Returns
      -------
      img : ``Image`` instance
          Image as loaded from `img_fname`
      time_axis : int or str
          Time axis, possibly filled with default
      slice_axis : int or str
          Slice axis, possibly filled with default
      """
      # Check whether this is an Analyze-type image
      img = nipy.load_image(img_fname)
      # Check for axes
      if time_axis is not None:
          # Try converting to an integer in case that was what was passed
          try:
              time_axis = int(time_axis)
          except ValueError:
              # Maybe a string
              pass
      else:  # was None
          time_axis = "t"
      if slice_axis is not None:
          # Try converting to an integer in case that was what was passed
          try:
              slice_axis = int(slice_axis)
          except ValueError:
              # Maybe a string
              pass
      else:  # slice axis was None - search for default
          input_names = img.coordmap.function_domain.coord_names
          is_analyze = "header" in img.metadata and isinstance(
              img.metadata["header"], AnalyzeHeader
          )
          if "slice" in input_names:
              slice_axis = "slice"
          elif is_analyze and img.ndim == 4:
              slice_axis = 2
          else:
              raise ValueError(
                  "No slice axis specified, not analyze type "
                  "image; refusing to guess"
              )
      return img, time_axis, slice_axis
  
file_path: nipy/nipy/algorithms/diagnostics/commands.py
imports: from os.path import join
  from os.path import split
  import numpy
  from nibabel import AnalyzeHeader
  from nibabel.filename_parser import splitext_addext
  import nipy
  from .screens import screen, write_screen_res
  from .timediff import time_slice_diffs_image
  from .tsdiffplot import plot_tsdiffs
label_desc: Use image node_id 1 for calling a global function with example usage: parse_fname_axes(img_fname, time_axis, slice_axis) and returns: img,  time_axis,  slice_axis