code: def test_image_creation(vars):
      # 3D image
      arr = np.arange(24).reshape(2, 3, 4)
      aff = np.diag([2, 3, 4, 1])
      img = Image(arr, vox2mni(aff))
      assert img.shape == (2, 3, 4)
      assert_array_equal(img.affine, aff)
      assert_array_equal(
          img.coordmap,
          AffineTransform(vars["d_cs_r3"], vars["r_cs_r3"], aff),
      )
      # 4D image
      arr = np.arange(24).reshape(2, 3, 4, 1)
      img = Image(arr, vox2mni(aff, 7))
      exp_aff = np.diag([2, 3, 4, 7, 1])
      assert img.shape == (2, 3, 4, 1)
      exp_cmap = AffineTransform(
          vars["d_cs_r4"], vars["r_cs_r4"], exp_aff
      )
      assert img.coordmap == exp_cmap
  
file_path: nipy/nipy/core/reference/tests/test_spaces.py
imports: import numpy
  import pytest
  from nibabel.affines import from_matvec
  from numpy.testing import assert_array_equal
  from ...image.image import Image
  from ..coordinate_map import AffineTransform, CoordinateMap
  from ..coordinate_system import CoordinateSystem
  from ..coordinate_system import CoordSysMakerError
  from ..spaces import AffineError, AxesError, SpaceError, SpaceTypeError, XYZSpace, get_world_cs, is_xyz_affable, is_xyz_space, known_space, known_spaces, mni_csm, mni_space, vox2aligned, vox2mni, vox2scanner, vox2talairach, vox2unknown, xyz_affine, xyz_order
label_desc: Use image node_id 5 for calling a global function with example usage: test_image_creation(vars) without return types