Ejemplo n.º 1
0
sc.add_to_subplot(s_obj_data, row=1, col=3, title='Color sources using data',
                  **S_KW)
sc.add_to_subplot(cb_data, row=1, col=4, width_max=60)

###############################################################################
# Project source's activity on the surface of the brain
###############################################################################
# As explained in the BrainObj tutorial, source's activity can be projected on
# the surface of the brain which can be particularly convenient for represent
# source's activity across several intracranially implanted subjects

# Define the source and brain objects
s_proj = SourceObj('proj', xyz, data=rnd_data)
b_proj = BrainObj('B3', translucent=False)
# Project source's activity on the surface of the brain
s_proj.project_sources(b_proj, cmap='inferno')
sc.add_to_subplot(b_proj, row=2, col=0, title="Project source's activity")

###############################################################################
# Project masked source's activity on the surface of the brain
###############################################################################
# This is the exact same example as above, except that we also project masked
# sources

# Define the source and brain objects
s_mask = SourceObj('mask', xyz, data=rnd_data, mask=mask, mask_color='gray')
b_mask = BrainObj('B3', translucent=False)
# Project source's activity on the surface of the brain
s_mask.project_sources(b_mask, cmap='viridis', radius=15.)
sc.add_to_subplot(b_mask, row=2, col=1,
                  title="Project masked source's activity")
Ejemplo n.º 2
0
###############################################################################
# Project source's data onto the surface of ROI mesh
###############################################################################
# Once you've extract the mesh of the ROI, you can explicitly specify to the
# :class:`visbrain.object.SourceObj.project_sources` to project the activity
# onto the surface of the ROI. Here, we extract the mesh of the default mode
# network (DMN) and project source's activity on it

# Define the roi object using the MIST at resolution 7
roi_dmn = RoiObj('mist_7')
roi_dmn.get_labels(save_to_path=vb_path)  # save the labels
dmn_idx = roi_dmn.where_is('Default mode network')
roi_dmn.select_roi(select=dmn_idx)
# Define the source object and project source's data on the DMN
s_dmn = SourceObj('SecondSources', xyz, data=data)
s_dmn.project_sources(roi_dmn, cmap='plasma', clim=(-1., 1.), vmin=-.5,
                      vmax=.7, under='gray', over='red')
# Get the colorbar of the projection
cb_dmn = ColorbarObj(s_dmn, cblabel='Source activity', **CBAR_STATE)
# Add those objects to the scene
sc.add_to_subplot(roi_dmn, row=0, col=2, rotate='top', zoom=.4,
                  title="Project source's activity onto the DMN")
sc.add_to_subplot(cb_dmn, row=0, col=3, width_max=200)


###############################################################################
# Get anatomical informations of sources
###############################################################################
# If you defined sources (like intracranial recording sites, MEG source
# reconstruction...) you can use the SourceObj to defined those sources and
# then, the RoiObj to identify where are those sources located using the ROI
# volume. Here, we use the MIST at the `ROI` resolution to identify where are
Ejemplo n.º 3
0
# Once you've extract the mesh of the ROI, you can explicitly specify to the
# :class:`visbrain.object.SourceObj.project_sources` to project the activity
# onto the surface of the ROI. Here, we extract the mesh of the default mode
# network (DMN) and project source's activity on it

# Define the roi object using the MIST at resolution 7
roi_dmn = RoiObj('mist_7')
roi_dmn.get_labels(save_to_path=vb_path)  # save the labels
dmn_idx = roi_dmn.where_is('Default mode network')
roi_dmn.select_roi(select=dmn_idx)
# Define the source object and project source's data on the DMN
s_dmn = SourceObj('SecondSources', xyz, data=data)
s_dmn.project_sources(roi_dmn,
                      cmap='plasma',
                      clim=(-1., 1.),
                      vmin=-.5,
                      vmax=.7,
                      under='gray',
                      over='red')
# Get the colorbar of the projection
cb_dmn = ColorbarObj(s_dmn, cblabel='Source activity', **CBAR_STATE)
# Add those objects to the scene
sc.add_to_subplot(roi_dmn,
                  row=0,
                  col=2,
                  rotate='top',
                  zoom=.4,
                  title="Project source's activity onto the DMN")
sc.add_to_subplot(cb_dmn, row=0, col=3, width_max=200)

###############################################################################
Ejemplo n.º 4
0
                  **KW)

###############################################################################
# Projection iEEG data on the surface of the brain
###############################################################################
# As explain above, we define a source object and project the source's activity
# on the surface of the brain

