Hello,
I am having trouble with my script. I am compute the head model fine, but upon attempting to project the electrodes onto the scalp, nothing occurs (the green dots in the space, I believe).
When I go into Channels→MRI registration→Edit→Project electrodes onto surface, it works correctly. However, using a script does not work. I have searched and found the following threads, but they did not work:
From the process1 tab, this is the function that I ran:
% Script generated by Brainstorm (28-Jul-2025)
% Input files
sFiles = {...
'EEGonly_001/@rawClinical_epoch_0_1-S1/data_0raw_Clinical_epoch_0_1-S1.mat'};
% Start a new report
bst_report('Start', sFiles);
% Process: Project electrodes on scalp
sFiles = bst_process('CallProcess', 'process_channel_project', sFiles, [], ...
'sensortypes', 'EEG');
% Save and display report
ReportFile = bst_report('Save', sFiles);
bst_report('Open', ReportFile);
% bst_report('Export', ReportFile, ExportDir);
% bst_report('Email', ReportFile, username, to, subject, isFullReport);
% Delete temporary files
% gui_brainstorm('EmptyTempFolder');
Running this generated script from the process1 tab did not work. My custom script also did not work:
function headFiles = esiHeadModel(subjectStruct,subNum,epFileMatrix,adaptive)
subjectID_input = subjectStruct.subjectID(subNum);
disp(string(datetime('now')) + ": Creating Head Model @" + string(subjectID_input))
% store names for epochs so brainstorm knows where to look. using a for
% loop makes it so that we can add more epochs down the line if desired
for i=1:length(epFileMatrix)
headFileTemp = epFileMatrix(i).FileName;
headFileNames{i} = char(headFileTemp);
end
% Process: Compute head model
headFiles = bst_process('CallProcess', 'process_headmodel', headFileNames, [], ...
'Comment', '', ...
'sourcespace', 1, ... % Cortex surface
'meg', 4, ... % OpenMEEG BEM
'eeg', 3, ... % OpenMEEG BEM
'ecog', 2, ... % OpenMEEG BEM
'seeg', 2, ... % OpenMEEG BEM
'openmeeg', struct(...
'BemFiles', {{}}, ...
'BemNames', {{'Scalp', 'Skull', 'Brain'}}, ...
'BemCond', [1, 0.0125, 1], ...
'BemSelect', [1, 1, 1], ...
'isAdjoint', 0, ...
'isAdaptative', adaptive, ...
'isSplit', 0, ...
'SplitLength', 4000), ...
'channelfile', '');
bst_process('CallProcess', 'process_channel_project', headFiles, []);
end
Does anyone have any idea what could be going on? Thank you