Knowledge Vault 3/73 - G.TEC BCI & Neurotechnology Spring School 2024 - Day 8
Off-line analysis of EEG-data with g.BSanalyze
Danut Irimia, g.tec medical engineering GmbH (RO)
<Resume Image >

Concept Graph & Resume using Claude 3 Opus | Chat GPT4 | Llama 3:

graph LR classDef offline fill:#f9d4d4, font-weight:bold, font-size:14px; classDef preprocess fill:#d4f9d4, font-weight:bold, font-size:14px; classDef analysis fill:#d4d4f9, font-weight:bold, font-size:14px; classDef classification fill:#f9f9d4, font-weight:bold, font-size:14px; classDef results fill:#f9d4f9, font-weight:bold, font-size:14px; classDef p300 fill:#d4f9f9, font-weight:bold, font-size:14px; classDef additional fill:#f9d4d4, font-weight:bold, font-size:14px; classDef summary fill:#d4f9d4, font-weight:bold, font-size:14px; A[Danut Irimia] --> B[Offline analysis RecoverX dataset
GPS Analyze. 1] B --> C[Filter 8-30Hz, split
left/right trials. 2] C --> D[Load C3/C4, source
derivation re-reference. 3] B --> E[Compare reference/action C3
right C4 left. 4] E --> F[ERD C3/right C4/left
post-trigger desynchronization. 5] F --> G[ERD maps C3/C4
time frequency domains. 6] B --> H[CSP filters feedback phase
C3/C4 heatmaps. 7] H --> I[Spatially filter CSP,
reduce feature channels. 8] I --> J[Variance 1s segments,
normalize, log10 transform. 9] B --> K[Feature matrix 500-8000ms,
train LDA classifier. 10] K --> L[10x10 cross-validation error rates,
re-train classifier. 11] K --> M[Apply classifier, label
trials, map results. 12] B --> N[Plot accuracy >90%
6.5s post-trigger. 13] B --> O[Visualize 3D electrode
montage spatial arrangement. 14] B --> P[Plot CSP activation
clusters C3/C4 3D. 15] P --> Q[Export high-res CSP-on-brain
images publications. 16] A --> R[Load P300 dataset
target non-target trials. 17] R --> S[Visualize P300 ERP
baseline correction statistics. 18] S --> T[Measure P300 N100 amplitudes
latencies statistical significance. 19] A --> U[Additional features: AR, variance,
power, cross-correlation. 20] A --> V[Mark cut artifact
trials clean data. 21] A --> W[Split raw data equal-length
analysis epochs. 22] W --> X[Select epochs interest,
compare data subsets. 23] A --> Y[Audience Q&A: ERP plots
statistical significance. 24] Y --> Z[P<0.01 dark, p<0.05 light
blue/gray pos/neg. 25] A --> AA[GUI steps logged MATLAB
code scripting automation. 26] AA --> AB[Batch process files change
subject/session script. 27] A --> AC[Thanks Danut detailed RecoverX
GPS Analyze demo. 28] AC --> AD[Highlight MATLAB logging code
replication analysis. 29] A --> AE[Summary: comprehensive BCI motor
imagery processing walkthrough. 30] class B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q offline; class R,S,T p300; class U,V,W,X additional; class Y,Z,AA,AB,AC,AD summary; class AE summary;


1.- Danut Irimia demonstrates offline analysis of RecoverX dataset using GPS Analyze software, starting by loading the raw EEG data.

2.- Data is filtered using an 8-30 Hz bandpass Butterworth filter, excluding the last channel. Data is then split into left/right trials.

3.- C3 and C4 electrode positions are loaded using a pre-defined montage. A source derivation re-referencing is performed on these channels.

4.- Spectrum analysis compares reference and action intervals for C3 (right trials) and C4 (left trials), showing clear differences between spectra.

5.- Event-related desynchronization (ERD) is calculated for C3/right and C4/left, showing desynchronization in the post-trigger action interval.

6.- ERD maps are generated for C3 and C4, visualizing desynchronization in time and frequency domains for left and right trials.

7.- Common Spatial Patterns (CSP) filters are computed using a 2-second window during the feedback phase, resulting in heat maps around C3/C4.

8.- The dataset is spatially filtered using the first two and last two CSP filters, reducing it to four feature channels.

9.- Variance is computed on 1-second segments with 996ms overlap, replacing all channels. Data is then normalized and log10 transformed.

10.- Feature matrix is created using 500ms steps from 500-8000ms post-trigger. LDA classifier is trained and saved.

11.- 10x10 cross-validation is performed to estimate error rates. The classifier is re-trained on all data and saved.

12.- The trained classifier is applied to the entire dataset to label each trial. Classification results are mapped for visualization.

13.- Accuracy over time is plotted, showing >90% accuracy by 6.5 seconds post-trigger for this dataset.

14.- The electrode montage is visualized in an interactive 3D view to better understand the spatial arrangement.

15.- CSP results are plotted on the 3D head model, clearly showing activation clusters under C3 and C4 electrodes.

16.- High-resolution images of the CSP-on-brain visualization can be exported for use in publications.

17.- A P300 dataset is loaded to demonstrate ERP analysis. Data contains target and non-target trials.

18.- P300 ERP is visualized using baseline correction and statistical comparison between target and non-target trials.

19.- Peak amplitudes and latencies of the P300 and N100 components are measured. Statistical significance is indicated by color coding.

20.- Additional features in GPS Analyze include parameter extraction (AR coefficients, variance, band power, etc.), cross-correlation, and more.

21.- Artifact trials can be manually marked and then cut from the dataset to clean the data.

22.- Raw data can be split into equal-length epochs for analysis even in the absence of event markers.

23.- Specific epochs of interest can be selected for focused analysis. GPS Analyze facilitates comparison of data subsets.

24.- Questions are taken from the audience. The small green/blue areas on ERP plots indicate statistical significance of target/non-target differences.

25.- P-values less than 0.01 (highly significant) are dark blue/gray, while p<0.05 is light blue/gray, for positive and negative differences respectively.

26.- It is noted that all processing steps demonstrated in the GUI are logged as MATLAB code for scripting and automation.

27.- This allows easy batch processing of multiple files by simply changing the subject/session number in the script.

28.- Danut is thanked for the detailed demonstration of the RecoverX data processing pipeline in GPS Analyze.

29.- The MATLAB command window logging each step as code is highlighted as a useful feature for replicating the analysis.

30.- In summary, the lecture provided a comprehensive walkthrough of processing a BCI motor imagery dataset using GPS Analyze, from raw data to results.

Knowledge Vault built byDavid Vivancos 2024