code: def test_spacetimerealign_params():
      runs = [IM, IM]
      for slice_times in ("descending", "43210", st_43210, [2, 1, 0]):
          R = SpaceTimeRealign(
              runs, tr=3, slice_times=slice_times, slice_info=2
          )
          assert_array_equal(R.slice_times, (2, 1, 0))
          assert R.tr == 3
      for slice_times in ("asc_alt_2", "02413", st_02413, [0, 2, 1]):
          R = SpaceTimeRealign(
              runs, tr=3, slice_times=slice_times, slice_info=2
          )
          assert_array_equal(R.slice_times, (0, 2, 1))
          assert R.tr == 3
      for slice_times in ("desc_alt_2", "42031", st_42031, [1, 2, 0]):
          R = SpaceTimeRealign(
              runs, tr=3, slice_times=slice_times, slice_info=2
          )
          assert_array_equal(R.slice_times, (1, 2, 0))
          assert R.tr == 3
      # Check changing axis
      R = SpaceTimeRealign(
          runs, tr=21, slice_times="ascending", slice_info=1
      )
      assert_array_equal(R.slice_times, np.arange(21))
      # Check slice_times and slice_info and TR required
      R = SpaceTimeRealign(runs, 3, "ascending", 2)  # OK
      pytest.raises(ValueError, SpaceTimeRealign, runs, 3, None, 2)
      pytest.raises(
          ValueError, SpaceTimeRealign, runs, 3, "ascending", None
      )
      pytest.raises(
          ValueError, SpaceTimeRealign, IMS[0], None, [0, 1, 2], 2
      )
      pytest.raises(
          ValueError, SpaceTimeRealign, IMS[1], None, [0, 1, 2], 2
      )
      pytest.raises(
          ValueError, SpaceTimeRealign, IMS[2:4], None, [0, 1, 2], 2
      )
      pytest.raises(
          ValueError,
          SpaceTimeRealign,
          IMS[0],
          "header-allow-1.0",
          [0, 1, 2],
          2,
      )
      R = SpaceTimeRealign(IMS[1], "header-allow-1.0", "ascending", 2)
      assert_array_equal(R.tr, 1.0)
      # Test when TR and nslices are not the same
      R1 = SpaceTimeRealign(
          runs, tr=2.0, slice_times="ascending", slice_info=2
      )
      assert_array_equal(R1.slice_times, np.arange(3) / 3.0 * 2.0)
      # Smoke test run
      R1.estimate(
          refscan=None, loops=1, between_loops=1, optimizer="steepest"
      )
  
imports: import warnings
  import nibabel
  import numpy
  import pytest
  from nibabel import io_orientation
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ....None import load_image
  from ....core.image.image_spaces import make_xyz_image, xyz_affine
  from ....io.nibcompat import get_header
  from ....testing import funcfile
  from ...slicetiming.timefuncs import st_02413, st_42031, st_43210
  from ..affine import Rigid
  from ..groupwise_registration import FmriRealign4d, Image4d, Realign4d, Realign4dAlgorithm, SpaceRealign, SpaceTimeRealign, make_grid, resample4d
label_desc: Use image node_id 15 for calling a global function with example usage: test_spacetimerealign_params() without return types