The Neurophysiological Biomarker Toolbox (NBT)

# Part III: Localizing EEG sources

In this last part of the tutorial we will attempt to solve the EEG inverse problem. That is, given a distribution of scalp potentials we will attempt to localize the underlying EEG sources. In fact this is just one part of the inverse solution. The full solution involves also the reconstruction of the temporal activation of the underlying EEG sources. However, we will leave that for a future tutorial where our EEG sources will have time-varying activation patterns.

In this part III of the tutorial you may use some the sources that you generated in Part II or you may as well generate new sources altogether. I will follow the latter approach. If you decide to use new sources then you should first remove the old ones:

myHead = remove_source(myHead, 1:5);

### Localizing a single dipole

Let's generate a radial and superficial dipole:

myHead = add_source(myHead, 'Name', 'radial', 'strength', 1, ...
'MaxDepth', 10, 'Angle', 0)
figure;
plot_source_leadfield(myHead, 1, 'momemtum', 50)

Now let's plot the scalp potentials that we would measure in such a single dipole scenario:

figure;
plot_scalp_potentials(myHead, 'time', 1)

The result is shown below.

As we have single EEG source and no noise, the distribution of scalp potentials (what we are measuring) is identical to the leadfield generated by the only underlying EEG source (what we need for source localization). This is obviously an ideal scenario and we would expect to be able to solve the inverse problem accurately. Let's try:

myHead = inverse_solution(myHead);
figure;
plot_inverse_solution_dipoles(myHead, 'time', 1);

The first command above will estimate the location of the source using a Minimum Norm Estimate (MNE), which is the method employed, for instance, by the MNE software. The generated figure is shown below:

Although you can barely see it in the figure above, the inverse solver estimated non-zero activation not only at the true location of the dipole, but also at many other locations of the source grid. You can actually inspect the activation values that were estimated at each source voxel with the command:

figure;
xlabel('Source grid voxel number');
ylabel('Estimated source strength');

which, in my case, looks like this:

Indeed, the only source grid location at which the strength is significantly different from zero is voxel 245, which is also the location of the true underlying dipole:

myHead.Source(1)
ans =
           name: 'radial'
strength: 1
orientation: [0.5630 0.8133 0.1466]
angle: 0
pnt: 245
momemtum: [0.5630 0.8133 0.1466]
activation: 1

### Background Noise

To make our simulations a bit more realistic, we will add some background noise having half the strength of our EEG source of interest:

myHead = add_source_noise(myHead, 'strength', 0.5);

Now let's plot the source leadfield corresponding to the noisy source and the scalp potentials that we would measure in this noisy scenario:

figure;
figure;
set(gcf, 'Name', 'Measured scalp potentials');

The two resulting figures are shown below, together with the pattern of scalp potentials that we obtained in the noise-free scenario:

As you can see the distribution of scalp potentials still resembles the source leadfield but has been disturbed by the noise. Let's localize the underlying source and plot the estimate:

myHead = inverse_solution(myHead);
figure;
figure;
plot_inverse_solution_dipoles(myHead, 'time', 1, 'exp', 4);

The latter command will use a higher weighting exponent for the plot so that stronger voxel activations will appear even stronger and weak activations will look even weaker. The resulting figures are shown below:

As you can see, the inverse estimate has deteriorated considerably and it is now much more difficult to tell where the source of interest is located. Still, if you would inspect myHead.InverseSolution.strength you would discover that the strongest voxel is still 245, i.e. the true location of the underlying EEG dipole.

Use the tools that I used above to determine how strong the noise should be for the inverse solution to fail to identify the location of the EEG source.

### Try yourself

Depending on how much time you still have left, use the tutorial scripts to find out how effective the inverse solution is in the following scenarios:

1. Multiple EEG sources of interest
2. Deep sources