code: def test_resample_outvalue():
      arr = np.arange(3 * 3 * 3).reshape(3, 3, 3)
      img = Image(arr, vox2mni(np.eye(4)))
      aff = np.eye(4)
      aff[0, 3] = 1.0
      for transform in (aff, ApplyAffine(aff)):
          for order in (1, 3):
              # Default interpolation outside is constant == 0
              img2 = resample(img, transform, interp_order=order)
              arr2 = img2.get_fdata()
              exp_arr = np.zeros_like(arr)
              exp_arr[:-1, :, :] = arr[1:, :, :]
              assert_array_equal(arr2, exp_arr)
              # Test explicit constant value of 0
              img2 = resample(
                  img,
                  transform,
                  interp_order=order,
                  mode="constant",
                  cval=0.0,
              )
              exp_arr = np.zeros(arr.shape)
              exp_arr[:-1, :, :] = arr[1:, :, :]
              assert_array_almost_equal(img2.get_fdata(), exp_arr)
              # Test constant value of 1
              img2 = resample(
                  img,
                  transform,
                  interp_order=order,
                  mode="constant",
                  cval=1.0,
              )
              exp_arr[-1, :, :] = 1
              assert_array_almost_equal(img2.get_fdata(), exp_arr)
              # Test nearest neighbor
              img2 = resample(
                  img, transform, interp_order=order, mode="nearest"
              )
              exp_arr[-1, :, :] = arr[-1, :, :]
              assert_array_almost_equal(img2.get_fdata(), exp_arr)
  
imports: import numpy
  from nibabel.affines import apply_affine
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ....core.api import Image, vox2mni
  from ....core.image.image_spaces import as_xyz_image, xyz_affine
  from ..affine import Affine
  from ..resample import cast_array, resample
  from ..transform import Transform
label_desc: Use image node_id 11 for calling a global function with example usage: test_resample_outvalue() without return types