↑↓ move↵ open[] previous / next lesson? all shortcuts
Appearance
Theme
Type size
Reading

Focus mode hides the sidebars. Press f to toggle it anywhere.

Keyboard shortcuts
/
Search
[ ]
Previous / next lesson
t
Jump to the table of contents
r
Review queue
f
Focus mode
?
This panel
ProjectTwo weekends$0Tier 0

Project B: The forward and inverse problems

Put a dipole in a head model and compute the scalp potentials. Then try to go backward. Compare to the spatial map you measured on the phantom. The physics of why scalp EEG is blurry, done by you.

AssumesProject D: The phantom headSpatial filters and montagesSpineComputational neuroscienceDecoding / signal processing / ML
On this pageTwo weekends
  1. Forward, analytically
  2. Inverse, honestly
  3. What you will have understood

In Phase 2 you drove a buried dipole and recorded eight : a measured forward model. Now compute it. Given a source in a head, what does each see? That is the and it has one answer. Then the question every analyst wants answered: given the , where was the source? That is the , and it has infinitely many answers, so every method leans on an assumption. You will build both and feel the difference.

Volume conduction in a layered head
This interactive needs JavaScript. If you are reading a printout, the caption describes what it shows.
Figure 1. A layered head in two dimensions, solved exactly. The resistive skull spreads and shrinks the scalp potential. Add a second dipole and watch two sources become nearly indistinguishable from the outside.
Try this
  1. Set skull resistivity to 1 (no skull). Note the peak amplitude and the lobe width. Now 40. The peak drops and the lobe widens. That is the skull’s blur.
  2. Push the dipole deep. The pattern spreads over half the head and the amplitude collapses. Deep sources are nearly invisible.
  3. Turn the orientation to 90 degrees (tangential). The pattern flips sign across the source. This is what a source on a sulcal wall looks like.
  4. Add the second dipole with 20 degrees separation. Could you tell from the scalp that there are two?
Predict before you look

A source's scalp map is a broad positive patch over the right side. How many sources could produce exactly that map?

Infinitely many. Any pattern on the scalp can be produced by a single deep source, by several shallow ones, or by a smooth sheet of activity, and the cannot tell them apart. Adding helps a little; it does not change the count. This is why inverse solutions always come with a prior: “the fewest sources,” “the smoothest distribution,” “sources only on the cortical surface.”

Forward, analytically

The interactive solves a two-dimensional version exactly. The three-dimensional equivalent, three concentric spheres for brain, skull, and scalp, was solved by Rush and Driscoll in 1969EEG electrode sensitivity, an application of reciprocityRush, Driscoll · IEEE Trans. Biomed. Eng. · 1969The reciprocity result behind the three-sphere head model, which says what a scalp electrode can see. as a series in Legendre polynomials. Implement it, or use ’s make_sphere_model, which does. Place a dipole, compute the potential at your ’s eight positions, and compare to what you measured. The shapes should match; the amplitudes will differ by a factor that is your gelatin’s conductivity, which you can now estimate.

For one dipole with moment p\mathbf{p} in a uniform medium of conductivity σ\sigma, the potential at distance rr along direction r^\hat{\mathbf{r}} is:

ϕ(r)=14πσp⋅r^r2\phi(r) = \frac{1}{4\pi\sigma}\frac{\mathbf{p}\cdot\hat{\mathbf{r}}}{r^2}

The potential falls with distance squared and scales with the dipole’s alignment to the measurement direction. The three-sphere solution is this idea summed over Legendre terms at each boundary.

Then the realistic version. ships a template head (fsaverage) with a boundary-element model built from MRI: real skull shape, real cortical surface. Compute the forward solution for every point on the cortex and every of a standard . This “leadfield” matrix, thousands of sources by tens of , is what every source-localization method starts from.

In matrix form, data from source activity through the leadfield plus noise:

y=Lx+ny = Lx + n

Here yy holds the potentials, LL is the leadfield (sources by ), xx the source amplitudes, and nn the noise. Every inverse method starts from this equation.

