code: def test_modes_in_random_walker(rng):
      img = np.zeros((30, 30, 30)) + 0.1 * rng.standard_normal(
          size=(30, 30, 30)
      )
      img[9:21, 9:21, 9:21] = 1
      img[10:20, 10:20, 10:20] = 0
      labels = np.zeros_like(img)
      labels[6, 6, 6] = 1
      labels[14, 15, 16] = 2
      # default mode = cg
      random_walker_cg = random_walker(img, labels, beta=90)
      assert (random_walker_cg.reshape(img.shape)[6, 6, 6] == 1).all()
      assert img.shape == random_walker_cg.shape
      # test `mask` strategy of sub function _mask_edges_weights in laplacian
      labels[5:25, 26:29, 26:29] = -1
      random_walker(img, labels, beta=30)
  
file_path: nilearn/nilearn/_utils/tests/test_segmentation.py
imports: import numpy
  import pytest
  from nilearn._utils.segmentation import random_walker
label_desc: Use image node_id 1 for calling a global function with example usage: test_modes_in_random_walker(rng) without return types