code: def test_local_max(affine_eye):
      """Basic test of nilearn.reporting._get_clusters_table._local_max()"""
      shape = (9, 10, 11)
      # Two maxima (one global, one local), 10 voxels apart.
      data = np.zeros(shape)
      data[4, 5, :] = [4, 3, 2, 1, 1, 1, 1, 1, 2, 3, 4]
      data[5, 5, :] = [5, 4, 3, 2, 1, 1, 1, 2, 3, 4, 6]
      data[6, 5, :] = [4, 3, 2, 1, 1, 1, 1, 1, 2, 3, 4]
  
      ijk, vals = _local_max(data, affine_eye, min_distance=9)
      assert np.array_equal(
          ijk, np.array([[5.0, 5.0, 10.0], [5.0, 5.0, 0.0]])
      )
      assert np.array_equal(vals, np.array([6, 5]))
  
      ijk, vals = _local_max(data, affine_eye, min_distance=11)
      assert np.array_equal(ijk, np.array([[5.0, 5.0, 10.0]]))
      assert np.array_equal(vals, np.array([6]))
  
      # Two global (equal) maxima, 10 voxels apart.
      data = np.zeros(shape)
      data[4, 5, :] = [4, 3, 2, 1, 1, 1, 1, 1, 2, 3, 4]
      data[5, 5, :] = [5, 4, 3, 2, 1, 1, 1, 2, 3, 4, 5]
      data[6, 5, :] = [4, 3, 2, 1, 1, 1, 1, 1, 2, 3, 4]
  
      ijk, vals = _local_max(data, affine_eye, min_distance=9)
      assert np.array_equal(
          ijk, np.array([[5.0, 5.0, 0.0], [5.0, 5.0, 10.0]])
      )
      assert np.array_equal(vals, np.array([5, 5]))
  
      ijk, vals = _local_max(data, affine_eye, min_distance=11)
      assert np.array_equal(ijk, np.array([[5.0, 5.0, 0.0]]))
      assert np.array_equal(vals, np.array([5]))
  
      # A donut.
      data = np.zeros(shape)
      data[4, 5, :] = [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]
      data[5, 5, :] = [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]
      data[6, 5, :] = [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]
  
      ijk, vals = _local_max(data, affine_eye, min_distance=9)
      assert np.array_equal(ijk, np.array([[4.0, 5.0, 5.0]]))
      assert np.array_equal(vals, np.array([1]))
  
file_path: nilearn/nilearn/reporting/tests/test_reporting.py
imports: import nibabel
  import numpy
  import pytest
  from nilearn.image import get_data
  from nilearn.plotting import _set_mpl_backend
  from nilearn.reporting import get_clusters_table
  from nilearn.reporting.get_clusters_table import _cluster_nearest_neighbor, _local_max
label_desc: Use image node_id 1 for calling a global function with example usage: test_local_max(affine_eye) without return types