

def get_tracts(tracts_folder):
    fname_tract = glob.glob(((tracts_folder + '/*') + '.nii.gz'))
    tracts = np.empty([len(fname_tract), 1], dtype=object)
    for label in range(0, len(fname_tract)):
        tracts[(label, 0)] = nib.load(fname_tract[label]).get_data()
    for label in range(0, len(fname_tract)):
        if (tracts[(label, 0)].ndim == 2):
            tracts[(label, 0)] = tracts[(label, 0)].reshape(int(np.size(tracts[(label, 0)], 0)), int(np.size(tracts[(label, 0)], 1)), 1)
    return tracts

dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/atlas/validate_atlas/generate_phantom.py get_tracts/original