Jump to content

VisualizeBCI2000

From BCI2000 Wiki
(Redirected from Python Visualizations)
An example video showing the CCEP filter with VisualizeBCI2000.

Introduction

A Python toolkit to powerfully visualize BCI2000 data in real-time. The incoming data can be pre-processed in BCI2000's pipeline, or not, then sent to python through BCI2000's SignalSharing feature. The data can also be visualized in 3D if combined with a VERA structure (electrode localization tool). It is designed based on BCI2000's standard of modularity, therefore any of these components can be swapped out without changing the rest of the pipeline.

Installation

VisualizeBCI2000 can be downloaded from GitHub here

  1. Python 3.8+ needs to be installed. You can download the lastest version here.
  2. A couple additional packages are used in this visualization. Run the following segments using pip in the command line.
    • Numpy: pip install numpy
    • PyQt5: pip install PyQt5
    • PyQtGraph 0.13.3+: pip install pyqtgraph
    • SciPy: pip install scipy (only the stats package is required)
    • PyOpenGL: pip install PyOpenGL PyOpenGL_accelerate

Set-up

  1. Once VisualizeBCI2000 is downloaded and unzipped from Github, run main.py with Python. This will bring you to the main page, shown below.
  2. Next, choose your BCI2000 location, under File, then Choose BCI2000 Location...
  3. Choose the filter to visualize, under Filters
  4. Run a batch file with the chosen filter in the pipeline. For example, if CCEPFilter was chosen, you should run a batch file that uses CCEPFilter as its Signal Processing module.
  5. Set config, then start. Then the filter should be visualized!

See the gallery below for images to follow each step.


Settings

These Settings are available to configure in the toolbar

  • Choose BCI2000 Location: Choose the directory in which your BCI2000 resides. The folder chosen should be the main, root folder. This is mainly used to access the BCI2000Remote files, which are assumed to be located in the prog folder of the root directory.
  • Filters: The BCI2000 Signal Processing filter which sends the incoming data. Each filter requires a custom Python implementation. Currently, the only 2 filters that are available are:
    • CCEPFilter
    • Phase-amplitude coupling (PACFilter)
    • DataIOFilter: This streams the raw data from BCI2000 and continually updates a grid of plots. This is less of a useful visualization, and more of an example for a basic visualization.
  • Data Streams: Defaults to BCI2000. If other data streams are desired, these must be implemented.

3D Visualization

To enable the 3D visualization, you must input a VERA structure. VERA is an electrode localization application made to simplify electrode localization. The output of the VERA pipeline is a .mat (Matlab) structure, which is the input to be loaded into VisualizeBCI2000. In order to match the electrode names with the BCI2000 channel names, there must be a field called electrodeNamesKey, with columns VERANames and EEGNames. This table provides a necessary key between the two names.