code: def gvoronoi(labeled):
      """
      segmented = gvoronoi(labeled)
  
      Generalised Voronoi Transform.
  
      The generalised Voronoi diagram assigns to the pixel (i,j) the label of the
      nearest object (i.e., the value of the nearest non-zero pixel in labeled).
  
      Parameters
      ----------
      labeled : ndarray
          a labeled array, of a form similar to one returned by
          ``mahotas.label()``
  
      Returns
      -------
      segmented : is of the same size and type as labeled and
                  `segmented[y,x]` is the label of the object at position `y,x`.
      """
      labeled = np.ascontiguousarray(labeled)
      bw = labeled == 0
      f = np.zeros(bw.shape, np.double)
      f[bw] = len(f.shape) * max(f.shape) ** 2 + 1
      orig = np.arange(f.size, dtype=np.intc).reshape(f.shape)
      _distance.dt(f, orig)
      return labeled.flat[orig]
  
imports: from __future__ import division
  import numpy
  from .internal import _check_3
  from .None import _distance
  from .None import _labeled
label_desc: Use image node_id 1 for calling a global function with example usage: gvoronoi(labeled) and returns: labeled