-
Notifications
You must be signed in to change notification settings - Fork 0
Forward problem solver
Use this function to:
- Coregister the sensor positions in the
EEG
structure with a template. - Compute the lead field matrix.
The function first tries to look-up the channel labels of your montage in a precomputed head model template based on the Colin27 MRI. If the search is successful, the function returns immediately with the lead field that corresponds to your montage. If only a few channels match, it uses them to automatically estimate a warping from your channel space to the space of the skin layer of the template. If no match is found, the co-registration gui pops up and you need to continue the process manually.
EEG = pop_forwardModel(EEG, templatefile, conductivity, orientation);
Input arguments:
-
EEG
: EEGLAB's structure with nonemptyEEG.chanlocs
structure. -
templatefile
: file path to the template head model on disk. -
conductivity
: conductivity of each layer of tissue, scalp, skull, brain. The default value is:[0.33, 0.022, 0.33]
in S/m units, which is based on this paper. -
orientation
: if true, computes the orientation-free lead field, otherwise it constrain the dipoles to be normal to the cortical surface.
Output:
EEG
: EEGLAB's structure where EEG.etc.src.hmfile
points to the saved head model file (usually located next to the .set file) containing the computed forward model.
This function may or may not pop up a GUI depending on whether the co-registration process is needed. Learn more about co-registration here.
Compute the forward model using default parameters
EEG = pop_forwardModel(EEG);
Same as above but explititely specifying the parameters
templatefile = headModel.getDefaultTemplateFilename();
conductivity = [0.33, 0.022, 0.33];
orientation = false;
EEG = pop_forwardModel(EEG, templatefile, conductivity, orientation);
Visualize the individualized head model
hm = headModel.loadFromFile(EEG.etc.src.hmfile);
plot(hm);
Note that in the example above, hm.plot
also works because hm
is a headModel
object that defines its own plot
function.
Check that there are not polarity issues (if there are, simply multiply the lead field matrix by -1 and save it)
hm = headModel.loadFromFile(EEG.etc.src.hmfile);
% Simulate an activation in a given ROI, here we use the left precentral gyrus
ind = hm.indices4Structure('precentral L'); % Find the indices of some ROI
x = zeros(size(hm.K,2),1); % Initialize a source vector
x(ind) = 1; % Set to 1 only the dipoles in the selected ROI
% Simulate a scalp projection
y = hm.K*x;
% Plot simulations to make sure that both the cortical and scalp maps display activations in red
hm.plotOnModel( x, y);
% If the scalp activation is displayed in blue it means that the lead field has the polarity inverted,
% this can happen on some surfaces. The issue can be easily fixed as follows:
hm.K = -hm.K;
hm.saveToFile(EEG.etc.src.hmfile);