当前位置: 首页>>代码示例>>Python>>正文


Python Brain.add_annotation方法代码示例

本文整理汇总了Python中surfer.Brain.add_annotation方法的典型用法代码示例。如果您正苦于以下问题:Python Brain.add_annotation方法的具体用法?Python Brain.add_annotation怎么用?Python Brain.add_annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在surfer.Brain的用法示例。


在下文中一共展示了Brain.add_annotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_annot

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
def test_annot():
    """Test plotting of annot
    """
    mlab.options.backend = 'test'
    annots = ['aparc', 'aparc.a2005s']
    borders = [True, False]
    alphas = [1, 0.5]
    brain = Brain(*std_args)
    for a, b, p in zip(annots, borders, alphas):
        brain.add_annotation(a, b, p)
开发者ID:joewalter,项目名称:PySurfer,代码行数:12,代码来源:test_viz.py

示例2: test_annot

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
def test_annot():
    """Test plotting of annot."""
    _set_backend()
    annots = ['aparc', 'aparc.a2005s']
    borders = [True, False, 2]
    alphas = [1, 0.5]
    brain = Brain(*std_args)
    for a, b, p in zip(annots, borders, alphas):
        brain.add_annotation(a, b, p)
    brain.set_surf('white')
    assert_raises(ValueError, brain.add_annotation, 'aparc', borders=-1)

    subj_dir = utils._get_subjects_dir()
    annot_path = pjoin(subj_dir, subject_id, 'label', 'lh.aparc.a2009s.annot')
    labels, ctab, names = nib.freesurfer.read_annot(annot_path)
    brain.add_annotation((labels, ctab))

    brain.close()
开发者ID:mwaskom,项目名称:PySurfer,代码行数:20,代码来源:test_viz.py

示例3: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
hemi = 'both'
surface = 'inflated'
view = 'frontal'

"""
Bring up the visualization
"""
brain = Brain(subject_id, hemi, surface, views=view,
              cortex="bone", background="ivory")

"""
Display the 'aparc' parcellation borders.
To use annotations that live in your subject's
label directory, just use the annot name.
"""
brain.add_annotation("aparc")

"""
You can also display the regions with "filled in" colors
"""
brain.add_annotation("aparc", borders=False)

"""
You may also provide a full path to an annotation file
at an arbitray location on the disc. You can also
plot things separately for the left and right hemispheres.
"""
subjects_dir = os.environ["SUBJECTS_DIR"]
annot_path = pjoin(subjects_dir, subject_id, "label", "lh.aparc.annot")
brain.add_annotation(annot_path, hemi='lh', borders=False, alpha=.75)
annot_path = pjoin(subjects_dir, subject_id, "label", "rh.aparc.a2009s.annot")
开发者ID:Nasim-photon,项目名称:PySurfer,代码行数:33,代码来源:plot_parcellation.py

示例4: BSD

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
----------
.. [1] Glasser MF et al. (2016) A multi-modal parcellation of human
       cerebral cortex. Nature 536:171-178.
