code: def test_resample2d():
      g = AffineTransform.from_params(
          "ij", "xy", np.diag([0.5, 0.5, 1])
      )
      i = Image(np.ones((100, 90)), g)
      i.get_fdata()[50:55, 40:55] = 3.0
      # This mapping describes a mapping from the "target" physical
      # coordinates to the "image" physical coordinates.  The 3x3 matrix
      # below indicates that the "target" physical coordinates are related
      # to the "image" physical coordinates by a shift of -4 in each
      # coordinate.  Or, to find the "image" physical coordinates, given
      # the "target" physical coordinates, we add 4 to each "target
      # coordinate".  The resulting resampled image should show the
      # overall image shifted -8,-8 voxels towards the origin
      a = np.identity(3)
      a[:2, -1] = 4.0
      ir = resample(i, i.coordmap, a, (100, 90))
      assert_array_almost_equal(ir.get_fdata()[42:47, 32:47], 3.0)
  
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 6 for calling a global function with example usage: test_resample2d() without return types