Intracranial EEG (iEEG) is recorded with electrodes placed directly on or in the brain, usually in patients with drug-resistant epilepsy during the evaluation before epilepsy surgery:
electrocorticography (ECoG): grids or strips of electrodes on the surface of the cortex (subdural),
stereo-EEG (sEEG): depth electrodes with several contacts, inserted into the brain.
Compared with the scalp EEG, iEEG has:
a much higher spatial resolution (millimetres) and signal-to-noise ratio, since the signal is not attenuated and blurred by the skull and scalp,
a larger amplitude (hundreds of μV) and a broader frequency range, including high-gamma activity (about 70–150 Hz), which reflects local neuronal population activity and is a robust marker of cortical activation,
coverage limited to the regions implanted for clinical reasons.
Loading ECoG Data
The example dataset is a MATLAB file with an ECoG recording (47 channels, 1000 Hz) and a stimulus channel coding a task with 3-second blocks: rest (0) and two task conditions (11 and 12). Data stored in a non-standard format are loaded manually and placed in a NEURO object:
# read data from a MATLAB filedataset =matread("files/eeg/ecog.mat")# in NeuroAnalyzer channels are in rows: (channels, samples, epochs)data =reshape(permutedims(Float64.(dataset["data"])), 47, :, 1)# create NeuroAnalyzer.NEURO objectecog =create_object(; data_type ="ecog")# the dataset sampling rate is 1000 Hzcreate_data!(ecog; data = data, fs =1000,type="ecog")# the recording was made in a 60 Hz power gridecog.header.recording[:line_frequency] =60
The task blocks are added as markers: a marker at each change of the stimulus channel, with the stimulus code as its value:
stim =vec(dataset["stim"])onsets =findall(diff([0.0; stim]) .!=0)for idx in onsetsadd_marker!(ecog; id ="block", start = (idx -1) /sr(ecog), len =3.0, value =string(Int(stim[idx])), ch =0)endfirst(ecog.markers, 5)
5×5 DataFrame
Row
id
start
length
value
channel
String
Float64
Float64
String
Int64
1
block
10.16
3.0
12
0
2
block
13.16
3.0
0
0
3
block
16.16
3.0
12
0
4
block
19.16
3.0
0
0
5
block
22.16
3.0
12
0
info(ecog)
Ten seconds of the recording (all channels):
NeuroAnalyzer.plot(ecog; ch ="all", seg = (10, 20), gui =false)
The power decreases with frequency over the whole range (the 1/f spectrum is visible up to 200 Hz, as the signal is recorded directly from the cortex), and the line noise is visible at 60 Hz and its harmonics (120 and 180 Hz). It is removed using notch filters:
for f in [60, 120, 180] NeuroAnalyzer.filter!(ecog; ch ="all", fprototype =:iirnotch, cutoff = f, bw =2)end
High-Gamma Activity
The power of the high-gamma band (70–150 Hz) is compared between the task blocks and the rest blocks. The recording is divided into 3-second epochs for each condition:
The two conditions activate different sets of channels: condition 12 increases the high-gamma power by up to 2.3 times (log ratio 0.37) in channels 6–7, 13–15 and 21–22, where condition 11 slightly decreases it, while condition 11 activates mainly channels 29, 36 and 44. With the electrode locations (not included in this dataset), such maps show the cortical areas involved in each task, e.g. for functional mapping before epilepsy surgery.