code: def _slow_dist(bw, metric):
      sd = np.empty(bw.shape, np.double)
      sd.fill(np.inf)
      Y, X = np.indices(bw.shape)
      for y, x in zip(*np.where(~bw)):
          sd = np.minimum(sd, (Y - y) ** 2 + (X - x) ** 2)
      if metric == "euclidean":
          sd = np.sqrt(sd)
      return sd
  
file_path: mahotas/mahotas/tests/test_distance.py
imports: from mahotas import distance
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _slow_dist(bw, metric) and returns: sd