New views made easy – Visualizing ECoG grids & connectivity matrices via Analyzer 2’s MATLAB® transformation

by Jose Naranjo
Scientific Consultant and BrainVision Analyzer 2 Product Manager (Brain Products)

BrainVision Analyzer 2 is easy to use and offers a variety of views to display your data with a single mouse click. This provides you with fast visualization and comparison of different data sets in the time, frequency and time-frequency domain. However, science develops and new analysis methods entail the need for new data visualizations that Analyzer 2 does not yet support.

This article briefly discusses how to expand the view capabilities of BrainVision Analyzer 2 using the MATLAB® transformation. Two examples will illustrate this feature, where ECoG grid data and EEG connectivity matrices are visualized using simple MATLAB® functions.

ECoG Power View

Figure 1: ECoG 32 electrode grid. Dimensions are ChNy=4 and ChNx=8. Channels are arranged with increasing order from left to right and top to bottom.

Figure 1: ECoG 32 electrode grid. Dimensions are ChNy=4 and ChNx=8. Channels are arranged with increasing order from left to right and top to bottom.

Non-invasive human EEG recordings provide a unique insight into the underlying dynamics of neural activity at the millisecond scale. However, EEG meets a natural frontier at the head surface, which prohibits direct access to the neural source domain. Based on current technology, the exploration of the short-lived spatio-temporal dynamics of the underlying neural activity is possible by invasive recordings in the brain such as the ECoG (Electrocorticography). It provides high spatio-temporal resolution, robust signal-to-noise ratio and is less affected by artifacts. Furthermore, ECoG activity in different frequency bands contains relevant information about both short- and large-scale brain processes.

ECoG can be measured by electrode grids that are implanted on the surface of the brain (see Figure 1). Although Analyzer 2 provides powerful tools for ECoG data analysis, its 2D and 3D topographic views are conceived for EEG data on the human head surface. Nevertheless, with the MATLAB® transformation it is easy to create a 2D visualization of the ECoG data on the grid surface.

The MATLAB® function ECoG_View.m creates an ECoG power view in the delta, theta, alpha and beta frequency bands, as defined in BrainVision Analyzer 2. The function works correctly if the electrodes are arranged as shown in Figure 1. However, the code can be easily modified and expanded to include other electrode arrangements and additional frequency bands. In order to try it with your own data, please follow these steps:

  • Copy the file  ECoG_View.m in a folder of your PC and add it to the MATLAB® search path using the option Set Path. This will allow you to run M-files in this folder from Analyzer 2.

  • Open a workspace containing a history file with ECoG data. Perform the necessary preprocessing steps and calculate the average power spectrum across several segments.

  • Select the MATLAB® transformation from the ribbon (Transformations > Others > Matlab) and enter the command “ECoG_View(ChNy,ChNx,EEGData,EEGFrequency,Analyzer,FileName);” in the Code Executed on Creation of Node box. All channels shall be exported.

For this example ChNy = 4 and ChNx = 8 are the dimensions of the electrode grid (see Figure 1). EEGData, EEGFrequency, Analyzer, FileName are automatically created and exported to MATLAB® by Analyzer 2. These variables carry information about the FFT power for all channels, the frequency values as well as Analyzer 2 workspace information.

The ECoG power is shown in Figure 2 for the four frequency bands. The power in each electrode is color-coded in the range displayed by the colorbar. A local copy (TIFF image) of this figure is saved in the export folder of the current Analyzer 2 workspace.

Figure 2: ECoG FFT power on a (4 x 8) electrode grid for the delta, theta, alpha and beta bands.

Figure 2: ECoG FFT power on a (4 x 8) electrode grid for the delta, theta, alpha and beta bands.

EEG Coherence – Connectivity Matrix View

The human brain is considered to be the most complex structure in the universe. It holds this outstanding distinction because of the complex neural connectivity patterns (or Connectome) which dominate at multiple spatial and temporal scales. Anatomical and functional brain connectivity has regained much interest amongst the EEG research community. This interest has turned into the creation and application of several EEG connectivity methods as well as multiple utilities for the visualization of the human brain networks as connectivity graphs, connectivity matrices, etc..

BrainVision Analyzer 2 has, among its many visualization options, the Channel Pairs View and Band Channel Pairs View, which display connectivity data as 2D graphs in the sensor domain (i.e., each node is an EEG channel). You can find detailed information about these views in section 4.2.3 of the user manual for Analyzer 2.1.1. The MATLAB® transformation can be used to easily expand Analyzer 2 views for connectivity data as well. Let’s illustrate this point with the function Connectivity_Matrix_View.m, which displays channel pairs as generated by the Coherence transformation. In order to apply this function to your Coherence data, please follow these steps:

  1. Copy the file  Connectivity_Matrix_View.m in a folder of your PC and add it to the MATLAB® search path using the option Set Path.

  2. Open a workspace containing a history file with Coherence data. Note that this function can be used only if the option All Channel Pairs is selected in the Coherence transformation.

  3. Open MATLAB® transformation and enter the command “Connectivity_Matrix_View(NChannels,Method,EEGFrequency,EEGData,Analyzer,FileName);” in the Code Executed on Creation of Node All channels shall be exported.

In this example NChannels = 60, meaning that the connectivity matrix has been generated for a data set with 60 channels. The parameter Method indicates which connectivity method was used in the Coherence transformation. In this example Method = ‘COH’, meaning that the option Magnitude Square Coherence was used. EEGData carries the Coherence values for all channels pairs.

Figure 3 displays as connectivity matrices, the coherence between all channel pairs for the four frequency bands. Coherence for each channel pair is color-coded in the range from 0 to 1. A local copy of this figure is also saved in the Export folder of the current workspace. Note that in this example, large coherence values illustrate the impact of volume conduction effects on the estimation of EEG connectivity in the sensor domain.

Figure 3: Connectivity Matrix View. Coherence between all EEG channels (60) for the delta, theta, alpha and beta bands.

Figure 3: Connectivity Matrix View. Coherence between all EEG channels (60) for the delta, theta, alpha and beta bands.

Take home message

MATLAB®, together with its versatile libraries for signal processing and data visualization, has established itself as a powerful tool in the neuroscience research field. The interface from Analyzer 2 to MATLAB® expands the strength of both products and provides you with a unique combination of reliability, top usability, user-friendly interface and an unlimited capacity for signal processing. I invite you to take advantage of this unique Analyzer 2 feature. It is my hope that the two examples presented in this article have captured your attention. If you are interested in trying these functions or your own MATLAB® scripts with your own data, feel free to contact our Scientific Support team with your questions.

Acknowledgments

ECoG data and the grid picture (Figure 1) were kindly provided by Diana Ghinda, M.D.1, Georg Northoff, M.D. PhD2 and Jinsong Wu, M.D. PhD3.
[1] Department of Neurosurgery, University of Ottawa, Canada.
[2] Canada Research Chair in Mind, Brain Imaging and Neuroethics, ELJB-CIHR Michael Smith Chair in Neurosciences and Mental Health, Institute of Mental Health Research University of Ottawa, Canada.
[3] Huashan Hospital, Neurosurgical Department, Shanghai Medical College, Fudan University, China.

©Brain Products GmbH 2017
1 0