code: def test_2d_from_3d():
      # Resample a 3d image on a 2d affine grid
      # This example creates a coordmap that coincides with
      # the 10th slice of an image, and checks that
      # resampling agrees with the data in the 10th slice.
      shape = (100, 90, 80)
      g = AffineTransform.from_params(
          "ijk", "xyz", np.diag([0.5, 0.5, 0.5, 1])
      )
      i = Image(np.ones(shape), g)
      i.get_fdata()[50:55, 40:55, 30:33] = 3.0
      a = np.identity(4)
      g2 = ArrayCoordMap.from_shape(g, shape)[10]
      ir = resample(i, g2.coordmap, a, g2.shape)
      assert_array_almost_equal(ir.get_fdata(), i[10].get_fdata())
  
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 13 for calling a global function with example usage: test_2d_from_3d() without return types