import mne
from mne.datasets import fetch_fsaverage
fs_dir = fetch_fsaverage()
src = mne.setup_source_space('fsaverage', spacing='oct5', subjects_dir=fs_dir.parent)
bem = mne.make_bem_solution(mne.make_bem_model('fsaverage', subjects_dir=fs_dir.parent))
info = mne.create_info(ch_names=mne.channels.make_standard_montage('standard_1020').ch_names, sfreq=250, ch_types='eeg')
info.set_montage('standard_1020')
fwd = mne.make_forward_solution(info, trans='fsaverage', src=src, bem=bem, eeg=True)

Pick one source on the surface, take its column of the leadfield, and plot it as a . Pick a source in a sulcus, tangential to the scalp, and see the dipolar pattern. Pick a deep one and see almost nothing.

Inverse, honestly

Minimum norm: of all the source distributions that explain the scalp data, choose the one with the least total power. It is a matrix inverse with regularization, does it in two lines, and it produces smooth, blurry, shallow-biased estimates, because that is what the prior asks for. Try it on a single simulated dipole from your own forward model and see how far the estimate spreads. Then add noise and see it move.

Minimum norm chooses the smallest sources that explain the data, with λ\lambda setting the tradeoff:

x^=arg⁡min⁡x(∥y−Lx∥2+λ2∥x∥2)\hat{x} = \arg\min_x \left(\lVert y - Lx\rVert^2 + \lambda^2\lVert x\rVert^2\right)

which has the closed form:

x^=L⊤(LL⊤+λ2I)−1y\hat{x} = L^\top(LL^\top + \lambda^2 I)^{-1}y

The λ2I\lambda^2 I term keeps the inverse stable when noise dominates; the price is the smooth, shallow-biased image.

Then a different prior, dipole fitting: assume one source and search for the position and orientation that best fit the data. On a single simulated dipole it works beautifully. On two, it finds one somewhere in between. On the real alpha you recorded in Phase 1, it finds something in the occipital lobe, and you now know exactly how much to trust that.

Dipole fitting instead assumes one source and searches position r0r_0 and moment qq for the best fit:

min⁡r0,q∥y−L(r0) q∥2\min_{r_0, q} \lVert y - L(r_0),q \rVert^2

Here L(r0)L(r_0) is the leadfield column for a source at r0r_0. On one simulated dipole this lands on target; on two it lands somewhere in between.

What you will have understood

Why the same scalp pattern does not identify its source. Why a resistive skull makes spatially blurry and , which the skull barely affects, sharper. Why the average reference and the Laplacian do what they do. Why intracortical arrays exist. And why any headline of the form “ reveals activity in the amygdala” should be met with a raised eyebrow: deep, small, and far from the scalp is exactly what the forward model says you cannot see.

The average reference is one line per :

viavg=vi−1N∑jvjv_i^{avg} = v_i - \frac{1}{N}\sum_j v_j

It subtracts what is common to all ; the Laplacian subtracts the local average around each instead. Both are spatial applied after the forward physics blurs the signal.

  1. Reproduce your ’s eight- spatial map with a three-sphere analytic model. Fit the conductivity.
  2. Build the fsaverage forward model. Plot leadfield topographies for a shallow radial source, a sulcal tangential source, and a deep source.
  3. Simulate scalp data from one dipole plus noise. Run minimum-norm. Plot the estimate. Measure how far it spreads.
  4. Run a dipole fit on the same data. Then on two dipoles.
  5. Run minimum-norm on your own eyes-closed alpha from Phase 1 or 2 (average-referenced). Describe what it shows and what it cannot.
Recall
Why does the inverse problem have infinitely many solutions?
Many different source configurations (one deep source, several shallow ones, a smooth sheet) produce identical scalp potentials, and electrodes on the surface cannot distinguish them. Every inverse method adds a prior to choose among them.
Recall
What does the skull do to scalp EEG, and why does MEG not suffer the same way?
Its low conductivity spreads current laterally, widening and shrinking the scalp pattern (spatial blur). Magnetic fields pass through the skull almost unaffected, so MEG is sharper.
Recall
What is a leadfield matrix?
The forward solution for every candidate source location and orientation at every electrode: a matrix that maps source activity to scalp potentials, which all source-localization methods invert in some regularized way.