lama/common.py
def check_labels_file(labelmap_file, label_info_file):
    """
    Given a label map and label file, check that the labels are all present in the info file and vice versa

    Parameters
    ----------
    labelmap_file: str
        path to labelmap
    label_info_file: str
    path to label info file

    Returns
    -------
    bool:
        True if they match
        False if not

    """

    label_map = sitk.GetArrayFromImage(sitk.ReadImage(labelmap_file))
    label_df = pd.read_csv(label_info_file, index_col=0)

    info_labels = [int(x) for x in label_df[['label']].values]
    map_labels = np.unique(label_map)

    if set(info_labels) == set(map_labels):
        return True
    else:
        return False

    Given a label map and label file, check that the labels are all present in the info file and vice versa

    Parameters
    ----------
    labelmap_file: str
        path to labelmap
    label_info_file: str
    path to label info file

    Returns
    -------
    bool:
        True if they match
        False if not

    
Given a label map and label file, check that the labels are all present in the info file and vice versa
Parameters

str
path to labelmap
label_info_file: str
path to label info file

Returns

True if they match
False if not
Given a label map and label file check that the labels are all present in the info file and vice versa Parameters str path to labelmap label_info_file : str path to label info file Returns True if they match False if not
def check_labels_file(labelmap_file, label_info_file):
    label_map = sitk.GetArrayFromImage(sitk.ReadImage(labelmap_file))
    label_df = pd.read_csv(label_info_file, index_col=0)
    info_labels = [int(x) for x in label_df[['label']].values]
    map_labels = np.unique(label_map)
    if set(info_labels) == set(map_labels):
        return True
    else:
        return False
def check_labels_file ( labelmap_file , label_info_file ) : label_map = sitk . GetArrayFromImage ( sitk . ReadImage ( labelmap_file ) ) label_df = pd . read_csv ( label_info_file , index_col = 0 ) info_labels = [ int ( x ) for x in label_df [ [ 'label' ] ] . values ] map_labels = np . unique ( label_map ) if set ( info_labels ) == set ( map_labels ) : return True else : return False
Given a label map and label file, check that the labels are all present in the info file and vice versa
Parameters
Given a label map and label file check that the labels are all present in the info file and vice versa Parameters
"""
    Given a label map and label file, check that the labels are all present in the info file and vice versa

    Parameters
    ----------
    labelmap_file: str
        path to labelmap
    label_info_file: str
    path to label info file

    Returns
    -------
    bool:
        True if they match
        False if not

    """
labelmap_file
label_info_file