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.
On this pageTwo weekends
In Phase 2 you drove a buried dipole and recorded eight electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry: a measured forward model. Now compute it. Given a source in a head, what does each electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry see? That is the forward problemForward problem Given a source in the head, compute the voltages on the scalp; it has a unique answer. Related: Inverse problemInverse problem Given voltages on the scalp, find the sources; it has infinitely many answers, so every solution leans on assumptions., Current dipoleCurrent dipole The simplest model of a patch of active cortex: a tiny current source and sink close together, with a strength and a direction.. Glossary entry and it has one answer. Then the question every EEGElectroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. Related: Electrocorticography (ECoG)Electrocorticography (ECoG) Recording from electrodes placed on the surface of the brain under the skull, usually during epilepsy surgery evaluation; cleaner and sharper than EEG. , Magnetoencephalography (MEG)Magnetoencephalography (MEG) Recording the tiny magnetic fields produced by cortical currents with superconducting sensors in a shielded room; less blurred by the skull than EEG, and far more expensive. , Volume conductionVolume conduction The spreading of currents from a source through the conductive tissues of the head, which is why one source shows up on many electrodes and why scalp EEG is blurry. , Microvolt (µV)Microvolt (µV) One millionth of a volt. Scalp EEG is tens of microvolts; a AA battery is 1.5 million of them. . Glossary entry analyst wants answered: given the electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry, where was the source? That is the inverse problemInverse problem Given voltages on the scalp, find the sources; it has infinitely many answers, so every solution leans on assumptions. Related: Forward problemForward problem Given a source in the head, compute the voltages on the scalp; it has a unique answer., Source localizationSource localization Estimating where in the brain scalp signals came from, using a head model and assumptions such as smoothness or sparsity.. Glossary entry, and it has infinitely many answers, so every method leans on an assumption. You will build both and feel the difference.
- 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.
- Push the dipole deep. The pattern spreads over half the head and the amplitude collapses. Deep sources are nearly invisible.
- 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.
- Add the second dipole with 20 degrees separation. Could you tell from the scalp that there are two?
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 electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry cannot tell them apart. Adding electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry 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 reciprocityThe 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 MNEMNE-Python The standard open-source Python library for EEG and MEG analysis: filtering, epoching, ICA, topographies, source localization. Related: Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. . Glossary entry’s make_sphere_model, which does. Place a dipole, compute the potential at your phantomPhantom A physical stand-in for tissue, such as saline gelatin with embedded wires, used to test an instrument against known signals. Related: CharacterizationCharacterization Measuring what your instrument actually does, such as its noise floor, bandwidth, and rejection, instead of assuming the datasheet. . Glossary entry’s eight electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry 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 in a uniform medium of conductivity , the potential at distance along direction is:
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. MNEMNE-Python The standard open-source Python library for EEG and MEG analysis: filtering, epoching, ICA, topographies, source localization. Related: Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. . Glossary entry 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 electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry of a standard montageMontage The particular arrangement of which electrodes are subtracted from which, such as referential, bipolar, or average reference. Related: Reference electrodeReference electrode The electrode every other channel is measured against; there is no neutral spot on the head, so the choice shapes every trace. , Common average referenceCommon average reference Re-referencing every channel to the mean of all channels, which approximates a neutral reference when electrodes cover the head well. , Surface LaplacianSurface Laplacian Subtracting the average of neighbouring electrodes from each electrode, which sharpens spatial detail and suppresses distant sources. . Glossary entry. This “leadfield” matrix, thousands of sources by tens of electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry, is what every source-localization method starts from.
In matrix form, electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry data from source activity through the leadfield plus noise:
Here holds the electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry potentials, is the leadfield (sources by electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry), the source amplitudes, and 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 topographic mapTopographic map The head-shaped colour plot of voltage or power at each electrode, interpolated between them. Related: MontageMontage The particular arrangement of which electrodes are subtracted from which, such as referential, bipolar, or average reference. . Glossary entry. 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, MNEMNE-Python The standard open-source Python library for EEG and MEG analysis: filtering, epoching, ICA, topographies, source localization. Related: Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. . Glossary entry 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 setting the tradeoff:
which has the closed form:
The 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 and moment for the best fit:
Here is the leadfield column for a source at . 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 EEGElectroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. Related: Electrocorticography (ECoG)Electrocorticography (ECoG) Recording from electrodes placed on the surface of the brain under the skull, usually during epilepsy surgery evaluation; cleaner and sharper than EEG. , Magnetoencephalography (MEG)Magnetoencephalography (MEG) Recording the tiny magnetic fields produced by cortical currents with superconducting sensors in a shielded room; less blurred by the skull than EEG, and far more expensive. , Volume conductionVolume conduction The spreading of currents from a source through the conductive tissues of the head, which is why one source shows up on many electrodes and why scalp EEG is blurry. , Microvolt (µV)Microvolt (µV) One millionth of a volt. Scalp EEG is tens of microvolts; a AA battery is 1.5 million of them. . Glossary entry spatially blurry and MEGMagnetoencephalography (MEG) Recording the tiny magnetic fields produced by cortical currents with superconducting sensors in a shielded room; less blurred by the skull than EEG, and far more expensive. Related: Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry, 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 “EEGElectroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. Related: Electrocorticography (ECoG)Electrocorticography (ECoG) Recording from electrodes placed on the surface of the brain under the skull, usually during epilepsy surgery evaluation; cleaner and sharper than EEG. , Magnetoencephalography (MEG)Magnetoencephalography (MEG) Recording the tiny magnetic fields produced by cortical currents with superconducting sensors in a shielded room; less blurred by the skull than EEG, and far more expensive. , Volume conductionVolume conduction The spreading of currents from a source through the conductive tissues of the head, which is why one source shows up on many electrodes and why scalp EEG is blurry. , Microvolt (µV)Microvolt (µV) One millionth of a volt. Scalp EEG is tens of microvolts; a AA battery is 1.5 million of them. . Glossary entry 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 electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry:
It subtracts what is common to all electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry; the Laplacian subtracts the local average around each electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry instead. Both are spatial filtersFilter An operation that passes some frequencies and attenuates others; every filter also delays or distorts the timing of what it passes. Related: High-pass filterHigh-pass filter Removes slow drifts and DC offsets, passing everything above a cutoff; set it too high and you erase slow brain activity. , Low-pass filterLow-pass filter Removes fast content above a cutoff; the anti-alias filter is one, and so is the smoothing you apply to a noisy trace. , Notch filterNotch filter A very narrow filter that removes one frequency, usually 60 Hz mains hum; it also rings and distorts nearby content, so fix the hum at the source first. , Phase distortionPhase distortion Different frequencies being delayed by different amounts, which smears and shifts waveforms such as an ERP peak. . Glossary entry applied after the forward physics blurs the signal.
- Reproduce your phantomPhantom A physical stand-in for tissue, such as saline gelatin with embedded wires, used to test an instrument against known signals. Related: CharacterizationCharacterization Measuring what your instrument actually does, such as its noise floor, bandwidth, and rejection, instead of assuming the datasheet. . Glossary entry’s eight-electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry spatial map with a three-sphere analytic model. Fit the conductivity.
- Build the fsaverage forward model. Plot leadfield topographies for a shallow radial source, a sulcal tangential source, and a deep source.
- Simulate scalp data from one dipole plus noise. Run minimum-norm. Plot the estimate. Measure how far it spreads.
- Run a dipole fit on the same data. Then on two dipoles.
- Run minimum-norm on your own eyes-closed alpha from Phase 1 or 2 (average-referenced). Describe what it shows and what it cannot.