parcellate.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:graynet 作者: raamana 项目源码 文件源码
def read_atlas_annot(atlas_dir, hemi_list=None):
    " Returns atlas annotations "

    if hemi_list is None:
        hemi_list = ['lh', 'rh']

    annot = dict()
    for hemi in hemi_list:
        annot[hemi] = dict()
        annot_path = pjoin(atlas_dir, 'label', '{}.aparc.annot'.format(hemi))
        annot[hemi]['labels'], annot[hemi]['ctab'], annot[hemi]['names'] = nib.freesurfer.io.read_annot(annot_path,
                                                                                                        orig_ids=True)

        # ensuring names are plainstring
        if isinstance(annot[hemi]['names'][0], np.bytes_):
            annot[hemi]['names'] = [bytestr.decode('UTF-8') for bytestr in annot[hemi]['names']]

    return annot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号