code: def test_slice_from_3d():
      # Resample a 3d image, returning a zslice, yslice and xslice
      #
      # This example creates a coordmap that coincides with
      # a given z, y, or x slice of an image, and checks that
      # resampling agrees with the data in the given slice.
      shape = (100, 90, 80)
      g = AffineTransform.from_params(
          "ijk", "xyz", np.diag([0.5, 0.5, 0.5, 1])
      )
      img = Image(np.ones(shape), g)
      img.get_fdata()[50:55, 40:55, 30:33] = 3
      I = np.identity(4)
      zsl = slices.zslice(
          26, ((0, 49.5), 100), ((0, 44.5), 90), img.reference
      )
      ir = resample(img, zsl, I, (100, 90))
      assert_array_almost_equal(
          ir.get_fdata(), img[:, :, 53].get_fdata()
      )
      ysl = slices.yslice(
          22, ((0, 49.5), 100), ((0, 39.5), 80), img.reference
      )
      ir = resample(img, ysl, I, (100, 80))
      assert_array_almost_equal(
          ir.get_fdata(), img[:, 45, :].get_fdata()
      )
      xsl = slices.xslice(
          15.5, ((0, 44.5), 90), ((0, 39.5), 80), img.reference
      )
      ir = resample(img, xsl, I, (90, 80))
      assert_array_almost_equal(
          ir.get_fdata(), img[32, :, :].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 14 for calling a global function with example usage: test_slice_from_3d() without return types