TVB is a platform for simulating whole-brain dynamics that starts from raw data involving:
- structural connectivity derived from DTI
- brain parcellation derived from MRI and CT
- SEEG xyz locations derived from MRI and CT
This will then determine a gain matrix to determine SEEG signals from the source signals that are generated from neural mass models. The neural mass models will be implemented with nonlinear, complex models for simulating certain type of electrophysiology. The Epileptor is used for simulating seizure activity from a specific source region.
The epileptor is a set of coupled differential equations that rely on 6 different variables. They are described here:
Data & Metadata
Generally, refer to my post on
Freesurfer to establish the preprocessing
data pipeline using Freesurfer, FSL and MRtrix3.
The minimum necessary requirements for creating the TVB dataset are a set of T1 and DWI images as a list of dicom files, or a single 4-D image nifti file.
A high level summary of how the pipeline proceeds is: 1. Construct Cortical Surface, Subcortical Surface
Using freesurfer, you can get the reconstructed surfaces, which are your files that outline the voxels that belong to each region of the brain. This will give you the surface geometries of the cortical and subcortical surface.
- Construct Parcellation Scheme
This can range from the default in freesurfer to different atlases available for the human brain. This will give you a region mapping for every vertex/face from your cortical/subcortical surface geometries files.
- Construct Corticography Tracts
First, you need to coregister the DWI images with the T1 scans Using the DWI images, along with the reconstructed surfaces, you can count fiber tracts between each region of the brain and reconstruct the structural connectivity matrices. This is composed from the weights matrix and the length matrix between parcellated regions.
- Obtain Electrode Coordinates in T1 Space
First, you need to coregister the CT reconstructed freesurfer file into the T1 space.
- Computing Gain Matrix Between Brain Regions and Electrodes
In order to compute forward solutions of electrode (i.e. SEEG, ECoG, etc.) activity, you need to compute a gain matrix that transforms region activity into electrode activity. This can be done using an inverse-square method fall-off on the region activity, or using a dipole method as outlined in the "Virtual Epileptic Patient" paper. Note that these methods have some limitations, as it assumes all activity from brain regions are "projected" to the iEEG electrodes instantaneously.
1. Setting Up Environment
First you may want to set up a conda environment, or a virtualenv that will separate the entire python project from your normal OS.
pip install nibabel networkx git clone https://github.com/the-virtual-brain/tvb-data git clone https://github.com/the-virtual-brain/tvb-library
If you want to have a script to add these all to path for your jupyter notebook, use the following:
1 2 3 4 5 6 7 8 9
1b. Setting Up Environment on a Cluster
. /soft/miniconda3/activate conda env list conda create -n tridesclous python=3.6 scipy numpy pandas scikit-learn matplotlib seaborn pyqt=5 ipykernel source activate tridesclous pip install pyqtgraph pip install https://github.com/tridesclous/tridesclous/archive/master.zip python -m ipykernel install --name tridesclous-testing —user
2. Simulating Epilepsy
In order to simulate epilepsy, you are going to walk through a pipeline using TVB. Details are left out for now.
i. Structural Connectivity
What is the matrix of connectivities between your brain regions? Ex: Connectivity weights, conduction speed, coupling function between long-range regions
ii. Neural Mass Model
What is the phenomenological model at brain regions? Ex: Epileptor6D, with parameter settings
How to solve your stochastic differential equation? Ex: Heunstochastic, with noise levels
How are your brain regions coupled? How does activity of one region translate to the next? Is it transformed via a function? Ex: linear, additive, hyperbolic
What variables to monitor and store? Ex: State variables, iEEG activity from sampling rate and period.
Then once these are complete, you can run your simulation.