The Virtual Brain User Guide
The Virtual Brain User Guide
Release 1.4.1-7595
TVB Team
CONTENTS
Overview of TheVirtualBrain
.
.
.
.
.
.
.
.
5
5
5
6
7
7
7
7
7
Configuring TVB
3.1 Configuring a headless TVB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Setting up a client/server configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
9
9
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11
11
16
22
44
50
53
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
73
73
73
73
77
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
79
79
80
81
82
82
82
84
85
89
90
90
91
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
ii
This document provides the most basic tutorial to get the new user started working with TheVirtualBrain,
version 1.0. As TheVirtualBrain will be updated regularly, please check for updates on our web site:
http://www.thevirtualbrain.org.
CONTENTS
CONTENTS
CHAPTER
ONE
OVERVIEW OF THEVIRTUALBRAIN
TheVirtualBrain is a framework for the simulation of the dynamics of large-scale brain networks with biologically realistic connectivity. TheVirtualBrain uses tractographic data (DTI/DSI) to generate connectivity matrices
and build cortical and subcortical brain networks. The connectivity matrix defines the connection strengths and
time delays via signal transmission between all network nodes. Various neural mass models are available in the
repertoire of TheVirtualBrain and define the dynamics of a network node. Together, the neural mass models at the
network nodes and the connectivity matrix define the Virtual Brain. TheVirtualBrain simulates and generates the
time courses of various forms of neural activity including Local Field Potentials (LFP) and firing rate, as well as
brain imaging data such as EEG, MEG and BOLD activations as observed in fMRI.
TheVirtualBrain is foremost a scientific simulation platform and provides all means necessary to generate, manipulate and visualize connectivity and network dynamics. In addition, TheVirtualBrain comprises a set of classical
time series analysis tools, structural and functional connectivity analysis tools, as well as parameter exploration
facilities by launching parallel simulations on a cluster.
CHAPTER
TWO
ipython_notebook
On Linux these scripts will have the .sh termination, on Mac the .command termination and on Windows the .bat
termination. We will omit the termination in this manual. For example if you are using Windows and tvb_start is
mentioned in this document then tvb_start.bat is meant. The examples below are for Linux.
These scripts will start and control TheVirtualBrain.
To make sure that no processes will remain open after you use the application, you should always close TheVirtualBrain by running the tvb_stop script.
$ ./tvb_stop.sh
The distribution script is used from a terminal to control the TheVirtualBrain distribution. Run distribution -h too
get help with this command:
$ ./distribution.sh -h
To access the console interface, run in a terminal distribution start COMMAND_PROFILE or distribution start
LIBRARY_PROFILE. A Python IDLE shell will appear. See the console.
$ ./distribution.sh start COMMAND_PROFILE
If you want a plain python text ui shell add the -headless flag to the above commands: distribution start COMMAND_PROFILE -headless This is helpful if TheVirtualBrain is installed on a headless server (no GUI).
$ ./distribution.sh start COMMAND_PROFILE -headless
The default configuration will place TheVirtualBrain projects in a folder named TVB. This folder will be created
in the users home folder.
Linux: /home/johndoe/TVB/
Windows >= 7: c:\Users\johndoe\TVB
Mac : /Users/johndoe/TVB
However for a client server or cluster setup you will need to take some more time to configure TVB. See the
Configuring TVB section for details.
CHAPTER
THREE
CONFIGURING TVB
The preferred method to configure TheVirtualBrain is from the web interface. See TVB Settings.
However if TheVirtualBrain is installed on a headless server (no GUI), then the web interface might not be available remotely. See Configuring a headless TVB.
Usually one would change the web server port and domain. TheVirtualBrain will create a folder with project data
named TVB (at the path specified by line starting with TVB_STORAGE). By default it is located in the users home
directory. You can change the TVB_STORAGE to point to a different location.
Finally run the appropriate script for your platform (as described in the previous chapter), to launch TheVirtualBrain with the new settings.
In this highly concurrent setup we strongly recommended to use postgreSQL as the metadata storage of TVB.
1. You should install PostgreSQL DB, independently of TVB.
2. Create a database called tvb
3. Choose the postgres user that TVB will use to connect. TVB prefers to connect with the postgres user to
the database but any user with rights over tvb database is ok. ( These are not tvb accounts but db
accounts )
4. Create a db connection URI. Postgres URIs in TVB have this general form
postgresql+psycopg2://postgres:root@[postresql-server-host]:[postgresport]/tvb?user=[user]&password=[postgres-pwd]
The angle bracketed expressions are placeholders that have to be replaced by values specific to your
machine.
5. Place the concrete connection URI in the TheVirtualBrain configuration using either the GUI or by editing
the config file.
10
CHAPTER
FOUR
The workflow of TheVirtualBrain is divided in six major activities. The main menu of the web interface lays at
the bottom of the page. It links to these six activities.
1. In User, the user can manage their account and TheVirtualBrain settings.
2. In Project, the individual projects are managed with all their data and infrastructure.
3. In Simulator large-scale simulations are defined and launched. Analysers and visualizers associated with a
simulation are defined there. Their results, structural and functional data, are shown in panels. Having multiple panels allows having a quick overview of the current TheVirtualBrain model parameters, simulations
and results. We consider the Simulator to be the core of TheVirtualBrain.
4. In Analysis experimental and simulated data can be analyzed.
5. In Stimulus, patterns of spatiotemporal stimuli can be generated.
6. And finally in Connectivity, the user can edit the connectivity matrices assisted by interactive visualization
tools.
The typical workflow within TheVirtualBrain GUI proceeds through these steps:
1. a project is defined and/or selected and user data, (e. g. a connectivity matrix), are uploaded into this project
2. new data is obtained by simulating large scale brain dynamics with some set of parameters
3. results are analyzed and visualized
A history of launched simulations is kept to have the traceability of any modifications that took place in the
simulation chain.
4.1 User
4.1.1 TVB Settings
Once started, TheVirtualBrain should automatically open your default browser and start on the default
http://127.0.0.1:8080/settings/settings. If not, you should manually open your favorite browser from our list of
supported browsers and open the before mentioned URL. This should open up the following settings page:
These are the configurable settings for TheVirtualBrain. Note that the Name of the administrator is the only one
that cannot be changed later on. The others will be accessible afterward from the profile page of the administrator.
These settings are:
Administrator User Name: the name of the administrator. Default value here is admin. Remember it, as you
will need this account for validating other accounts created with Register function.
Password: the password of the administrator. Default value here is pass. Remember it, as you will need it at a
first login. This password can be changed later by clicking the Change password link, from the profile page
(available only after a login).
Administrator Email: the email of the administrator. Emails requesting validations for new users will be sent to
this address. This can be changed by clicking the edit link from the profile page.
11
12
RPC server: if you are not running on a cluster, this will be the port used by the backend server. If Deploy on
cluster is checked this will not be used.
Maximum number of vertices: maximum number of vertices for a surface.
After selecting your desired settings press the Apply button. This will restart TheVirtualBrain with the new settings.
The restart could take a few minutes.
4.1.2 Login
In order to access TheVirtualBrain, you need to have a user account.
There is a single Administrator account in TVB (created when installing the application). Its default user-name
and password are admin and pass (exactly these words). These are the default values, but when you setup
TheVirtualBrain for the first time (section Settings from above) you can specify different values, if wanted. Please
remember what you specify for this Administrator account, as you are the sole responsible for it (TheVirtualBrain
being installed in your own environment we have no control of your storage). With the Administrator account you
will be able to later validate other TVB accounts.
4.1.3 Register
If you want to create a new user in TheVirtualBrain, you should register using the corresponding link (available
on the User Login page), which takes you further to the following form:
When the register button is clicked (on the right), an email is sent to ADMINISTRATOR_EMAIL address. It is the
administrators task to validate the new account. The administrator needs to be logged in to validate an account.
Without validation from the administrator, you will not be able to use the new accounts. For details on how
validation is done, see the User Profile section.
4.1. User
13
Figure 4.4: The User details page (also called User Profile)
You have also functionality on this page:
Manage other users (available on the left column, only when logged with Administrator account), takes you
to a page for validating or invalidating other user accounts (accounts created with the register function)
14
access TVB Settings (same settings as in the first setup iof TVB; although some of the fields become readonly after the first setup)
change the password and the email address for current logged user (also links on the left column)
enable or disable Online Help for current user. By Online Help we mean a bunch of question marks spread
all over the application which can display a tooltip when clicked). In case you find the question marks
annoying, feel free to disable them for your user from this page. Some pages will take longer to load when
Online Help is on. You might want to disable it once you feel confident with the interface.
logout function (button on the right side)
Tip: TVB is a web application, which gets deployed on every computer where TVB_Distribution is downloaded
and tvb_start command is executed. This happens usually in a local environment; which means that the user and
resource management will be done locally, in that instance, and not in a centralised manner.
When TVB is started for the first time, you will see a settings page, where you can define the administrator account
of that TVB instance. Default that is: admin / pass (exactly these words).
If you are using TVB in a single-user manner (not shared with other colleagues), feel free to use only this user
while working with TVB; you do not need to bother with creating/registering other accounts. It is although
recommended for you to change the password and the email address for this administrator account, especially if
you are working in a LAN and your computer is not having a strong firewall.
If you are using TVB in a shared environment (e.g. installed on a server and accessed from remote by multiple
people), you could follow the following steps:
register accounts (optional)
login with administrator
check admins profile page, link Manage other users
in case you havent registered accounts (step 1) you can now create new accounts using the button on the
right
check the validate checkbox for new users that you want active, and click Save to apply (see figure from
previous page)
from this very same page you can also invalidate some old users which you want to no longer be able to use
TVB
4.1. User
15
4.2 Project
Projects are the way you organise data and simulations in TheVirtualBrain. They correspond to directories where
related data sets and simulation results are stored.
Information on the currently selected project is always available by clicking on the upper left corner of the interface:
The Project tab provides access to the projects that you have created within TheVirtualBrain. The second level
menu in the top left corner, next to the Project number, allows you to navigate between five main subpages, each
of which is described in more detail in the sections below:
List of All Projects
Basic Properties
Operations
Data Structure
Saved Figures
4.2. Project
17
Import an existing project structure (for example, Exported from a colleagues installation of TheVirtualBrain).
Upon first user registration, a default project is created for you:
4.2.4 Operations
A table with the history of operations related to the currently selected project is displayed. From this board the
user can filter, view, reload or cancel any operation:
4.2. Project
19
20
4.2. Project
21
4.3 Simulator
A configurable multicolumn interface that combines TheVirtualBrain simulation, analysis and visualization capabilities.
22
4.3. Simulator
23
In this column you can change all the configurable parameters of a simulation:
Long Range Connectivity
Long Range Coupling Function
Conduction Speed
Cortical Surface
Stimulus
Local Dynamics Model
State Variable Range
State Variables to be recorded
Initial Conditions
Integration Scheme
Integration Step Size
Monitors
Simulation Length
You can find more detailed information by clicking on the
Note: You can filter DataTypes (like Long Range Connectivity) from UI
24
This page allows you to observe how the dynamics of the physical model change as a function of its parameters.
On the left column you select the model you want to explore and set its parameters.
The selected model will generally have a n-dimensional phase space. The right column shows a 2-dimensional
axis cut of this space. Gradients are shown and nullclines if they exist. To control this cut use the Axes and State
variables regions in the left column. There you can select what state variables should be shown and their ranges.
Also you can set values for the variables that are not shown.
If you click in the phase plane a state trajectory will be computed. The integration method for this trajectory is
configured on the left column. To make trajectories longer increase the integration step. This will not influence
the simulation. For stochastic integrators decreasing the dispersion usually makes sense. Below the phase graph
you will see the signals for all state variables. These signals belong to the latest trajectory.
Finally to save a parameter configuration give it a name and click Save new parameter configuration. This saved
configuration can be used in Region-based simulations
4.3. Simulator
25
Region-based simulations
The Set up region Model button leads you to the region model page. Here you can associate model parameter
configurations to connectivity nodes.
Surface-based simulations
If you are launching a surface-based simulation, then it is possible to add more complexity by spatially varying
the model parameters.
In order to do that, click on Set up surface model. A new configuration page will be loaded.
26
Figure 4.22: The results will be presented in a discrete two dimensional graph. Each point represents the results
of a simulation for an unique combination of parameters. The disk size corresponds to Global Variance and the
color scale corresponds to Variance of the Variance of nodes.
4.3. Simulator
27
icon.
Caution: Please notice that deleting a simulation will also delete all resulting data that had been produced.
Each simulation has a color label that represents its current status:
pale blue: simulation is running,
green: simulation is finished,
red: an error occured during the simulation.
Note: You cannot rename a Simulation while it is running.
Tip: The star button allows you to create a new simulation. using the default Simulator parameters.
28
TVB-Visualizers associated with a TVB-Analyzer. In this case, simulation results undergo two steps:
they are first analyzed and those secondary results are shown in a corresponding visualizer.
one Results tab containing the current simulation data structure tree. You can inspect each element through
this tree in the same way as in Projects > Data Structure. A full list of visualizers and analyzers is available
from the component overlay menu.
Tip: Once your results are available, by clicking on
page where only the currently selected visualizer is presented. In this new page, you can click on
right corner to access a new menu which will allow you to:
in the top
4.3. Simulator
29
The SPACE key will show a top view. The CURSOR Keys will show axis aligned views.
For region level time series the brain is represented by a coarse granularity - each region is represented with only
one color. For surface level time series each vertex has an individual measure.
The color coding is determined by the current color scheme. A legend of it is on the right side of the brain view.
You can change this color scheme and other viewer parameters from the brain menu in the upper right corner.
From the visualizer toolbar you can pause and resume the activity movie. For region level time series there is a
selection component in the toolbar. Use it to show activity only for the selected regions.
Figure 4.25: Preview for Brain Activity Visualizer at the region level
4.3. Simulator
31
additional time series use the brain menu in the upper left corner. From that menu you can change viewer settings.
The page size determines how much data should appear at once in the viewer. The spacing determines the space
between the horizontal axis of each signal. Setting it to 0 will plot all signals in the same coordinate system. A
side effect of this setting is that as you decrease this axis separation the amplitude of signals is scaled up.
Figure 4.28: Selecting the channels to be displayed (available in several viewers of TVB).
32
Figure 4.30: Brain activity with sEEG recordings (on the left instance) and region level activity (on the right).
4.3. Simulator
33
34
Topographic Visualizer
This visualizer can be used for displaying various Brain Connectivity Measures, related to a given Connectivity.
Its input is same as for the previous visualizer (Connectivity Measure Visualizer), but the display is completely
different. Instead of a discrete view, this time, we can have a continous display (with gradients).
4.3. Simulator
35
Surface Visualizer
This visualizer can be used for displaying various Brain Surfaces. It is a static view, mainly for visual inspecting imported surfaces in TVB. Optionally it can display associated RegionMapping entities for a given surface.
Navigate the 3D scene like in the Brain Activity Visualizer.
Sensor Visualizer
This visualizer can be used for displaying EEG, MEEG, and internal sensors . It is a static view, intended for
visual inspecting imported sensors in TVB. Optionally it can display the sensors on a EEG cap surface.
To show sensors displaying on a Cap, check the call-out on the top-right corner.
When displaying the EEG sensors on a EEG Cap surface, we are automatically computing a parcellation. Currently this parcellation has no anatomical meaning, it is only based on distance (a vertex gets coloured as the
closest sensor).
Navigate the 3D scene like in the Brain Activity Visualizer.
Local Connectivity Visualizer
Once a Local Connectivity dataTypes (which in fact is a huge sparse matrix of max size surface vertices x surface
vertices, shaped after the cut-off) gets computed, one can view the correlation of a given vertex compared to all its
neighbours, by launching this viewer (from the DataType overlay).
In order to see some correlation, one should pick (by mouse click) a vertex on the 3D cortical surface once it loads
in the canvas.
Annotations Visualizer
This viewer shows ontology annotations linked with TVB connectivity regions. It is composed of two main display areas:
36
4.3. Simulator
37
3D left-side canvas with TVB regions. These regions are color coded, based on the connectivity
region index (similar to Surface Visualizer when a Region Mapping entity is selected). From the most
top-right corner menu, you can change the color scheme used to draw these regions coloring.
2D tree display of ontology annotations. A tooltip will appear if you go with the mouse over various
nodes, and will show you details imported from the ontology.
The two areas (left and right) are linked, both ways:
You can pick a vertex in 3D and have the corresponding tree node highlighted on the right-side, or
backwards:
Click on the tree, and have the corresponding region(s) highlighted in 3D.
Figure 4.39: Pick a vertex in 3D and have the corresponding tree node selected on the right.
Hints:
There is an checkbox on the top-right menu to draw region boundaries in the 3D canvas
When you click on an ontology node on the right, a message text will appear on the top area of the
page, telling you how many TVB regions are linked to this ontology term
Figure 4.40: Select a tree node on the right, and have the linked regions highlighted in 3D.
38
Figure 4.41: Preview for Discrete PSE Visualizer, when varying two input parameters of the simulator
When moving with your mouse cursor over a graph node, you will see a few details about that particular simulation
result. When clicking a node, an overlay window will open, which gives you full access to view or further analyze
that particular Simulation result.
Isocline PSE Visualizer
Continuous Parameter Space Exploration View, will show the effect of varying Simulator parameters in a continuous form.
4.3. Simulator
39
When running a range of Simulations in TVB, it is possible to do it by varying up to 2 input parameters (displayed
on the X and Y axis of current viewer). This visualizer supports ranges with 2 dimensions only, it does not support
ranges with only one dimension. Also both varying dimensions need to be numeric parameters (no DataType
ranges are supported for display in this visualizer).
Figure 4.42: Preview for Continuous PSE Visualizer, when varying two numeric input parameters of the simulator
Controls for scaling or zooming the graph are available in this viewer. When you click on the coloured area, an
overlay window will open, containing possibility to view or further analyze the simulation result closest to the
point where you clicked.
40
4.3. Simulator
41
42
4.3. Simulator
43
4.4 Analyze
This area offers a set of techniques for data analysis.
The Analyzers in TheVirtualBrain are not always the best implementations of the algorithms in terms of performance, neither are we offering a complete analysis spectrum, because analysis is not considered the focus feature
of TheVirtualBrain and we do not intend to offer a replacement for tools already existent and successful in this
area. We are merely offering some handy tools for people who want to directly process simulation results inside TheVirtualBrain, although the advised long term strategy is to export simulated data from TheVirtualBrain
and analyze it intensively with specialized tools for your area of interest. We advise you not to run our analysis
algorithms with long timeseries, as some might take a lot of time to finish.
The Analysis area has several interfaces that support the following operations for time-series analysis (and not
only):
Cross-correlation of nodes
Fourier Spectral Analysis
Global TimeSeries Metrics
Cross coherence of nodes
44
4.4. Analyze
45
46
4.4. Analyze
47
The algorithm returns a Covariance object that is a 4D-Matrix with the Dimensions {nodes, nodes, 1, 1}. The
resulting covariance matrix can be viewed with the Covariance visualizer.
48
4.4. Analyze
49
4.5 Stimulus
Spatio-temporal patterns can be generated to create stimulation patterns.
Figure 4.52: Preview for Stimulus Area. Select the type of stimulus you want to define / inspect
Note: You can build stimuli for region-based and surface-based simulations
50
Most importantly, we can select the Temporal Equation that defines the profile and play with its parameters.
On the right column, the stimulus temporal profile is presented, with constant refresh, as the user changes the
Temporal Equation parameters on the left.
From the action bar in the right side you have access to:
4.5. Stimulus
51
52
Figure 4.55: Preview for selecting the focal points of a Surface Level Stimulus
On the right column you will have the list of the selected focal points. You can delete them independently.
Hint: The spatial pattern will be centered around the focal points.
Finally, click on Save New Stimulus Surface button to create the new stimulus entity; but do not forget to give it
a meaningful name (left column Display name input field).
Regardless if the current Stimulus entity is stored or not yet, you can visualize the evolution of the spatio-temporal
pattern. Click on the
Tip: You can increase the complexity of a stimulus pattern by building on top of one Stimulus entity.
For an example on how to do it, please read the Test Cases in the User Guide document.
4.6 Connectivity
In this area you can edit both types of TVB connectivity objects:
4.6. Connectivity
53
54
4.6. Connectivity
55
You can save a particular selection. Click the Select Nodes button and the selection component will be shown.
Enter a name for the selection and click save.
56
4.6. Connectivity
57
The Weights button opens a menu to perform basic algebraic operations on a group of edges. You can select
multiple nodes from the current connectivity (by default all nodes are selected); thus you will end up with two
sets of nodes: the set of selected nodes and the set of un-selected nodes. These two sets of nodes, determine four
categories of edges:
In > In: are only the edges connecting the nodes of the selected set.
In > Out: are the edges that connect nodes in the selected set (rows) to nodes in the unselected set
(columns).
Out > In: are the edges connecting nodes in the unselected set (rows) to nodes in the selected set (columns).
Out > Out: are edges connecting pair of nodes in the unselected set.
4.6. Connectivity
59
60
Viewers
Connectivity 3D Edges
This connectivity visualizer allows you to see the structural information as a base model part of TVB.
The 3D semi-transparent surface around the connectivity nodes, whether it is the cortical surface or the outer-skin,
is used just for giving space guidance.
You can select an individual node and right-click on it to activate the incoming or outgoing edges.
For each node you can choose a different color to apply to its edges.
4.6. Connectivity
61
62
Figure 4.73: Preview for Connectivity Viewer 3D Edges - Coloring incoming / outgoing edges
Connectivity 2D Viewer
A 2D representation of the connectivity matrix nodes and edges.
There are three main views (projections):
Left sagittal view
Transverse view
Right sagittal view
Nodes are drawn as circles and the connections as lines. Only the selected nodes are shown.
Visualizing Connectivity Measures
The 3D and 2D Views can be used to visualize two ConnectivityMeasure datatypes. These measures can be the
output of a BCT Analyzer. If given, they will determine the size and colors of the nodes in the views.
You can choose these connectivity measures before launching the Large Scale Connectivity visualizer, or from the
brain menu (see tip below).
To display the measures in the 3D view check the Metrics details checkbox. Nodes will be displayed as colored
spheres. The size of the sphere is proportional to the measure labeled Shapes Dimensions. The color comes from
the current color scheme and is determined by the measure labeled Node Colors.
4.6. Connectivity
63
64
Figure 4.75: 3D view of a connectivity measure. Node size is defined by the Indegree. Node color is defined by
node strength.
4.6. Connectivity
65
To display the measures in the 2D views click the Show all button.
Nodes are draws as circles, their size proportional to the measure labeled Shapes Dimensions. Their color is
determined by a threshold and the measure labeled Node Colors. Nodes with values above the threshold will be
red and those whose value are below the threshold will be green.
Figure 4.76: Preview of 2D Connectivity Viewer (left lateral view). Node size is defined by the Indegree. Node
color is defined by node strength, threshold is 40.
Tip:
If you wish to change:
the color threshold,
the metrics used to define the node features,
the colormap used in the Connectivity Matrix Editor, or
the Connectivity entity
go to the brain menu on the top right corner
Matrix Overview
A 2D matrix plot to have a complete overview of the initially selected weighted connectivity matrix.
66
4.6. Connectivity
67
Space-Time
This is a three-dimensional representation of the delayed-connectivity structure (space-time) when combined with
spatial separation and a finite conduction speed. The connectome, consists of the weights matrix giving the
strength and topology of the network; and the tract lengths matrix giving the distance between pair of regions.
When setting a specific conduction speed, the distances will be translated into time delays. The space-time visualizer disaggregate the weights matrix and each slice correspond to connections that fall into a particular distance
(or delay) range. the first slice is the complete weights matrix. Click on any of the subsequent slices to see the
corresponding 2D matrix plot.
68
Figure 4.80: Connections that are between 0 and 2.84 ms, for a conduction speed of 9 mm/ms
4.6. Connectivity
69
Figure 4.81: Connections that are between 2.84 and 5.68 ms, for a conduction speed of 9 mm/ms
70
4.6. Connectivity
71
72
CHAPTER
FIVE
TheVirtualBrain has several flavors of scripting interfaces. These are powerful programmatic interfaces. Unlike
the GUI they are not meant be used remotely and their leaning curve is steeper.
They are a great tool to build a reproducible workflow. The sequence of actions performed in the GUI are recorded
as operations but a python script using the console interface is more detailed and exact.
From these interfaces you also have full access to the APIs of TVB.
The interfaces differ in what shell is used and in how many TheVirtualBrain services they use.
73
74
execfile('/home/user/Downloads/TVB_Distribution/tvb_data/tvb/'
'simulator/demos/region_deterministic.py')
The above command should work on Linux and Windows, as long as you replace
/home/user/Downloads/TVB_Distribution with your personal path towards the folder where TVB was
being downloaded. On Mac OS the path is just a little different:
execfile('../Resources/lib/python2.7/tvb/'
'simulator/demos/region_deterministic.py')
execfile('/home/user/Downloads/TVB_Distribution/tvb.app/Contents/Resources/lib/python2.7/tvb/'
'simulator/demos/region_deterministic.py')
75
Figure 5.4: Run a TheVirtualBrain demo from the Run Menu option
76
This will import all the scientific simulator modules as well as some datatypes that wrap important data as the
Connectivity matrix and cortical Surface.
The scripts are located in the bin folder and they have platform specific terminations.
The distribution script can be used to launch other profiles as well. The WEB_PROFILE will start the web
interface. The following has the same effect as tvb_start
$ ./distribution.sh start WEB_PROFILE
Using the distribution script allows you to give additional options. The -reset option will clean the TheVirtualBrain
folder before starting the web interface
$ ./distribution.sh start WEB_PROFILE -reset
77
78
CHAPTER
SIX
The primary purpose of The Virtual Brain platform is to simulate whole brain dynamics. A simulation pipeline
has different stages. The most fundamental stage is building a realization of a computational model which we
call a large-scale brain network model. This model is constituted by a set of structural and functional components
linked together, completely creating a particular model of the brain.
The following document is a generic description of what we often call a minimal structural dataset for TVB and
a complete dataset. The aim of this document is to specify the different pieces of data required to derive the
structural skeleton/substrate of a BNM. Hopefully, experts in the field of data acquisition will help us completing
and improving our description.
A complete dataset should:
provide the history of the acquisition/processing protocols (traceability);
be in a standard format to perform analysis with different toolboxes;
have the Minimal Structural Dataset to derive a self-consistent set of files used in TheVirtualBrain. This
minla dataset will permit users to build large-scale brain network models and save their simulated data under
different output modalities (eg, EEG, MEG, fMRI).
increase reproducibility of the results.
79
In general, all the steps in the processing pipeline should be documented, so its possible to apply the same
treatment to subsequent datasets. Sending pieces of informations in different files without descriptions from
where they came and how they were processed is a bad practice and only detrimental for your own research
project (takes a lot of time and its not reproducible). We cant provide any meaningful help to integrate/check or
validate incomplete datasets.
Ideally, any volumetric data (eg, in NIFTI format), surface data (eg, GIFTI format) or combination thereof (eg,
CIFTI format) should be provided in their RAW format, and if any pre-processing was performed on the raw
data, associated data such as the region centres and parcellation mask should be provided in the same coordinate
system as the cortical mesh (ie, self-consistent dataset). The meaning of the (x,y,z) coordinates depends entirely
on how the volumetric file was generated. It is possible to set any coordinate system you want (native, mni,
talaraich) depending on the processing you apply to your data. A region centre, for example, would be a single
spatial location in 3D. This location is specified by three numbers (x,y,z), these numbers should ideally represent
mm and must be relative to an origin (x=0, y=0, z=0). The same coordinate system means that the origin is in
the same location relative to the head, and that the axis(x,y,z) point in the same direction with the same orientation.
80
81
82
83
85
86
MRtrix: http://www.brain.org.au/software/mrtrix/
CAmino: http://cmic.cs.ucl.ac.uk/camino/
BrainVisa: http://brainvisa.info/
MRI Processing/Analysis/Modeling platforms:
SPM: http://www.fil.ion.ucl.ac.uk/spm/
Fieldtrip: http://fieldtrip.fcdonders.nl/
Brainstorm: http://neuroimage.usc.edu/brainstorm/
Data exchange/db platforms:
The Human Connectome Project: http://www.humanconnectome.org/data/
XNAT: http://xnat.org/
Glossary
Space Coordinate systems:
MNI (we encourage to use this one)
Talaraich
ref: http://fieldtrip.fcdonders.nl/faq/how_are_the_different_head_and_mri_coordinate_systems_defined
Atlases:
In order to compare different brains, it is necessary to register them to a common space by using a
template.
See http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Atlases
Structural Anatomical Parcellations:
Kotter (macaque)
Broadmann
FSL AAL 90
Hagmann (based on Desikan)
87
88
CHAPTER
SEVEN
The purpose of this chapter is to provide some details about the way TheVirtualBrain instance/installation can
exchange data with other TheVirtualBrain instances, or with other applications available in the neuroscience community. Currently, there are several applications that can analyze and record brain activity in different formats,
and one of the goals of TheVirtualBrain is to allow users from different backgrounds to have quick access to their
recorded data.
To achieve this, we have implemented some mechanisms to IMPORT / EXPORT data at different levels and
formats:
Project - As you may know, TheVirtualBrain data is organized in projects and one of the options is to
transfer projects (with attached data) entirely between TheVirtualBrain installations. This mechanism can
be used only between TheVirtualBrain applications, and no other external tools.
Simple Data - This feature allows you to transfer independent data (e.g. surface, connectivity, time series)
between two TheVirtualBrain instances or between TheVirtualBrain and an external application. As you
may note later, depending on the targeted application, data can be exchanged in a custom TheVirtualBrain
format or a commonly used format used in the neuroscience community (e.g. CFF, GIFTI, NIFTI ...)
Warning: During export and import operations TheVirtualBrain does not apply any space transformation, so
users have to ensure their data (especially in case of import) is generated/stored in the same space.
TheVirtualBrains default project contains data in a space where the nose is pointing in the direction of -y and
the left ear in the direction of +x. The space is right handed: +z points up.
Before proceeding with more details about data exchange, it would be helpful to give you an idea how TheVirtualBrain stores its data. Basically there are two major storage areas:
1. Database - where general information/metadata are stored and relation between stored elements (e.g. assignment of data to a project, data metadata - creation date, owner, etc...)
2. Disk - here we store the real data in a HDF5 format (http://www.hdfgroup.org/HDF5). This means that
for each data type (e.g. surface, connectivity, time series) we store on the disk, it is given a folder structure
in an HDF5 / H5 file which contains all data (e.g. vertices, triangles, etc ...). This format has the following
advantages which made it an optimal solution for our product:
can store huge pieces of data and can access it very fast (even random access)
can organize data in a tree structure (groups and leaves)
allows assignment of metadata on every level
is a format agreed upon by the community and can be used/opened with different tools/languages
(Python, Matlab, java, C++ ...)
An important aspect of TheVirtualBrain storage is that each data/datatype has associated a GUID, which makes it
unique on every system where that data exists.
89
90
http://www.mathworks.com/help/matlab/ref/hdf5read.html
Note: The HDF5 functionality referenced above was only introduced in Matlab 2011a.
Note: In the future other data formats might be supported as export format from TVB, but for now, the HDF5 is
the only format available at export time.
91
the data type (e.g. connectivity, time series ...). Based on the detected type of data, the rest of the details are
filled and the object is stored in the database.
92
File Format
ZIP file should include files with the following naming schema and format:
1. If any file name contains weight, it will be considered as the container for connectivity weights and the
parse process expects the following format:
text file containing values separated by spaces / tabs
contains a matrix of weights
any value greater than zero is considered as a connection. You should not have negative values in your
weights file.
2. If any file name contains centres it will be considered as the container for connectivity centers and the
parse process expects the following format:
text file containing values separated by spaces / tabs
each row represents coordinates data for a region center
each row should have at least 4 columns: region label and center position (x, y, z)
a region label is a short unique identifier, for example: RM-TCpol_R
each region centre is just a single point in space, corresponding to the centre of the region
the meaning of the (x,y,z) coordinates depends entirely on how data was generated. It is possible to
specify any coordinate system you want (native, mni, talaraich) depending on the processing
you apply to your data. A region centre would be a single spatial location in 3D. This location is
specified by three numbers (x,y,z), these numbers should ideally represent mm and must be relative to
an origin (x=0, y=0, z=0).
3. If any file name contains tract it will be considered as container for connectivity tract lengths and the
parse process expects the following format:
text file containing values separated by spaces / tabs
contains a matrix of tract lengths
any value greater than zero is considered as a connection. You should not have negative values in your
tract file.
4. If any file name contains orientation it will be considered as container for connectivity center orientations
and parse process expects the following format:
text file containing values separated by spaces / tabs
each row represents orientation for a region center
each row should have at least 3 columns for region center orientation (3 float values separated with
spaces or tabs)
5. If any file name contains area it will be considered as container for connectivity areas and the parse
process expects the following format:
text file containing one area on each line (as float value)
6. If any file name contains cortical it will be considered as container for connectivity cortical/non-cortical
region flags, and the parse process expects the following format:
text file containing one boolean value on each line (as 0 or 1 value) being 1 when corresponding region
is cortical.
7. If any file name contains hemisphere it will be considered as container for hemisphere inclusion flag for
connectivity regions, and the parse process expects the following format:
text file containing one boolean value on each line (as 0 or 1 value) being 1 when corresponding region
is in the right hemisphere and 0 when in left hemisphere.
93
There are systems/applications that generate and store surface data in two parts: for left and right side. If this is
the case, the imported ZIP file is expected to contain text files with the same naming and format, but the name
should contain letter r or l at the end of the suffix (e.g. <trianglesl.txt> and <trianglesr.txt>)
94
File Format
An overview of the OBJ file format can be found on Wikipedia TVB supports only a subset of the specification.
Meaning that only geometry data is considered and accepted forms for faces attributes are: triangles or quads. We
ignore at import time features such as texture coordinates, materials and groups.
95
96