View Full Version : Problem when making a BEM using the script
ales
February 22nd, 2007, 19:43
I modified the bstscript_fowardinverse_basic.m to make a BEM instead of a sphere and I ran into a little problem. My surfaces/electrodes where created outside of the brainstorm gui and were not centered at 0, but at [128 128 128]. Leftover from my mri voxel coordinates. When I tried to create a BEM from these bst_headmodeler worked and output a model, but it was wrong, and ugly looking.
When recentered my surfaces and channels to [0 0 0] it all worked fine.
Sylvain
February 23rd, 2007, 01:40
Thanks Ales,
Thanks for your input. Maybe this odd behavior is due to something related to the algorithm that checks whether the nodes of the surface envelopes are well aligned to ensure accuracy of the BEM computation.
Thanks for raising the flag. Happy to hear this is working correctly once you have recentered the surfaces and the electrodes.
ales
February 23rd, 2007, 10:30
While I was trying to figure out why it wasn't working I tried playing with a lot of the OPTIONS.BEM values. But, first I changed from realistic surfaces to nested spheres, I generated them so they should have had aligned vertices. I tried turning on and off BEM.checksurf, that didn't make a difference. Changing BEM.basis from linear to constant did make a difference. When using the linear mode the model looked like noise. However, when I used the constant mode the model looked right, but just for the hemisphere that was opposite the [0,0,0] coordinate. The hemisphere nearest [0,0,0] had 0 potential for any source location/orientation.
Sylvain
February 25th, 2007, 12:09
BEM is sensitive to errors when sources are located very close to the inner envelope of the head model. Could it be that this would cause the errors or odd behavior you are seing ? If not, I will ask you to send me your envelopes and sensor locations.
thanks!
ales
February 28th, 2007, 12:54
I don't think that was the problem. When I was checking the results I used a few different locations, both near the middle of the volume and near the edges. I also looked at the results from several of the volume source grid locations. I attached the surfaces/channel files I was using for the tests. As well as the code I used to generate the headmodel from those files.
fwOPTIONS = bst_headmodeler;
% Store arguments to be passed to main script in fwOPTIONS structure
StudyFile = '/home/ales/data/new_ucb/study/Testing/Testing_brainstormstudy.mat'; fwOPTIONS.Method = {'eeg_bem'};
fwOPTIONS.ChannelFile = '/home/ales/data/new_ucb/fakeSphereChannel.mat';
fwOPTIONS.ChannelType = 'EEG';
fwOPTIONS.VolumeSourceGrid = 1;
% Type HELP BST_HEADMODELER.M for further info on the following arguments
fwOPTIONS.VolumeSourceGrid = 1;
fwOPTIONS.HeadModelFile = 'nested_spheres';
fwOPTIONS.ImageGridFile = 'nested_spheres';
fwOPTIONS.Verbose = 1;
%Options for creating a boundary element model
fwOPTIONS.BEM.Interpolative = 1;
fwOPTIONS.BEM.EnvelopeNames{1}.TessFile = '/home/ales/data/new_ucb/subject/JMA/nested_spheres_tess';
fwOPTIONS.BEM.EnvelopeNames{1}.TessName = 'brain';
fwOPTIONS.BEM.EnvelopeNames{2}.TessFile = '/home/ales/data/new_ucb/subject/JMA/nested_spheres_tess';
fwOPTIONS.BEM.EnvelopeNames{2}.TessName = 'skull';
fwOPTIONS.BEM.EnvelopeNames{3}.TessFile = '/home/ales/data/new_ucb/subject/JMA/nested_spheres_tess';
fwOPTIONS.BEM.EnvelopeNames{3}.TessName = 'scalp';
fwOPTIONS.BEM.Basis = 'linear';
fwOPTIONS.BEM.Test = 'Collocation';
fwOPTIONS.BEM.ISA = 1;
fwOPTIONS.BEM.NVertMax = 1000;
fwOPTIONS.BEM.checksurf = 0;
fwOPTIONS.ForceXferComputation =1;
% Call main function
[OPTIONS.HeadModelFile, tmp] = bst_headmodeler(StudyFile,fwOPTIONS);
Sylvain
February 28th, 2007, 13:39
thanks Ales,
I'm currently away from my desk until next week. I'll do my best to fix the BEM issues when I come back.