code: def test_screen():
      img = ni.load_image(funcfile)
      # rename third axis to slice to match default of screen
      # This avoids warnings about future change in default; see the tests for
      # slice axis below
      img = img.renamed_axes(k="slice")
      res = screen(img)
      assert res["mean"].ndim == 3
      assert res["pca"].ndim == 4
      assert sorted(res.keys()) == [
          "max",
          "mean",
          "min",
          "pca",
          "pca_res",
          "std",
          "ts_res",
      ]
      data = img.get_fdata()
      # Check summary images
      assert_array_equal(np.max(data, axis=-1), res["max"].get_fdata())
      assert_array_equal(
          np.mean(data, axis=-1), res["mean"].get_fdata()
      )
      assert_array_equal(np.min(data, axis=-1), res["min"].get_fdata())
      assert_array_equal(np.std(data, axis=-1), res["std"].get_fdata())
      pca_res = pca(data, axis=-1, standardize=False, ncomp=10)
      # On windows, there seems to be some randomness in the PCA output vector
      # signs; this routine sets the basis vectors to have first value positive,
      # and therefore standardizes the signs
      pca_res = res2pos1(pca_res)
      _check_pca(res, pca_res)
      _check_ts(res, data, 3, 2)
      # Test that screens accepts and uses time axis
      data_mean = data.mean(axis=-1)
      res = screen(img, time_axis="t")
      assert_array_equal(data_mean, res["mean"].get_fdata())
      _check_pca(res, pca_res)
      _check_ts(res, data, 3, 2)
      res = screen(img, time_axis=-1)
      assert_array_equal(data_mean, res["mean"].get_fdata())
      _check_pca(res, pca_res)
      _check_ts(res, data, 3, 2)
      t0_img = rollimg(img, "t")
      t0_data = np.rollaxis(data, -1)
      res = screen(t0_img, time_axis="t")
      t0_pca_res = pca(t0_data, axis=0, standardize=False, ncomp=10)
      t0_pca_res = res2pos1(t0_pca_res)
      assert_array_equal(data_mean, res["mean"].get_fdata())
      _check_pca(res, t0_pca_res)
      _check_ts(res, t0_data, 0, 3)
      res = screen(t0_img, time_axis=0)
      assert_array_equal(data_mean, res["mean"].get_fdata())
      _check_pca(res, t0_pca_res)
      _check_ts(res, t0_data, 0, 3)
      # Check screens uses slice axis
      s0_img = rollimg(img, 2, 0)
      s0_data = np.rollaxis(data, 2, 0)
      res = screen(s0_img, slice_axis=0)
      _check_ts(res, s0_data, 3, 0)
      # And defaults to named slice axis
      # First re-show that when we don't specify, we get the default
      res = screen(img)
      _check_ts(res, data, 3, 2)
      pytest.raises(AssertionError, _check_ts, res, data, 3, 0)
      # Then specify, get non-default
      slicey_img = img.renamed_axes(slice="k", i="slice")
      res = screen(slicey_img)
      _check_ts(res, data, 3, 0)
      pytest.raises(AssertionError, _check_ts, res, data, 3, 2)
  
imports: import os
  from os.path import join
  from warnings import catch_warnings, simplefilter
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  import nipy
  from nipy.core.api import rollimg
  from nipy.testing import funcfile
  from nipy.testing.decorators import needs_mpl_agg
  from ...utils.pca import pca
  from ...utils.tests.test_pca import res2pos1
  from ..screens import screen, write_screen_res
  from ..timediff import time_slice_diffs
label_desc: Use image node_id 3 for calling a global function with example usage: test_screen() without return types