code: def test_reorder_labels(rng):
      """When labels have non-consecutive integers, make them consecutive by \
      reordering them to make no gaps/differences between integers.
  
      We expect labels to be of same shape even if they are reordered.
  
      Issue #938, comment #14.
      """
      data = np.zeros((5, 5)) + 0.1 * rng.standard_normal(size=(5, 5))
      data[1:5, 1:5] = 1
  
      labels = np.zeros_like(data)
      labels[3, 3] = 1
      labels[1, 4] = 4  # giving integer which is non-consecutive
  
      labels = random_walker(data, labels)
      assert data.shape == labels.shape
  
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 6 for calling a global function with example usage: test_reorder_labels(rng) without return types