55. EEG topology preparation and use - fahsuanlin/labmanual GitHub Wiki

Data were tested on July 21 2025 in eeg_memory project.

EEG sensor locations in 10-20 sysystem

A comprehensive excel file at Biosemi.com provided the locations of EEG sensors. This file is copied here.

Procedure to create a customized topology

1. Load a 3D head mesh

Here we took the vertices and faces from a previously prepared matlab file (topology_31ch_default.mat) for the convenience sake. At the same time, prepare a file ( chan64.xlsx here) storing columns of EEG electrode names (column 1) and (x, y, z) coordinates (columns 5, 6, and 7).

NOTE: The chan64.xlsx file was edited from the Cap_coords_all.xls file.

close all; clear all;

load topology_31ch_default.mat;

etc_render_topo('vol_vertex',vertex,'vol_face',face-1)


T=readtable('chan64.xlsx');
tmp.coords=T{:,5:7}./1e3; %coordinates in meters
tmp.name=T{:,1}; %name

view(90,0);

2. Adjust sensor locations at Matlab GUI.

press button b: open sensor GUI

press button l: load tmp variable. It includes fields of coords (n x 3 double). and name (n x 1 string cells).

press button k': adjust sensor positions.

press button s': snap all sensors to the closest vertices of the head mesh.

press button Save': save all adjusted electrodes.

You can also use buttons to add/delete/rename individual electrodes.

Our 31-channel EEG + 1-channel EKG

The topology file in Matlab for 32-channel MRI-compatible EEG cap.

Our 63-channel EEG + 1-channel EKG

The topology file in Matlab for 64-channel MRI-compatible EEG cap.

Use with EEG trace viewer

1. load data

close all; clear all;
load pt-009_eeg1_0006_resting.mat
etc_trace(EEG,'fs',sfreq);

2. load electrode names

At the control GUI, push l and then channel label button in the Load data window. Choose the variable that stores names of electrodes. Here it is label variable.

Now the trace window should update the electrode names.

2. load topology

Press t to load the electrode topology definition. Here the data were from a 64-channel system (63-channel EEG + 1-channel ECG). The topology matlab file should be topology_63ch_default.mat. A topology window should appear.

Click the trace to somewhere with stronger signals. A colored topology should be shown. You can also adjust the threshold by pressing d in the topology window.

⚠️ **GitHub.com Fallback** ⚠️