"""
# Author: Eric Larson <[email protected]>
#
# License: BSD (3-clause)

from surfer import Brain

import mne

subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
                                        verbose=True)
labels = mne.read_labels_from_annot(
    'fsaverage', 'HCPMMP1', 'lh', subjects_dir=subjects_dir)

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))
brain.add_annotation('HCPMMP1')
aud_label = [label for label in labels if label.name == 'L_A1_ROI-lh'][0]
brain.add_label(aud_label, borders=False)

###############################################################################
# We can also plot a combined set of labels (23 per hemisphere).

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))
brain.add_annotation('HCPMMP1_combined')
开发者ID:SherazKhan,项目名称:mne-python,代码行数:32,代码来源:plot_parcellation.py

示例5:

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
rh_aparc_file = os.path.join(label_dir, right_label_file)
lh_labels, lh_ctab, lh_names = nb.freesurfer.read_annot(lh_aparc_file)
rh_labels, rh_ctab, rh_names = nb.freesurfer.read_annot(rh_aparc_file)
left_df = left_df.set_index('col').loc[lh_names].reset_index().fillna(0)
right_df = right_df.set_index('col').loc[rh_names].reset_index().fillna(0)
vtx_lh = left_df.val.values[lh_labels]
vtx_lh[lh_labels == -1] = 0
vtx_rh = right_df.val.values[rh_labels]
vtx_rh[rh_labels == -1] = 0

brain.add_data(vtx_lh,
               0,
               400,
               colormap="Reds",
               alpha=.8,
               hemi='lh')

brain.add_annotation(lh_aparc_file, hemi='lh')

brain.add_data(vtx_rh,
               0,
               400,
               colormap="Reds",
               alpha=.8,
               hemi='rh')

brain.add_annotation(rh_aparc_file, hemi='rh', remove_existing=False)
save_name = "../images/{}_brain.png".format(save_name)
brain.save_image(save_name)

开发者ID:YSanchezAraujo,项目名称:genus,代码行数:31,代码来源:plot_brain.py

示例6: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
#Run with  ipython --gui=wx


from os import environ
from os.path import join
import numpy as np
from surfer import Brain, io

import os
import os.path as op
import numpy.random as random


subject_id = 'fsaverage'
hemi = "rh"
surf = "pial"
bkrnd = "white"

brain = Brain(subject_id, hemi, surf, config_opts=dict(background=bkrnd))
brain.add_annotation(op.abspath("%s.Lausanne1015_fsavg.annot" % hemi), borders=False)
开发者ID:GIGA-Consciousness,项目名称:structurefunction,代码行数:22,代码来源:plotrois.py

示例7: any

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
# Maybe load some morphometry
if args.morphometry is not None:
    b.add_morphometry(args.morphometry)

# Maybe load an overlay
if args.overlay is not None:
    if args.range is not None:
        args.min, args.max = args.range

    b.add_overlay(args.overlay, args.min, args.max, args.sign)

# Maybe load an annot
if args.annotation is not None:
    if not args.borders:
        args.borders = any([args.overlay, args.morphometry])
    b.add_annotation(args.annotation, args.borders)

# Maybe load a label
if args.label is not None:
    if not args.borders:
        args.borders = any([args.overlay, args.morphometry])
    b.add_label(args.label, args.borders)

# Also point brain at the Brain() object
brain = b

# It's nice to have mlab in the namespace, but we'll import it
# after the other stuff so getting usage is not interminable
from enthought.mayavi import mlab

# Now clean up the namespace a bit
开发者ID:satra,项目名称:PySurfer,代码行数:33,代码来源:_pysurfer-load.py

示例8: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
import mne

subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
                                        verbose=True)

mne.datasets.fetch_aparc_sub_parcellation(subjects_dir=subjects_dir,
                                          verbose=True)

labels = mne.read_labels_from_annot(
    'fsaverage', 'HCPMMP1', 'lh', subjects_dir=subjects_dir)

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))
brain.add_annotation('HCPMMP1')
aud_label = [label for label in labels if label.name == 'L_A1_ROI-lh'][0]
brain.add_label(aud_label, borders=False)

###############################################################################
# We can also plot a combined set of labels (23 per hemisphere).

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))
brain.add_annotation('HCPMMP1_combined')

###############################################################################
# We can add another custom parcellation

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))
开发者ID:Eric89GXL,项目名称:mne-python,代码行数:32,代码来源:plot_parcellation.py

示例9: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
hemi = "both"
surface = "inflated"
view = "frontal"


"""
Bring up the visualization
"""
brain = Brain(subject_id, hemi, surface, views=view, config_opts={"cortex": "bone", "background": "ivory"})

"""
Display the 'aparc' parcellation borders.
To use annotations that live in your subject's
label directory, just use the annot name.
"""
brain.add_annotation("aparc")

"""
You can also display the regions with "filled in" colors
"""
brain.add_annotation("aparc", borders=False)

"""
You may also provide a full path to an annotation file
at an arbitray location on the disc. You can also
plot things separately for the left and right hemispheres.
"""
subjects_dir = os.environ["SUBJECTS_DIR"]
annot_path = pjoin(subjects_dir, subject_id, "label", "lh.aparc.annot")
brain.add_annotation(annot_path, hemi="lh", borders=False)
annot_path = pjoin(subjects_dir, subject_id, "label", "rh.aparc.a2009s.annot")
开发者ID:krsna6,项目名称:PySurfer,代码行数:33,代码来源:plot_parcellation.py

示例10: surfer

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
def surfer(hemi, overlay, annot='Yeo2011_7Networks_N1000'):
    brain = Brain("fsaverage", hemi, "inflated")
    brain.add_annotation(annot, borders=False, alpha=0.3)
    brain.add_overlay(overlay, min=1.66, max=4)
    return brain
开发者ID:jelman,项目名称:rsfmri_pib,代码行数:7,代码来源:surface_display.py

示例11: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]

subject_id = 'fsaverage'
hemi = 'lh'
surface = 'inflated'

"""
Bring up the visualization
"""
brain = Brain(subject_id, hemi, surface)

"""
Display the 'aparc' parcellation borders.
To use annotations that live in your subject's
label directory, just use the annot name.
"""
brain.add_annotation("aparc")

"""
You can also display the regions with "filled in" colors
"""
brain.add_annotation("aparc", borders=False)

"""
You may also provide a full path to an annotation file 
at an arbitray location on the disc.
"""
subjects_dir = os.environ["SUBJECTS_DIR"]
annot_path = pjoin(subjects_dir, subject_id, "label", "lh.aparc.annot")
brain.add_annotation(annot_path)
开发者ID:hanke,项目名称:PySurfer,代码行数:31,代码来源:plot_parcellation.py

示例12: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
"""
Adapted from:
https://pysurfer.github.io/examples/plot_parc_values.html
"""
import numpy as np
import nibabel as nib
from surfer import Brain
subject_id = "fsaverage"
hemi "lh"
surface = "inflated"
brain = Brain(subject_id, hemi, surface, background="white")
surface = "inflated"
aparc_file = "/home/jelman/data_VETSA2/fsurf/fsaverage/label/lh.aparc.annot"
labels, ctab, names = nib.freesurfer.read_annot(aparc_file)

dat = np.genfromtxt('/home/jelman/test/ROI_data.csv',delimiter=",",skip_header=1)
roi_data = dat[:,1]
vtx_data = roi_data[labels]
brain = Brain('fsaverage', 'lh', 'orig', cortex='low_contrast')
brain.add_annotation("aparc")
brain.add_data(vtx_data, .4, .7, colormap="Reds", hemi='lh',thresh=.1, alpha=.8)

brain = Brain('fsaverage', 'split', 'inflated', views=['lat', 'med'])
开发者ID:jelman,项目名称:misc,代码行数:25,代码来源:displayROIvalues.py

示例13: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
import os
import os.path as op
from surfer import Brain, io

from coma.datasets import sample
data_path = sample.data_path()

subjects_dir = op.join(data_path, "subjects")
os.environ['SUBJECTS_DIR'] = subjects_dir

subject_id = "Bend1"
hemi = "lh"
surf = "pial"
bgcolor = 'w'

brain = Brain(subject_id, hemi, surf, config_opts={'background': bgcolor},
    subjects_dir=subjects_dir)

annot_path = op.join(subjects_dir, subject_id, "label", "%s.aparc.annot" % hemi)
assert(op.exists(annot_path))
brain.add_annotation(annot_path, borders=False)

image = brain.save_montage("Example_FreesurferRegions.png", ['l', 'd', 'm'], orientation='v')
brain.close()
开发者ID:GIGA-Consciousness,项目名称:structurefunction,代码行数:26,代码来源:example_plot_FS_rois.py

示例14: BSD

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
          Of particular relevance:

              "I will acknowledge the use of WU-Minn HCP data and data
              derived from WU-Minn HCP data when publicly presenting any
              results or algorithms that benefitted from their use."

References
----------
.. [1] Glasser MF et al. (2016) A multi-modal parcellation of human
       cerebral cortex. Nature 536:171-178.
"""
# Author: Eric Larson <[email protected]>
#
# License: BSD (3-clause)

