code: def test_creation():
      # This is the simplest possible example, where there is a thing we are
      # optimizing, and an optional pre and post transform
      # Reset the aff2 object
      aff2_obj = Affine(AFF2.copy())
      ct = ChainTransform(aff2_obj)
      # Check apply gives expected result
      assert_array_equal(ct.apply(POINTS), apply_affine(AFF2, POINTS))
      # Check that result is changed by setting params
      assert_array_equal(ct.param, aff2_obj.param)
      ct.param = np.zeros((12,))
      assert_array_almost_equal(ct.apply(POINTS), POINTS)
      # Does changing params in chain object change components passed in?
      assert_array_almost_equal(aff2_obj.param, np.zeros((12,)))
      # Reset the aff2 object
      aff2_obj = Affine(AFF2.copy())
      # Check apply gives the expected results
      ct = ChainTransform(aff2_obj, pre=AFF1_OBJ)
      assert_array_almost_equal(AFF1_OBJ.as_affine(), AFF1)
      assert_array_almost_equal(aff2_obj.as_affine(), AFF2)
      tmp = np.dot(AFF2, AFF1)
      assert_array_almost_equal(
          ct.apply(POINTS), apply_affine(np.dot(AFF2, AFF1), POINTS)
      )
      # Check that result is changed by setting params
      assert_array_almost_equal(ct.param, aff2_obj.param)
      ct.param = np.zeros((12,))
      assert_array_almost_equal(
          ct.apply(POINTS), apply_affine(AFF1, POINTS)
      )
      # Does changing params in chain object change components passed in?
      assert_array_almost_equal(aff2_obj.param, np.zeros((12,)))
      # Reset the aff2 object
      aff2_obj = Affine(AFF2.copy())
      ct = ChainTransform(aff2_obj, pre=AFF1_OBJ, post=AFF3_OBJ)
      assert_array_almost_equal(
          ct.apply(POINTS),
          apply_affine(np.dot(AFF3, np.dot(AFF2, AFF1)), POINTS),
      )
      # Check that result is changed by setting params
      assert_array_equal(ct.param, aff2_obj.param)
      ct.param = np.zeros((12,))
      assert_array_almost_equal(
          ct.apply(POINTS), apply_affine(np.dot(AFF3, AFF1), POINTS)
      )
      # Does changing params in chain object change components passed in?
      assert_array_equal(aff2_obj.param, np.zeros((12,)))
  
imports: import numpy
  import numpy.linalg
  from nibabel.affines import apply_affine
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..affine import Affine
  from ..chain_transform import ChainTransform
label_desc: Use image node_id 1 for calling a global function with example usage: test_creation() without return types