code: def test_space_time_realign(in_tmp_path):
      path, fname = psplit(funcfile)
      original_affine = load_image(funcfile).affine
      path, fname = psplit(funcfile)
      froot, _ = fname.split(".", 1)
      # Make another image with .nii extension and extra dot in filename
      save_image(load_image(funcfile), "my.test.nii")
      for in_fname, out_fname in (
          (funcfile, froot + "_mc.nii.gz"),
          ("my.test.nii", "my.test_mc.nii.gz"),
      ):
          xforms = reg.space_time_realign(in_fname, 2.0, out_name=".")
          assert np.allclose(
              xforms[0].as_affine(), np.eye(4), atol=1e-7
          )
          assert not np.allclose(
              xforms[-1].as_affine(), np.eye(4), atol=1e-3
          )
          img = load_image(out_fname)
          npt.assert_almost_equal(original_affine, img.affine)
      # To avoid Windows "file ... used by another process" error when
      # removing temporary directory.
      gc.collect()
  
file_path: nipy/nipy/algorithms/registration/tests/test_scripting.py
imports: import gc
  from os.path import split
  import nibabel.eulerangles
  import numpy
  import numpy.testing
  import nipy.algorithms.registration
  from nipy.io.api import load_image, save_image
  from nipy.testing import funcfile
label_desc: Use image node_id 1 for calling a global function with example usage: test_space_time_realign(in_tmp_path) without return types