code: def test_resample_outvalue():
      # Test resampling with different modes, constant values, datatypes, orders
  
      def func(xyz):
          return xyz + np.asarray([1, 0, 0])
  
      coordmap = vox2mni(np.eye(4))
      arr = np.arange(3 * 3 * 3).reshape(3, 3, 3)
      aff = np.eye(4)
      aff[0, 3] = 1.0  # x translation
      for mapping, dt, order in product(
          [aff, func],
          [
              np.int8,
              np.intp,
              np.int32,
              np.int64,
              np.float32,
              np.float64,
          ],
          [0, 1, 3],
      ):
          img = Image(arr.astype(dt), coordmap)
          # Test constant value of 0
          img2 = resample(
              img,
              coordmap,
              mapping,
              img.shape,
              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,
              coordmap,
              mapping,
              img.shape,
              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,
              coordmap,
              mapping,
              img.shape,
              order=order,
              mode="nearest",
          )
          exp_arr[-1, :, :] = arr[-1, :, :]
          assert_array_almost_equal(img2.get_fdata(), exp_arr)
      # Test img2img
      target_coordmap = vox2mni(aff)
      target = Image(arr, target_coordmap)
      img2 = resample_img2img(img, target, 3, "nearest")
      assert_array_almost_equal(img2.get_fdata(), exp_arr)
      img2 = resample_img2img(img, target, 3, "constant", cval=1.0)
      exp_arr[-1, :, :] = 1
      assert_array_almost_equal(img2.get_fdata(), exp_arr)
  
imports: from itertools import product
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from nipy.algorithms.resample import resample, resample_img2img
  from nipy.core.api import AffineTransform, ArrayCoordMap, Image, vox2mni
  from nipy.core.reference import slices
  from nipy.io.api import load_image
  from nipy.testing import anatfile, funcfile
label_desc: Use image node_id 11 for calling a global function with example usage: test_resample_outvalue() and returns: unknown