code: def test_time_slice_axes():
      # Test time and slice axes work as expected
      fimg = load_image(funcfile)
      # Put into array
      data = fimg.get_fdata()
      orig_results = tsd.time_slice_diffs(data)
      t0_data = np.rollaxis(data, 3)
      t0_results = tsd.time_slice_diffs(t0_data, 0)
      for key in ("volume_means", "slice_mean_diff2"):
          assert_array_almost_equal(orig_results[key], t0_results[key])
      s0_data = np.rollaxis(data, 2)
      s0_results = tsd.time_slice_diffs(s0_data, slice_axis=0)
      for key in ("volume_means", "slice_mean_diff2"):
          assert_array_almost_equal(orig_results[key], s0_results[key])
      # Incorrect slice axis
      bad_s0_results = tsd.time_slice_diffs(s0_data)
      assert (
          orig_results["slice_mean_diff2"].shape
          != bad_s0_results["slice_mean_diff2"].shape
      )
      # Slice axis equal to time axis - ValueError
      pytest.raises(ValueError, tsd.time_slice_diffs, data, -1, -1)
      pytest.raises(ValueError, tsd.time_slice_diffs, data, -1, 3)
      pytest.raises(ValueError, tsd.time_slice_diffs, data, 1, 1)
      pytest.raises(ValueError, tsd.time_slice_diffs, data, 1, -3)
  
file_path: nipy/nipy/algorithms/diagnostics/tests/test_time_difference.py
imports: from os.path import dirname
  from os.path import join
  import numpy
  import pytest
  import scipy.io
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from nipy import load_image
  from nipy.testing import funcfile
  from ....core.api import rollimg
  from ....core.reference.coordinate_map import AxisError
  from ..None import timediff
label_desc: Use image node_id 2 for calling a global function with example usage: test_time_slice_axes() without return types