Exemplo n.º 1
0
def compute_scores(pairs_fname = 'jaccard_pairs.lst'):
    with open(pairs_fname) as input:
        names = [s.split() for s in input.readlines()]
        for r in names:
            moving_dir, moving_base, moving_ext = decompose_path(r[0])
            fixed_dir, fixed_base, fixed_ext = decompose_path(r[1])
            warped_name = "warpedDiff_"+moving_base+"_"+fixed_base+".nii.gz"
            compute_jaccard(r[2], warped_name, False)
            compute_target_overlap(r[2], warped_name, False)
Exemplo n.º 2
0
def get_labeling_info():
    '''
    labels, colors = get_labeling_info()
    '''
    dirname, base, ext = rcommon.decompose_path(__file__)
    common_labels_fname = dirname + 'common_labels.txt'

    with open(common_labels_fname) as f:
        lines=f.readlines()
    colors={}
    labels={}
    for line in lines:
        items=line.split()
        if not items:
            break
        colors[int(items[0])]=(float(items[2])/255.0, float(items[3])/255.0, float(items[4])/255.0)
        labels[int(items[0])]=items[1]
    return labels, colors
Exemplo n.º 3
0
def _load_dataset_info():
    dirname, base, ext = rcommon.decompose_path(__file__)
    fname = dirname + base + '.txt'
    if _os.path.isfile(fname):
        with open(fname) as f:
            lines = [s.strip() for s in f.readlines()]
            if len(lines) != 4:
                print('Warning: expected base directories for IBSR, LPBA and Brainweb in '+fname+' in that order. Found '+str(len(lines))+' lines in file, you may get unexpected results')
            else:
                global _ibsr_base_dir
                global _lpba_base_dir
                global _brainweb_base_dir
                global _scil_base_dir
                _ibsr_base_dir = lines[0]
                _lpba_base_dir = lines[1]
                _brainweb_base_dir = lines[2]
                _scil_base_dir = lines[3]
    else:
        print('Error: file not found. Expected base directories for IBSR, LPBA and Brainweb in text file "'+fname+'" in that order.')
Exemplo n.º 4
0
def get_labeling_info():
    '''
    labels, colors = get_labeling_info()
    '''
    dirname, base, ext = rcommon.decompose_path(__file__)
    common_labels_fname = dirname + 'common_labels.txt'

    with open(common_labels_fname) as f:
        lines = f.readlines()
    colors = {}
    labels = {}
    for line in lines:
        items = line.split()
        if not items:
            break
        colors[int(items[0])] = (float(items[2]) / 255.0,
                                 float(items[3]) / 255.0,
                                 float(items[4]) / 255.0)
        labels[int(items[0])] = items[1]
    return labels, colors