code: def test_save3(in_tmp_path):
      # A test to ensure that when a file is saved, the affine
      # and the data agree. In this case, things don't agree:
      # i) the pixdim is off
      # ii) makes the affine off
      step = np.array([3.45, 2.3, 4.5, 6.9])
      shape = (13, 5, 7, 3)
      mni_xyz = mni_csm(3).coord_names
      cmap = AT(
          CS("jkli"),
          CS(("t",) + mni_xyz[::-1]),
          from_matvec(np.diag([0, 3, 5, 1]), step),
      )
      data = np.random.standard_normal(shape)
      img = api.Image(data, cmap)
      save_image(img, TMP_FNAME)
      tmp = load_image(TMP_FNAME)
      # Detach image from file so we can delete it
      data = tmp.get_fdata().copy()
      img2 = api.Image(data, tmp.coordmap, tmp.metadata)
      del tmp
      assert tuple([img.shape[l] for l in [3, 2, 1, 0]]) == img2.shape
      a = np.transpose(img.get_fdata(), [3, 2, 1, 0])
      assert not np.allclose(img.affine, img2.affine)
      assert np.allclose(a, img2.get_fdata())
  
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 4 for calling a global function with example usage: test_save3(in_tmp_path) without return types