def _relabel(vol_data, labels, forcecheck=False):
    if forcecheck:
        vd = np.unique(vol_data.flat)
        assert (len(vd) == len(labels)), 'number of given labels does not match number of actual labels'
    new_vol_data = np.zeros(vol_data.shape, vol_data.dtype)
    for (idx, val) in np.ndenumerate(labels):
        new_vol_data[(vol_data == val)] = idx
    return new_vol_data
def _relabel(vol_data, labels, forcecheck=False):
    if forcecheck:
        vd = np.unique(vol_data.flat)
        assert (len(vd) == len(labels)), 'number of given labels does not match number of actual labels'
    new_vol_data = np.zeros(vol_data.shape, vol_data.dtype)
    for (idx, val) in np.ndenumerate(labels):
        new_vol_data[(vol_data == val)] = idx
    return new_vol_data