code: def test_binary_blobs(ndim, distance):
      """Check some invariants with label expansion.
  
      - New labels array should exactly contain the original labels array.
      - Distance to old labels array within new labels should never exceed input
        distance.
      - Distance beyond the expanded labels should always exceed the input
        distance.
      """
      img = data.binary_blobs(
          length=64, blob_size_fraction=0.05, n_dim=ndim
      )
      labels = measure.label(img)
      expanded = expand_labels(labels, distance=distance)
      original_mask = labels != 0
      assert_array_equal(labels[original_mask], expanded[original_mask])
      expanded_only_mask = (expanded - labels).astype(bool)
      distance_map = ndi.distance_transform_edt(~original_mask)
      expanded_distances = distance_map[expanded_only_mask]
      if expanded_distances.size > 0:
          assert np.all(expanded_distances <= distance)
      beyond_expanded_distances = distance_map[~expanded.astype(bool)]
      if beyond_expanded_distances.size > 0:
          assert np.all(beyond_expanded_distances > distance)
  
file_path: scikit-image/skimage/segmentation/tests/test_expand_labels.py
imports: from scipy import ndimage
  from skimage import data
  import numpy
  from skimage import measure
  from skimage.segmentation._expand_labels import expand_labels
  from skimage._shared import testing
  from skimage._shared.testing import assert_array_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_blobs(ndim, distance) without return types