Hello,
I’m trying to generate BEM surfaces and head models in Brainstorm using the MATLAB functions from the Epilepsy tutorial, but I can’t get them to work properly.
When I run process_generate_bem, the process finishes without any error, but the output structure is empty. In the GUI, no BEM surfaces appear under the subject, as if nothing had been created. I’m also trying to compute the EEG-only head model, but since no BEM surfaces are generated, this step fails as well.
Although I am writing my script in Python (using the MATLAB engine), the same issue occurs when running the functions directly in MATLAB, so it doesn’t seem to be language-related. Here is my code:
#BEM Surfaces
self.eng.bst_process('CallProcess', 'process_generate_bem', [], [],
'subjectname', subject_name,
'nscalp', 1922.0,
'nouter', 1922.0,
'ninner', 1922.0,
'thickness', 4.0,
'method', 'brainstorm',
nargout=0)
# Head model
headmodel = self.eng.bst_process('CallProcess', 'process_headmodel', output_eeg, [],
'sourcespace', 1,
'eeg', 3,
'openmeeg', {
'BemSelect': matlab.double([1, 1, 1]),
'BemCond': matlab.double([1, 0.0125, 1]),
'BemNames': {'Scalp', 'Skull', 'Brain'},
'BemFiles': {},
'isAdjoint': 0,
'isSplit': 0,
'isAdaptative': 1,
'SplitLength': 4000},
nargout=1)
Regarding the first function, I also tried to run it without the float numbers, but it did not work.
Is there anything I should change or add to make the BEM surfaces generate correctly?
Thank you in advance!
