code: def test_transformation():
      """Test transforming images."""
      N = 10
      identity1 = Transform("world1", "world2", id, id)
      identity2 = AffineTransform("world1", "world2", np.eye(4))
      for identity in (identity1, identity2):
          data = np.random.random((N, N, N))
          img1 = VolumeImg(
              data=data,
              affine=np.eye(4),
              world_space="world1",
          )
          img2 = img1.composed_with_transform(identity)
  
          assert img2.world_space == "world2"
  
          x, y, z = N * np.random.random(size=(3, 10))
          assert_almost_equal(
              img1.values_in_world(x, y, z),
              img2.values_in_world(x, y, z),
          )
  
          pytest.raises(
              CompositionError,
              img1.composed_with_transform,
              identity.get_inverse(),
          )
  
          pytest.raises(CompositionError, img1.resampled_to_img, img2)
  
          # Resample an image on itself: it shouldn't change much:
          img = img1.resampled_to_img(img1)
          assert_almost_equal(data, img.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 11 for calling a global function with example usage: test_transformation() without return types