code: def relabel(label_image, start = 1):
      r
      label_image = scipy.asarray(label_image)
      mapping = {}
      rav = label_image.ravel()
      for i in range(len(rav)):
          if not rav[i] in mapping:
              mapping[rav[i]] = start
              start += 1
          rav[i] = mapping[rav[i]]
      return rav.reshape(label_image.shape)
docs: r"""
      Relabel the regions of a label image.
      Re-processes the labels to make them consecutively and starting from start.
      
      Parameters
      ----------
      label_image : array_like
          A nD label map.
      start : integer
          The id of the first label to assign
      
      Returns
      -------
      relabel_map : ndarray
          The relabelled label map.
          
      See also
      --------
      relabel_non_zero