from surfer import Brain

import mne

subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
                                        verbose=True)
labels = mne.read_labels_from_annot(
    'fsaverage', 'HCPMMP1', 'lh', subjects_dir=subjects_dir)

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))
brain.add_annotation('HCPMMP1')
aud_label = [label for label in labels if label.name == 'L_A1_ROI-lh'][0]
brain.add_label(aud_label, borders=False)
开发者ID:Hugo-W,项目名称:mne-python,代码行数:32,代码来源:plot_parcellation.py

示例15: Brain

# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import add_annotation [as 别名]
Display ROIs based on MNE estimates and select dipoles for causality analysis.
'''

import os
import glob
import mne
from surfer import Brain

subjects_dir = os.environ['SUBJECTS_DIR']
stcs_path = subjects_dir + '/fsaverage/conf_stc/'
labels_dir = stcs_path + 'STC_ROI/func/'

subject_id = 'fsaverage'
hemi = "split"
# surf = "smoothwm"
surf = 'inflated'
fn_list = glob.glob(labels_dir + '*')
brain = Brain(subject_id, hemi, surf)
color = ['#990033', '#9900CC', '#FF6600', '#FF3333', '#00CC33']

i = 0
for fn_label in fn_list:
        label_name = os.path.split(fn_label)[-1]
        # if label_name.split('_')[0] == 'sti,RRst':
        i = i + 1
        ind = i % 5
        label = mne.read_label(fn_label)
        brain.add_label(label, color=color[ind], alpha=0.8)

brain.add_annotation(annot='aparc', borders=True)
开发者ID:dongqunxi,项目名称:jumeg,代码行数:32,代码来源:plot_labels.py


注:本文中的surfer.Brain.add_annotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。