code: def test_binary_erosion(case, border_value, device):
      """Test the binary erosion function.
  
      Cases taken from:
      https://github.com/scipy/scipy/blob/v1.11.1/scipy/ndimage/tests/test_morphology.py
  
      """
      if device == "cuda" and not torch.cuda.is_available():
          pytest.skip("CUDA device not available.")
      scierosion = scibinary_erosion(case, border_value=border_value)
      erosion = binary_erosion(
          case.unsqueeze(0).unsqueeze(0).to(device),
          border_value=border_value,
      )
      assert torch.allclose(
          erosion.cpu(), torch.from_numpy(scierosion).byte()
      )
  
file_path: torchmetrics/tests/unittests/segmentation/test_utils.py
imports: import pytest
  import torch
  from monai.metrics.utils import get_code_to_measure_table
  from monai.metrics.utils import get_mask_edges
  from monai.metrics.utils import get_surface_distance
  from scipy.ndimage import binary_erosion
  from scipy.ndimage import distance_transform_cdt
  from scipy.ndimage import distance_transform_edt
  from scipy.ndimage import generate_binary_structure
  from torchmetrics.functional.segmentation.utils import binary_erosion, distance_transform, generate_binary_structure, get_neighbour_tables, mask_edges, surface_distance
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_erosion(case, border_value, device) without return types