code: def test_get_clusters_table(affine_eye, tmp_path):
      shape = (9, 10, 11)
      data = np.zeros(shape)
      data[2:4, 5:7, 6:8] = 5.0
      data[4:6, 7:9, 8:10] = -5.0
      stat_img = nib.Nifti1Image(data, affine_eye)
  
      # test one cluster extracted
      cluster_table = get_clusters_table(
          stat_img, 4, 0, two_sided=False
      )
      assert len(cluster_table) == 1
  
      # test empty table on high stat threshold
      cluster_table = get_clusters_table(
          stat_img, 6, 0, two_sided=False
      )
      assert len(cluster_table) == 0
  
      # test empty table on high cluster threshold
      cluster_table = get_clusters_table(
          stat_img, 4, 9, two_sided=False
      )
      assert len(cluster_table) == 0
  
      # test two clusters with different signs extracted
      cluster_table = get_clusters_table(stat_img, 4, 0, two_sided=True)
      assert len(cluster_table) == 2
  
      # test empty table on high stat threshold
      cluster_table = get_clusters_table(stat_img, 6, 0, two_sided=True)
      assert len(cluster_table) == 0
  
      # test empty table on high cluster threshold
      cluster_table = get_clusters_table(stat_img, 4, 9, two_sided=True)
      assert len(cluster_table) == 0
  
      # test with filename
      fname = str(tmp_path / "stat_img.nii.gz")
      stat_img.to_filename(fname)
      cluster_table = get_clusters_table(fname, 4, 0, two_sided=True)
      assert len(cluster_table) == 2
  
      # test with returning label maps
      cluster_table, label_maps = get_clusters_table(
          stat_img,
          4,
          0,
          two_sided=True,
          return_label_maps=True,
      )
      label_map_positive_data = label_maps[0].get_fdata()
      label_map_negative_data = label_maps[1].get_fdata()
      # make sure positive and negative clusters are returned in the label maps
      assert np.sum(label_map_positive_data[2:4, 5:7, 6:8] != 0) == 8
      assert np.sum(label_map_negative_data[4:6, 7:9, 8:10] != 0) == 8
  
      # test with extra dimension
      data_extra_dim = data[..., np.newaxis]
      stat_img_extra_dim = nib.Nifti1Image(data_extra_dim, affine_eye)
      cluster_table = get_clusters_table(
          stat_img_extra_dim,
          4,
          0,
          two_sided=True,
      )
      assert len(cluster_table) == 2
  
      # Test that nans are handled correctly (No numpy axis errors are raised)
      data[data == 0] = np.nan
      stat_img_nans = nib.Nifti1Image(data, affine=affine_eye)
      cluster_table = get_clusters_table(
          stat_img_nans, 1e-2, 0, two_sided=False
      )
      assert len(cluster_table) == 1
  
      # Test that subpeaks are handled correctly for len(subpeak_vals) > 1
      # 1 cluster and two subpeaks, 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]
      stat_img = nib.Nifti1Image(data, affine_eye)
  
      cluster_table = get_clusters_table(stat_img, 0, 0, min_distance=9)
      assert len(cluster_table) == 2
      assert 1 in cluster_table["Cluster ID"].values
      assert "1a" in cluster_table["Cluster ID"].values
  
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 3 for calling a global function with example usage: test_get_clusters_table(affine_eye, tmp_path) without return types