示例#1
0
                     border=False,
                     **CBAR_STATE)
sc.add_to_subplot(b_rep, row=2, col=3, title="Project source's repartition")
sc.add_to_subplot(cb_rep, row=2, col=4)

###############################################################################
# Display only sources in the left hemisphere
###############################################################################
# In this little example, we illustrate how to only display sources in the left
# hemisphere

# Define the source object
s_obj_left = SourceObj('S_left', xyz, color='#ab4642')
# Select only sources that belong to the left hemisphere and add the object to
# the scene
s_obj_left.set_visible_sources('left')
sc.add_to_subplot(s_obj_left,
                  row=3,
                  col=0,
                  title='Display sources in left hemisphere',
                  **S_KW)

###############################################################################
# Force sources to fit to the surface of the brain
###############################################################################
# First, we force sources to fit to the white matter of the brain. Then, we use
# the talaich ROI to identify which sources belong to the left or right
# hemisphere and color them accordingly

# Define the Brain and Source objects
s_obj_fit = SourceObj('Fit', xyz, symbol='diamond')
示例#2
0
cb_rep = ColorbarObj(b_rep, cblabel='Number of sources\nper vertex',
                     border=False, **CBAR_STATE)
sc.add_to_subplot(b_rep, row=2, col=3, title="Project source's repartition")
sc.add_to_subplot(cb_rep, row=2, col=4)

###############################################################################
# Display only sources in the left hemisphere
###############################################################################
# In this little example, we illustrate how to only display sources in the left
# hemisphere

# Define the source object
s_obj_left = SourceObj('S_left', xyz, color='#ab4642')
# Select only sources that belong to the left hemisphere and add the object to
# the scene
s_obj_left.set_visible_sources('left')
sc.add_to_subplot(s_obj_left, row=3, col=0,
                  title='Display sources in left hemisphere', **S_KW)

###############################################################################
# Force sources to fit to the surface of the brain
###############################################################################
# First, we force sources to fit to the white matter of the brain. Then, we use
# the talaich ROI to identify which sources belong to the left or right
# hemisphere and color them accordingly

# Define the Brain and Source objects
s_obj_fit = SourceObj('Fit', xyz, symbol='diamond')
b_obj_fit = BrainObj('white', translucent=True)
# Get the vertices of the brain object and force sources to fit to those
# vertices
示例#3
0
"""Use a random data vector to color sources
"""
data = np.random.uniform(low=-10., high=10., size=(n_sources,))
s_obj_data = SourceObj('S3', xyz, data=data)
s_obj_data.color_sources(data=data, cmap='plasma', clim=(-10, 10), vmin=-8.,
                         vmax=8., under='gray', over='red')
sc.add_to_subplot(s_obj_data, row=1, col=2, title='Color sources using data')
cb_data = ColorbarObj(s_obj_data, cblabel='Random data', border=False,
                      **CBAR_STATE)
sc.add_to_subplot(cb_data, row=1, col=3, width_max=60)

"""Display only sources in the left hemisphere
"""
s_obj_left = SourceObj('S_left', xyz, color='#ab4642')
s_obj_left.set_visible_sources('left')
sc.add_to_subplot(s_obj_left, row=2, col=0,
                  title='Display sources in left hemisphere')

"""Create a sphere using VisPy
"""
sphere = create_sphere(rows=100, cols=100, radius=50)
sphere_vertices = sphere.get_vertices()

"""Force sources to fit on the vertices of the sphere. Then, we color sources
according to the hemisphere (left=purple, right=yellow)
"""
s_obj_fit = SourceObj('Fit', xyz, symbol='diamond')
s_obj_fit.fit_to_vertices(sphere_vertices)
df_tal = s_obj_fit.analyse_sources(roi_obj='talairach')
s_obj_fit.color_sources(analysis=df_tal, color_by='hemisphere',