algorithm/vol_tools.py
def dice_map_evaluate(data1, data2, filename = 'dice.pkl'):
    """
    Evaluate delineation accuracy by dice coefficient
    -------------------------------------------
    Parameters:
        data1, data2: raw data
    Output:
        dice: dice coefficient
    """
    if data1.ndim != data2.ndim:
        raise Exception('Two raw data need have the same dimensions')
    label1 = np.unique(data1)[1:]
    label2 = np.unique(data2)[1:]
    label = np.sort(np.unique(np.concatenate((label1, label2))))
    if data1.ndim == 3:
        data1 = np.expand_dims(data1, axis = 3)
    if data2.ndim == 3:
        data2 = np.expand_dims(data2, axis = 3)
    dice = []
    for i in range(data1.shape[3]):
        dice.append(calc_overlap(data1[...,i], data2[...,i], label1, label2))
    dice = np.array(dice)
    return dice

    Evaluate delineation accuracy by dice coefficient
    -------------------------------------------
    Parameters:
        data1, data2: raw data
    Output:
        dice: dice coefficient
    
Evaluate delineation accuracy by dice coefficient
Evaluate delineation accuracy by dice coefficient
def dice_map_evaluate(data1, data2, filename = 'dice.pkl'):
    if data1.ndim != data2.ndim:
        raise Exception('Two raw data need have the same dimensions')
    label1 = np.unique(data1)[1:]
    label2 = np.unique(data2)[1:]
    label = np.sort(np.unique(np.concatenate((label1, label2))))
    if data1.ndim == 3:
        data1 = np.expand_dims(data1, axis = 3)
    if data2.ndim == 3:
        data2 = np.expand_dims(data2, axis = 3)
    dice = []
    for i in range(data1.shape[3]):
        dice.append(calc_overlap(data1[...,i], data2[...,i], label1, label2))
    dice = np.array(dice)
    return dice
def dice_map_evaluate ( data1 , data2 , filename = 'dice.pkl' ) : if data1 . ndim != data2 . ndim : raise Exception ( 'Two raw data need have the same dimensions' ) label1 = np . unique ( data1 ) [ 1 : ] label2 = np . unique ( data2 ) [ 1 : ] label = np . sort ( np . unique ( np . concatenate ( ( label1 , label2 ) ) ) ) if data1 . ndim == 3 : data1 = np . expand_dims ( data1 , axis = 3 ) if data2 . ndim == 3 : data2 = np . expand_dims ( data2 , axis = 3 ) dice = [ ] for i in range ( data1 . shape [ 3 ] ) : dice . append ( calc_overlap ( data1 [ ... , i ] , data2 [ ... , i ] , label1 , label2 ) ) dice = np . array ( dice ) return dice
Evaluate delineation accuracy by dice coefficient
Evaluate delineation accuracy by dice coefficient
"""
    Evaluate delineation accuracy by dice coefficient
    -------------------------------------------
    Parameters:
        data1, data2: raw data
    Output:
        dice: dice coefficient
    """
data1
data2
filename
data1, data2
None