# First, define a brain object used for the projection
b_obj_proj = BrainObj('B3', hemisphere='both', translucent=False)
# Define the source object
s_obj = SourceObj('iEEG', xyz, data=data, cmap='inferno')
# Just for fun, color sources according to the data :)
s_obj.color_sources(data=data)
# Project source's activity
s_obj.project_sources(b_obj_proj, cmap='plasma')
# Finally, add the source and brain objects to the subplot
sc.add_to_subplot(s_obj, row=0, col=2, title='Project iEEG data', **KW)
sc.add_to_subplot(b_obj_proj, row=0, col=2, rotate='left', use_this_cam=True)
# Finally, add the colorbar :
cb_proj = ColorbarObj(s_obj, cblabel='Projection of niEEG data', **CBAR_STATE)
sc.add_to_subplot(cb_proj, row=0, col=3, width_max=200)

###############################################################################
# .. note::
#     Here, we used s_obj.project_sources(b_obj) to project source's activity
#     on the surface. We could also have used to b_obj.project_sources(s_obj)

###############################################################################
# Parcellize the brain
###############################################################################
Ejemplo n.º 5
0
                  title='Color sources using data',
                  **S_KW)
sc.add_to_subplot(cb_data, row=1, col=4, width_max=60)

###############################################################################
# Project source's activity on the surface of the brain
###############################################################################
# As explained in the BrainObj tutorial, source's activity can be projected on
# the surface of the brain which can be particularly convenient for represent
# source's activity across several intracranially implanted subjects

# Define the source and brain objects
s_proj = SourceObj('proj', xyz, data=rnd_data)
b_proj = BrainObj('B3', translucent=False)
# Project source's activity on the surface of the brain
s_proj.project_sources(b_proj, cmap='inferno')
sc.add_to_subplot(b_proj, row=2, col=0, title="Project source's activity")

###############################################################################
# Project masked source's activity on the surface of the brain
###############################################################################
# This is the exact same example as above, except that we also project masked
# sources

# Define the source and brain objects
s_mask = SourceObj('mask', xyz, data=rnd_data, mask=mask, mask_color='gray')
b_mask = BrainObj('B3', translucent=False)
# Project source's activity on the surface of the brain
s_mask.project_sources(b_mask, cmap='viridis', radius=15.)
sc.add_to_subplot(b_mask,
                  row=2,
Ejemplo n.º 6
0
                  title='Left hemisphere', **KW)

###############################################################################
# Projection iEEG data on the surface of the brain
###############################################################################
# As explain above, we define a source object and project the source's activity
# on the surface of the brain

# First, define a brain object used for the projection
b_obj_proj = BrainObj('B3', hemisphere='both', translucent=False)
# Define the source object
s_obj = SourceObj('iEEG', xyz, data=data, cmap='inferno')
# Just for fun, color sources according to the data :)
s_obj.color_sources(data=data)
# Project source's activity
s_obj.project_sources(b_obj_proj, cmap='plasma')
# Finally, add the source and brain objects to the subplot
sc.add_to_subplot(s_obj, row=0, col=2, title='Project iEEG data', **KW)
sc.add_to_subplot(b_obj_proj, row=0, col=2, rotate='left', use_this_cam=True)
# Finally, add the colorbar :
cb_proj = ColorbarObj(s_obj, cblabel='Projection of niEEG data', **CBAR_STATE)
sc.add_to_subplot(cb_proj, row=0, col=3, width_max=200)

###############################################################################
# .. note::
#     Here, we used s_obj.project_sources(b_obj) to project source's activity
#     on the surface. We could also have used to b_obj.project_sources(s_obj)

###############################################################################
# Parcellize the brain
###############################################################################
Ejemplo n.º 7
0
print(data.shape)

NSources = 200
index = np.random.choice(verts.shape[0], n_channels, replace=False)
xyz = verts[index]

brain_obj = BrainObj('Custom',
                     vertices=verts,
                     faces=faces,
                     normals=normals,
                     translucent=False)

source_object = SourceObj('iEEG', xyz, data=data[:, 0], cmap=colormap)

# Project source's activity
source_object.project_sources(brain_obj)
source_object.color_sources(data=data[:, 0])

# Finally, add the source and brain objects to the subplot
scene.add_to_subplot(source_object,
                     row=0,
                     col=0,
                     title='Project iEEG data',
                     **KW)
scene.add_to_subplot(brain_obj, row=0, col=0, rotate='left', use_this_cam=True)

# Finally, add the colorbar :
colorbar = ColorbarObj(source_object,
                       cblabel='Projection of niEEG data',
                       **CBAR_STATE)
scene.add_to_subplot(colorbar, row=0, col=1, width_max=200, rotate='up')