def __check_label_image(label_image):
    """Check the label image for consistent labelling starting from 1."""
    encountered_indices = scipy.unique(label_image)
    expected_indices = scipy.arange(1, label_image.max() + 1)
    if not encountered_indices.size == expected_indices.size or \
       not (encountered_indices == expected_indices).all():
        raise AttributeError('The supplied label image does either not contain any regions or they are not labeled consecutively starting from 1.')
Check the label image for consistent labelling starting from 1.