code: def screen(img4d, ncomp=10, time_axis="t", slice_axis=None):
      """Diagnostic screen for 4d FMRI image
  
      Includes PCA, tsdiffana and mean, std, min, max images.
  
      Parameters
      ----------
      img4d : ``Image``
         4d image file
      ncomp : int, optional
         number of component images to return.  Default is 10
      time_axis : str or int, optional
          Axis over which to do PCA, time difference analysis. Defaults to `t`
      slice_axis : None or str or int, optional
          Name or index of input axis over which to do slice analysis for time
          difference analysis.  If None, look for input axis ``slice``.  At the
          moment we then assume slice is the last non-time axis, but this last
          guess we will remove in future versions of nipy. The default will then
          be 'slice' and you'll get an error if there is no axis named 'slice'.
  
      Returns
      -------
      screen : dict
         with keys:
  
         * mean : mean image (all summaries are over last dimension)
         * std : standard deviation image
         * max : image of max
         * min : min
         * pca : 4D image of PCA component images
         * pca_res : dict of results from PCA
         * ts_res : dict of results from tsdiffana
  
      Examples
      --------
      >>> import nipy as ni
      >>> from nipy.testing import funcfile
      >>> img = ni.load_image(funcfile)
      >>> screen_res = screen(img)
      >>> screen_res['mean'].ndim
      3
      >>> screen_res['pca'].ndim
      4
      """
      if img4d.ndim != 4:
          raise ValueError("Expecting a 4d image")
      data = img4d.get_fdata()
      cmap = img4d.coordmap
      # Get numerical index for time axis in data array
      time_axis = input_axis_index(cmap, time_axis)
      # Get numerical index for slice axis in data array
      if slice_axis is None:
          try:
              slice_axis = input_axis_index(cmap, "slice")
          except AxisError:
              warnings.warn(
                  "Future versions of nipy will not guess the slice axis "
                  'from position, but only from axis name == "slice"; '
                  "Please specify the slice axis by name or index to avoid "
                  "this warning",
                  FutureWarning,
                  stacklevel=2,
              )
              slice_axis = 2 if time_axis == 3 else 3
      else:
          slice_axis = input_axis_index(cmap, slice_axis)
      # 3D coordinate map for summary images
      cmap_3d = drop_io_dim(cmap, "t")
      screen_res = {}
      # standard processed images
      screen_res["mean"] = Image(np.mean(data, axis=time_axis), cmap_3d)
      screen_res["std"] = Image(np.std(data, axis=time_axis), cmap_3d)
      screen_res["max"] = Image(np.max(data, axis=time_axis), cmap_3d)
      screen_res["min"] = Image(np.min(data, axis=time_axis), cmap_3d)
      # PCA
      screen_res["pca_res"] = pca.pca_image(
          img4d, axis=time_axis, standardize=False, ncomp=ncomp
      )
      screen_res["pca"] = screen_res["pca_res"]["basis_projections"]
      # tsdiffana
      screen_res["ts_res"] = time_slice_diffs(
          data, time_axis=time_axis, slice_axis=slice_axis
      )
      return screen_res
  
file_path: nipy/nipy/algorithms/diagnostics/screens.py
imports: import warnings
  from os.path import join
  import numpy
  from ...core.api import Image, drop_io_dim
  from ...core.reference.coordinate_map import AxisError, input_axis_index
  from ...io.api import save_image
  from ..utils import pca
  from .timediff import time_slice_diffs
  from .tsdiffplot import plot_tsdiffs
label_desc: Use image node_id 1 for calling a global function with example usage: screen(img4d, ncomp, time_axis, slice_axis) and returns: screen_res