code: def test_NearestNeighborInterpolator():
      # Place integers values at the center of every voxel
      l, m, n, o = np.ogrid[0:6.01, 0:6.01, 0:6.01, 0:4]
      data = l + m + n + o
  
      nni = NearestNeighborInterpolator(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 = int(x) + int(y) + int(z) + o.ravel()
          npt.assert_array_equal(nni[x, y, z], expected_result)
          ind = np.array([x, y, z])
          npt.assert_array_equal(nni[ind], expected_result)
      npt.assert_raises(OutsideImage, nni.__getitem__, (-0.1, 0, 0))
      npt.assert_raises(OutsideImage, nni.__getitem__, (0, 8.2, 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 8 for calling a global function with example usage: test_NearestNeighborInterpolator() without return types