code: def test_identity_resample():
      """Test resampling of the VolumeImg with an identity affine."""
      shape = (3, 2, 5, 2)
      data = np.random.randint(0, 10, shape)
      affine = np.eye(4)
      affine[:3, -1] = 0.5 * np.array(shape[:3])
      ref_im = VolumeImg(data, affine, "mine")
      rot_im = ref_im.as_volume_img(affine, interpolation="nearest")
      assert_almost_equal(data, rot_im.get_fdata())
      # Now test when specifying only a 3x3 affine
      # rot_im = ref_im.as_volume_img(affine[:3, :3], interpolation='nearest')
      assert_almost_equal(data, rot_im.get_fdata())
      reordered_im = rot_im.xyz_ordered()
      assert_almost_equal(data, reordered_im.get_fdata())
  
imports: import copy
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ...transforms.affine_transform import AffineTransform
  from ...transforms.affine_utils import from_matrix_vector
  from ...transforms.transform import Transform
  from ..volume_img import CompositionError, VolumeImg
label_desc: Use image node_id 4 for calling a global function with example usage: test_identity_resample() without return types