# Define the hypothetical Talairach locations of each LSNM auditory modules a1 = [51, -24, 8] a2 = [61, -36, 12] # Ignore the ST posterior as we are especially interested in ST anterior (for now) #stp = [60,-39,12] sta = [59, -20, 1] apf = [51, 12, 10] plot_surface(CORTEX, op=0.1) # Plot the 998 nodes of Hagmann's brain (uncomment if needed for visualization # purposes region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.4, 0.4, 0.4), scale_factor=2.) # Now plot the hypothetical locations of LSNM visual modules # V1 ROI in yellow #v1_module = mlab.points3d(centres[v1_loc[1],0], # centres[v1_loc[1],1], # centres[v1_loc[1],2], # color=(1, 1, 0), # scale_factor = 6.) #v1_module = mlab.points3d(centres[v1_loc[0]:v1_loc[ROI_size-1]+1,0], # centres[v1_loc[0]:v1_loc[ROI_size-1]+1,1], # centres[v1_loc[0]:v1_loc[ROI_size-1]+1,2],
# Load one of the cortex 3d surface from TVB data files CORTEX = surfaces.Cortex.from_file("cortex_80k/surface_80k.zip") # Load connectivity from Hagmann's brain white_matter = connectivity.Connectivity.from_file("connectivity_998.zip") centres = white_matter.centres # Starts a new figure to display sagittal view of brain and its nodes mlab.figure(figure='Sagittal View', bgcolor=(1, 1, 1)) # Plot the 998 nodes of Hagmann's brain, and use the centrality of each node/ROI to # assign a color and scale each node region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], #color=(1,0,0)) colormap='Reds', scale_factor=5.0) region_centres.glyph.scale_mode = 'scale_by_vector' region_centres.mlab_source.dataset.point_data.scalars = dms_bc # retrieve current figure and scene's ID f0=mlab.gcf() scene0 = f0.scene # change the orientation of the brain so we can better observe right hemisphere scene0.x_plus_view() # zoom in to get a closer look of the brain scene0.camera.position = [279.42039686733125, -17.694499969482472, 15.823499679565424]
# Project eeg unit vector locations onto the surface space sensor_locations_eeg = sens_eeg.sensors_to_surface(skin) #-----------------------------------------------------------------------------## ##- Plot pretty pictures of what we just did -## ##----------------------------------------------------------------------------## try: from tvb.simulator.plot.tools import mlab fig_meg = mlab.figure(figure='MEG sensors', bgcolor=(0.0, 0.0, 0.0)) region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.9, 0.9, 0.9), scale_factor=10.) meg_sensor_loc = mlab.points3d(sens_meg.locations[:, 0], sens_meg.locations[:, 1], sens_meg.locations[:, 2], color=(0, 0, 1), opacity=0.6, scale_factor=10, mode='cube') plot_surface(skin) eeg_sensor_loc = mlab.points3d(sensor_locations_eeg[:, 0], sensor_locations_eeg[:, 1], sensor_locations_eeg[:, 2],
#colors=ts[:, current_timepoint]/max_ts #print 'Dimensions of timeseries array: ', ts.shape #plot_surface(CORTEX, op=0.05) # Starts a new figure to display sagittal view of brain and its nodes mlab.figure(figure='Sagittal View', bgcolor=(0, 0, 0)) # Plot the 998 nodes of Hagmann's brain, and use the BOLD signal of each node/ROI to # assign a color and scale each node region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], scale_factor=2.) #rc = region_centres.mlab_source #scalars=colors #rc.set(scalars=scalars) region_centres.glyph.scale_mode = 'scale_by_vector' #region_centres.mlab_source.dataset.point_data.scalars = colors # retrieve current figure and scene's ID f0=mlab.gcf() scene0 = f0.scene # change the orientation of the brain so we can better observe right hemisphere scene0.x_plus_view()
fr = [29, 25, 40] # now, define the TVB nodes that are closest to the auditory LSNM module locations above #a1 = [51,-24,8] #a2 = [61,-36,12] #st = [59,-20,1] #apf= [54,28,8] # Load connectivity from Hagmann's brain white_matter = connectivity.Connectivity.from_file("connectivity_998.zip") centres = white_matter.centres # Plot the 998 nodes of Hagmann's brain region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.5, 0.5, 0.5), scale_factor = 1.) # Now plot the hypothetical locations of LSNM visual modules # V1 node is yellow v1_module = mlab.points3d(v1[0],v1[1],v1[2],color=(1, 1, 0),scale_factor = 5.) # V4 node is green v4_module = mlab.points3d(v4[0],v4[1],v4[2],color=(0, 1, 0),scale_factor = 5.) # IT node is blue it_module = mlab.points3d(it[0],it[1],it[2],color=(0, 0, 1),scale_factor = 5.) # FS node is orange
v1 = [18, -91, 2] # node 344 v4 = [23, -83, -4] # node 390 it = [43, -60, 1] # node 423 fs = [47, 19, 9] # node 47 d1 = [43, 29, 21] # node 74 d2 = [42, 39, 2] # node 41 fr = [29, 25, 40] # node 125 # Load connectivity from Hagmann's brain white_matter = connectivity.Connectivity.from_file("connectivity_998.zip") centres = white_matter.centres # Plot the 998 nodes of Hagmann's brain region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.5, 0.5, 0.5), scale_factor = 1.) # Now plot the hypothetical locations of LSNM visual modules # V1 node is yellow v1_module = mlab.points3d(v1[0],v1[1],v1[2],color=(1, 1, 0),scale_factor = 8.) # V4 node is green v4_module = mlab.points3d(v4[0],v4[1],v4[2],color=(0, 1, 0),scale_factor = 8.) # IT node is blue it_module = mlab.points3d(it[0],it[1],it[2],color=(0, 0, 1),scale_factor = 8.) # FS node is orange
# **************************************************************************/ # display_66_ROI_FC.py # # Displays Hagmann's brain's 66-nodes (low-res ROIs) from tvb.simulator.lab import * from tvb.simulator.plot.tools import mlab # Load connectivity from Hagmann's brain white_matter = connectivity.Connectivity.from_file("connectivity_66.zip") centres = white_matter.centres # Plot the 66 ROIs of Hagmann's brain region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.5, 0.5, 0.5), scale_factor = 5.) # connections = mlab.plot3d(cxn[:, 0], cxn[:, 1], cxn[:, 2], # color = (0, 0, 0), # tube_radius=0.5) # connected = mlab.points3d(connected[0], connected[1], connected[2], # color=(0.75, 0.75, 0.75), # scale_factor = 8.) # Finally, show everything on screen mlab.show(stop=True)
# Threshold that will tell the visualization script whether to plot a given connection # weight or ignore it weight_threshold = 0.5 # Plot the 998 nodes of Hagmann's brain #region_centres = mlab.points3d(centres[:, 0], # centres[:, 1], # centres[:, 2], # color=(0.5, 0.5, 0.5), # scale_factor = 1.) # Now plot the hypothetical locations of LSNM visual modules # V1 node is yellow v1_module = mlab.points3d(v1[0],v1[1],v1[2],color=(1, 1, 0),scale_factor = 10.) # V4 node is green v4_module = mlab.points3d(v4[0],v4[1],v4[2],color=(0, 1, 0),scale_factor = 10.) # IT node is blue it_module = mlab.points3d(it[0],it[1],it[2],color=(0, 0, 1),scale_factor = 10.) # FS node is orange fs_module = mlab.points3d(fs[0],fs[1],fs[2],color=(1, 0.5, 0),scale_factor = 10.) # D1 node is red d1_module = mlab.points3d(d1[0],d1[1],d1[2],color=(1, 0, 0),scale_factor = 10.) # D2 node is magenta (or is it pink?) d2_module = mlab.points3d(d2[0],d2[1],d2[2],color=(1, 0, 1),scale_factor = 10.)
cortical_surface = surfaces.Cortex() brain_skull = surfaces.BrainSkull() skull_skin = surfaces.SkullSkin() skin_air = surfaces.SkinAir() # Get info centres = connectome.centres try: from tvb.simulator.plot.tools import mlab fig_tvb = mlab.figure(figure='John Doe', bgcolor=(0.0, 0.0, 0.0)) region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres [:, 2], color=(1.0, 0.0, 0.0), scale_factor = 7., figure = fig_tvb) plot_surface(cortical_surface, fig=fig_tvb, op=0.9, rep='fancymesh') plot_surface(brain_skull, fig=fig_tvb, op=0.2) plot_surface(skull_skin, fig=fig_tvb, op=0.15) plot_surface(skin_air, fig=fig_tvb, op=0.1) # Plot them mlab.show(stop=True) except ImportError: pass #EoF
connectome = connectivity.Connectivity(load_default=True) cortical_surface = surfaces.Cortex.from_file() brain_skull = surfaces.BrainSkull(load_default=True) skull_skin = surfaces.SkullSkin(load_default=True) skin_air = surfaces.SkinAir(load_default=True) # Get info centres = connectome.centres try: from tvb.simulator.plot.tools import mlab fig_tvb = mlab.figure(figure='John Doe', bgcolor=(0.0, 0.0, 0.0)) region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(1.0, 0.0, 0.0), scale_factor=7., figure=fig_tvb) plot_surface(cortical_surface, fig=fig_tvb, op=0.9, rep='fancymesh') plot_surface(brain_skull, fig=fig_tvb, op=0.2) plot_surface(skull_skin, fig=fig_tvb, op=0.15) plot_surface(skin_air, fig=fig_tvb, op=0.1) # Plot them mlab.show(stop=True) except ImportError: LOG.exception("Could not display!") pass
plot_surface(CORTEX, op=0.1) # Plot the 998 nodes of Hagmann's brain (uncomment if needed for visualization # purposes #region_centres = mlab.points3d(centres[:, 0], # centres[:, 1], # centres[:, 2], # color=(0.4, 0.4, 0.4), # scale_factor = 2.) # Now plot the hypothetical locations of LSNM visual modules # V1 ROI in yellow v1_module = mlab.points3d(centres[v1_loc[0]:v1_loc[-1],0], centres[v1_loc[0]:v1_loc[-1],1], centres[v1_loc[0]:v1_loc[-1],2], color=(1, 1, 0), scale_factor = 6.) print 'Coordinates of the V1 ROI: ' print centres[v1_loc[0]:v1_loc[-1],:] print '' # V4 ROI in green v4_module = mlab.points3d(centres[v4_loc[0]:v4_loc[-1],0], centres[v4_loc[0]:v4_loc[-1],1], centres[v4_loc[0]:v4_loc[-1],2], color=(0, 1, 0), scale_factor = 6.) print 'Coordinates of the V4 ROI: '
# Project eeg unit vector locations onto the surface space _, sensor_locations_eeg = sens_eeg.sensors_to_surface(skin) #-----------------------------------------------------------------------------## ##- Plot pretty pictures of what we just did -## ##----------------------------------------------------------------------------## try: from tvb.simulator.plot.tools import mlab fig_meg = mlab.figure(figure='MEG sensors', bgcolor=(0.0, 0.0, 0.0)) region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres [:, 2], color=(0.9, 0.9, 0.9), scale_factor = 10.) meg_sensor_loc = mlab.points3d(sens_meg.locations[:,0], sens_meg.locations[:, 1], sens_meg.locations[:, 2], color=(0, 0, 1), opacity = 0.6, scale_factor = 10, mode='cube') plot_surface(skin) eeg_sensor_loc = mlab.points3d( sensor_locations_eeg[:, 0], sensor_locations_eeg[:, 1], sensor_locations_eeg[:, 2],
plot_surface(CORTEX, op=0.08) # Threshold that will tell the visualization script whether to plot a given connection # weight or ignore it weight_threshold = 0.0 # Now plot the hypothetical locations of LSNM visual modules # M1 node is green #m1_module = mlab.points3d(m1[0],m1[1],m1[2], color=(0,0,1), scale_factor=5.) # Plot the 96 nodes (uncomment if needed for visualization purposes region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.4, 0.4, 0.4), scale_factor = 5.) # ... now Plot the connections among the nodes for tvb_node in nodes_to_be_examined: # draw node of interest in a diffent size and color m1_module = mlab.points3d(centres[tvb_node, 0], centres[tvb_node, 1], centres[tvb_node, 2], color=(0,0,1), scale_factor=5.) print 'Node ', tvb_node, ' at ', centres[tvb_node], ' is connected to nodes: [',
plot_surface(CORTEX, op=0.1) # Plot the 998 nodes of Hagmann's brain (uncomment if needed for visualization # purposes #region_centres = mlab.points3d(centres[:, 0], # centres[:, 1], # centres[:, 2], # color=(0.4, 0.4, 0.4), # scale_factor = 2.) # Now plot the hypothetical locations of LSNM visual modules # V1 ROI in yellow v1_module = mlab.points3d(centres[v1_loc[0]:v1_loc[-1], 0], centres[v1_loc[0]:v1_loc[-1], 1], centres[v1_loc[0]:v1_loc[-1], 2], color=(1, 1, 0), scale_factor=6.) print 'Coordinates of the V1 ROI: ' print centres[v1_loc[0]:v1_loc[-1], :] print '' # V4 ROI in green v4_module = mlab.points3d(centres[v4_loc[0]:v4_loc[-1], 0], centres[v4_loc[0]:v4_loc[-1], 1], centres[v4_loc[0]:v4_loc[-1], 2], color=(0, 1, 0), scale_factor=6.) print 'Coordinates of the V4 ROI: '
nodes = np.array([345, # V1/V2 393, # V4 413, # IT 47, # FS 74, # D1 41, # D2 125]) # FR # Load connectivity from Hagmann's brain white_matter = connectivity.Connectivity.from_file("connectivity_998.zip") centres = white_matter.centres # Plot the 998 nodes of Hagmann's brain region_centres = mlab.points3d(centres[:, 0], centres[:, 1], centres[:, 2], color=(0.5, 0.5, 0.5), scale_factor = 1.) # Now plot the hypothetical locations of LSNM visual modules # V1 host node is yellow v1_module = mlab.points3d(centres[nodes_grouped_by_region[0], 0], centres[nodes_grouped_by_region[0], 1], centres[nodes_grouped_by_region[0], 2], color=(1, 1, 0),scale_factor = 4.) # V4 node is green v4_module = mlab.points3d(centres[nodes_grouped_by_region[1], 0], centres[nodes_grouped_by_region[1], 1], centres[nodes_grouped_by_region[1], 2],