code: def test_TriLinearInterpolator():
      # Place (0, 0, 0) at the bottom left of the image
      l, m, n, o = np.ogrid[0.5:6.51, 0.5:6.51, 0.5:6.51, 0:4]
      data = l + m + n + o
      data = data.astype("float32")
  
      tli = TriLinearInterpolator(data, (1, 1, 1))
      a, b, c = np.mgrid[0.5:6.5:1.6, 0.5:6.5:2.7, 0.5:6.5:3.8]
      for ii in range(a.size):
          x = a.flat[ii]
          y = b.flat[ii]
          z = c.flat[ii]
          expected_result = x + y + z + o.ravel()
          npt.assert_array_almost_equal(
              tli[x, y, z], expected_result, decimal=5
          )
          ind = np.array([x, y, z])
          npt.assert_array_almost_equal(tli[ind], expected_result)
  
      # Index at 0
      expected_value = np.arange(4) + 1.5
      npt.assert_array_almost_equal(tli[0, 0, 0], expected_value)
      # Index at shape
      expected_value = np.arange(4) + (6.5 * 3)
      npt.assert_array_almost_equal(tli[7, 7, 7], expected_value)
  
      npt.assert_raises(OutsideImage, tli.__getitem__, (-0.1, 0, 0))
      npt.assert_raises(OutsideImage, tli.__getitem__, (0, 7.01, 0))
  
file_path: dipy/dipy/core/tests/test_interpolation.py
imports: import numpy
  import numpy.testing
  import warnings
  from scipy.ndimage import map_coordinates
  from dipy.core.subdivide_octahedron import create_unit_sphere
  from dipy.core.interpolation import trilinear_interpolate4d, interpolate_scalar_2d, interpolate_scalar_3d, interpolate_vector_2d, interpolate_vector_3d, interpolate_scalar_nn_2d, interpolate_scalar_nn_3d, NearestNeighborInterpolator, TriLinearInterpolator, OutsideImage, map_coordinates_trilinear_iso, interp_rbf
  from dipy.align import floating
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 9 for calling a global function with example usage: test_TriLinearInterpolator() without return types