code: def test_save2b(in_tmp_path):
      # A test to ensure that when a file is saved, the affine and the
      # data agree. This image comes from a NIFTI file.  This example has a
      # non-diagonal affine matrix for the spatial part, but is 'diagonal' for the
      # space part.
      #
      # make a 5x5 transformation (for 4d image)
      step = np.array([3.45, 2.3, 4.5, 6.9])
      A = np.random.standard_normal((3, 3))
      B = np.diag(list(step) + [1])
      B[:3, :3] = A
      shape = (13, 5, 7, 3)
      cmap = api.vox2mni(B)
      data = np.random.standard_normal(shape)
      img = api.Image(data, cmap)
      save_image(img, TMP_FNAME)
      img2 = load_image(TMP_FNAME)
      assert_array_almost_equal(img.affine, img2.affine)
      assert img.shape == img2.shape
      assert_array_almost_equal(img2.get_fdata(), img.get_fdata())
      del img2
  
file_path: nipy/nipy/io/tests/test_save.py
imports: import numpy
  from nibabel.affines import from_matvec
  from numpy.testing import assert_array_almost_equal
  from nipy.core import api
  from nipy.core.reference.coordinate_map import AffineTransform
  from nipy.core.reference.coordinate_system import CoordinateSystem
  from nipy.core.reference.spaces import mni_csm
  from nipy.io.api import load_image, save_image
  from nipy.testing import funcfile
label_desc: Use image node_id 3 for calling a global function with example usage: test_save2b(in_tmp_path) without return types