MI-BCI means minimal invasive brain-computer interface (BCI). The repository is the sample code for the paper "Intracranial brain-computer interface spelling using localized visual motion response."
The code demonstrates the basic analysis pipeline of this paper, including fMRI localization and visualization, and SEEG processing.
The activated MT area is obtained for choosing the optimal implantation spots.
This package required the following softwares to function properly:
- FreeSurfer 7.1.1
- Brainnetome atlas freesurfer
- python 3.6 or higher
Note!!! Installation using pip may face a problem of dependency package version conflict! The newest 'mayavi' version has a conflict with the newest 'vtk' package, so in requirement.txt we define the downloading versions to be 'vtk==8.1.2' and 'mayavi==4.6.2'. If you have installed a later version of mayavi or vtk before, please notice the version changing issue.
git clone https://github.com/HongLabTHU/MI-BCI.git
cd MI-BCI
pip install -r requirements.txt
- Download the atlas from the official website.
- Copy the files
lh.BN_Atlas.gcs
,rh.BN_Atlas.gcs
,BN_Atlas_subcortex.gca
,BN_Atlas_246_LUT.txt
, to the FreeSurferSUBJECTS_DIR
folder.
To run this demo, you need to recon
the surface using your local FreeSurfer:
cd ./MT-Localizer
./recon.sh
Wait until the recon-all command has finished.
Then, run fsfast_mt_analysis.sh
to analyze fMRI
./fsfast_mt_analysis.sh -p ../data/fsfast --all
Then, perform parcellation based on Brainnetome atlas:
./BN_atlas_mapping.sh -s S1
Enter module localizer-viz
cd ..
cd ./localizer-viz
Project the marked electrodes to the pial or inflated surface.
python elecs_projection.py -s S1 --fsfast ../data/fsfast --hemi lh -eloc ../data/fsfast/AnatDir/S1_Electrode_locations.dat
# for detailed explaination of the input arguments, please type ``python elecs_projection.py --help ``
Now, we can visualize the result
python viz.py -s S1 --fsfast ../data/fsfast --hemi lh -eloc ../data/fsfast/AnatDir/S1_Electrode_locations.dat
cd ..
cd SEEG-proc
python seeg_processing.py
For example data, please click here
to download. Unzip the file and put the two folders SEEG
and fsfast
into the data directory.
If you have a question or feedback, or find any problems, please feel free to open a git issue or pull request. Thanks!