code: def test_against_matlab_results():
      fimg = load_image(funcfile)
      results = tsd.time_slice_diffs(fimg.get_fdata())
      # struct as record only to avoid deprecation warning
      tsd_results = sio.loadmat(
          pjoin(TEST_DATA_PATH, "tsdiff_results.mat"),
          struct_as_record=True,
          squeeze_me=True,
      )
      assert_array_almost_equal(
          results["volume_means"], tsd_results["g"]
      )
      assert_array_almost_equal(
          results["volume_mean_diff2"], tsd_results["imgdiff"]
      )
      assert_array_almost_equal(
          results["slice_mean_diff2"], tsd_results["slicediff"]
      )
      # next tests are from saved, reloaded volumes at 16 bit integer
      # precision, so are not exact, but very close, given that the mean
      # of this array is around 3200
      assert_array_almost_equal(
          results["diff2_mean_vol"],
          tsd_results["diff2_mean_vol"],
          decimal=1,
      )
      assert_array_almost_equal(
          results["slice_diff2_max_vol"],
          tsd_results["slice_diff2_max_vol"],
          decimal=1,
      )
  
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 3 for calling a global function with example usage: test_against_matlab_results() without return types