def relabel_non_zero(label_image, start = 1):
    r""" 
    Relabel the regions of a label image.
    Re-processes the labels to make them consecutively and starting from start.
    Keeps all zero (0) labels, as they are considered background.
    
    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  
    """
    if start <= 0: raise ArgumentError('The starting value can not be 0 or lower.')
    
    l = list(scipy.unique(label_image))
    if 0 in l: l.remove(0)
    mapping = dict()
    mapping[0] = 0
    for key, item in zip(l, list(range(start, len(l) + start))):
        mapping[key] = item
    
    return relabel_map(label_image, mapping)
def relabel_non_zero ( label_image , start = 1 ) : if start <= 0 : raise ArgumentError ( 'The starting value can not be 0 or lower.' ) l = list ( scipy . unique ( label_image ) ) if 0 in l : l . remove ( 0 ) mapping = dict ( ) mapping [ 0 ] = 0 for key , item in zip ( l , list ( range ( start , len ( l ) + start ) ) ) : mapping [ key ] = item return relabel_map ( label_image , mapping )
r""" 
    Relabel the regions of a label image.
    Re-processes the labels to make them consecutively and starting from start.
    Keeps all zero (0) labels, as they are considered background.
    
    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