View Full Version : error using Minimum norm with BEM head model.
guilhem.ibos
February 5th, 2007, 06:19
Hi all,
I don't manage to perform a minimum norm imaging with a BEM head model. It bugs at the beginning of the process (while "start one-time (long computation) ...). The error message is at the end of my message.
Is it a problem with my BEM head model or a bug that is general to brainstorm?
Thanks for answers.
Gu
Error in ==> minnorm>gainmat_covar at 823
OPTIONS.iG(OPTIONS.iG == 0)= min(OPTIONS.iG(OPTIONS.iG ~= 0));
Error in ==> minnorm at 338
[AAt, Gain_RowNorm] = gainmat_covar(gainfile, OPTIONS);
Error in ==> bst_sourceimaging at 552
Results = minnorm(CurrentOPTIONS);
Error in ==> sourceimaging at 536
[Results,OPTIONS] = bst_sourceimaging(OPTIONS);
??? Error using ==> sourceimaging Go
Improper assignment with rectangular empty matrix.
Sylvain
February 5th, 2007, 10:53
HI,
this was a bug we had with a version distributed around December. Make sure you have the latest version and relaunch the min norm estimate.
let me know whether this is still crashing.
guilhem.ibos
February 23rd, 2007, 02:58
hi
I have changed my brainstorm version but the same error is still occuring when I perform a LCMV with BEM head model. I suppose it come from my head model, how can I verify it ?
Thanks.
Guilhem
Sylvain
February 23rd, 2007, 03:02
Then try a Minimum-Norm. If it still crashes, then we need to fix the BEM.
guilhem.ibos
February 23rd, 2007, 03:03
Heu no ,sorry it is not LCMV but min norm that I tried to run, but the error is still.
Thanks
Guilhem
Sylvain
February 23rd, 2007, 03:46
Last question before we fix: does this occur with the spherical head model ?
Thanks again.
guilhem.ibos
February 23rd, 2007, 03:50
yes it does, but it did not before I changed the version.
Sylvain
February 23rd, 2007, 04:13
Last last question: which version are you running ?
guilhem.ibos
February 23rd, 2007, 04:36
it is 2.2.23 implemented the 31 jan 2007.
Sylvain
February 23rd, 2007, 04:49
OK - please dowload the latest one (Feb 13 at least): only the small package and let me know if you're still having the same trouble (recompute the spherical head model and launch MinNorm)
thanks for your patience
guilhem.ibos
February 23rd, 2007, 10:48
there should be a problem with my head models, or with my envelops because I have try with 2 different subjects with the last version of brainstorm and message errors were different. How can I check wath is bas ?
Thanks for your help
Sylvain
February 25th, 2007, 12:06
Let's clarify what's happening:
1) at what time do the errors occur ? during headmodel computation or during MinNorm ?
2) please send me your envelopes and some pieces of data (ftp?) and I'll see what might be going wrong.
thanks.
Thorsteinn
February 26th, 2007, 04:30
Hi guilhem.ibos
I think we are dealing with the same BEM errors. In my post from 20th Feb I was having trouble with my BEM model, (see
http://neuroimage.usc.edu/forums/showthread.php?p=739#post739
for more details).
The errors I get are
??? In an assignment A(:) = B, the number of elements in A and B
must be the same.
Error in ==> minnorm>gainmat_covar at 899
OPTIONS.iG(OPTIONS.iG == 0) = min(OPTIONS.iG(OPTIONS.iG ~= 0));
Error in ==> minnorm at 359
[AAt, Gain_RowNorm] = gainmat_covar(gainfile, OPTIONS);
Error in ==> bst_sourceimaging at 555
Results = minnorm(CurrentOPTIONS);
Error in ==> sourceimaging at 538
[Results,OPTIONS] = bst_sourceimaging(OPTIONS);
??? Error using ==> sourceimaging Go
In an assignment A(:) = B, the number of elements in A and B
must be the same.
??? Error while evaluating uicontrol Callback
which seem to be the same as the ones you posted at the beginning of this thread. I traced my errors to the binary file containing the BEM Gain matrix. It containted no numbers, only 'NaN' (implying numerical erros in BEM algorithm?). Maybee you could check the binary file you get from the BEM calculations using the 'read_gain.m' function from the BrainStorm toolbox and see if it looks the same, i.e. if it has any numbers or just NaN like mine?
(e.g. read_gain('egidemo_headmodelVolGrid_CD_Gain_warped whitematter_CD_1.bin');)
Regards,
Thorsteinn
Sylvain
March 15th, 2007, 00:34
hi here,
I'm back to BST now after heavy grant proposal writing!!! I'll try to help you on this one ASAP.
Sylvain
March 18th, 2007, 13:51
Looks like the BEM crash is not happening with MEG data. I'm going to check this out with EEG only now; might be a voltage reference issue then.
Stay tuned
Sylvain
March 18th, 2007, 14:30
see post
http://neuroimage.usc.edu/forums/showthread.php?t=194&page=3
for a piece of answer please.
I even used your data but coud not reproduce the bug either. please try again with attached script in your toolbox folder.
guilhem.ibos
March 19th, 2007, 04:51
Hi,
the bug is steel appearing with the attached script. I tried what Torsteinn told me with read_gain and there is nothing but NaN in my file headmodel_Gain_thoju_cortex_10000V_tess_CTF_CD.bin . So Torsteinn and I are dealing with the same problem, except he is running with EEG and I am running with MEG.
Cheers.
Guilhem
Sylvain
March 19th, 2007, 09:17
OK - make sure you do select a cortical envelope for the sources in your model. Meaning that besides the BEM envelopes that you need to specify in the GUI that opens on the right hand side of the screen, you also need to select a scalp and a cortex surface in the main headmodel window, just like you do for the spherical models.
please let me know whether this is indeed what you both are doing.
Cheers,
guilhem.ibos
March 19th, 2007, 11:12
yes that's what I do,but it still bugs.
Thanks.
Guilhem
Sylvain
March 19th, 2007, 13:51
Make sure you actually delete all ***headmodel**.mat and *.bin files in your data folder before trying again the BEM model.
If yes, I really don't see what might be going wrong. All I can do is write a more detailed documentation on BEM usage; which would not do any harm anyway, right ?
Let me know how this is going once you've cleaned up your data folder.
thanks.
guilhem.ibos
March 20th, 2007, 03:31
Hi,
I do clean every head model files as I delete the brainstorm folder in my MEG_Data database and re-import .ds each time.
I am going to try with matlab6.5 and under windows even if my windows computers are slower.
Thanks for your help.
Guilhem
Sylvain
March 20th, 2007, 03:59
OK - maybe it's a linux thing then (like bad a file separator character hidden somewhere). Try under Windows (it works here) adn remember you can dowsample your envelopes to say 100 or 150 vertices in the BEM GUI just to test run the BEM computation .
Please keep me posted. If it works under Windows, I'll test things out under Linux here too.
guilhem.ibos
March 20th, 2007, 04:11
This is not a linux problem, the bug is the same under windows.
I don't manage to run the last version of brainstorm under matlab6.5 but It works under matlab7.2. Is there something particular with matlab6.5 and brainstorm?
Thanks.
Guilhem
Sylvain
March 20th, 2007, 05:38
We do not support Matlab 6.5 anymore.
I am going to write a specific documentation for the BEM manipulations now. Maybe this will help find out what might be going wrong.
Sylvain
March 20th, 2007, 07:06
HI Guilhem,
I've edited the documentation on the BEM: http://neuroimage.usc.edu/forums/showthread.php?t=197 (should be online by tomorrow pm). While following the steps described, please let me knwo whether you still encounter this issue.
Also, please compute the BEM with the tutorial data set and let me know how it goes.
thanks for helping us improving things here.
Hui
March 20th, 2007, 21:12
Just did a test on the demo EGI data with Dr. Pantazis. We used the subject from Brainstorm (/Phantom/montreal_eeg_subject and /Phantom/montreal_eeg_data), since the folder does not include eeg data, we used the attached simulated data (also here:http://neuroimage.usc.edu/forums/showpost.php?p=612&postcount=3) and put it in the montreal_eeg_data folder.
I got NaN in forward matrix G when I selected "Interpolative" as shown in the tutorial picture:
http://neuroimage.usc.edu/brainstorm/tutorial/Snapshots/BEM.jpg.
However, I could get numbers not NaN in forward matrix G when I did not select "Interpolative" option.
Sylvain, I hope this will help you locate the bug.
Guilhem and Thorsteinn, could you please check if you had the "Interpolative" option selected?
Sylvain
March 22nd, 2007, 03:06
Thanks very much Brian,
Indeed, the interpolative option should not be checked when BEM is computed for sources on a cortical surface. It is here to speed up BEM computations only when using source scanning techniques in a volume, just like RAP-MUSIC does.
I need to update the BEM documentation to make this clear and also alter the code accordingly.
Thorsteinn
March 27th, 2007, 08:23
Looks like I missed out on all the discussion last week. I just updated my BrainStorm version and am able to create a BEM head model now with a gain matrix containing numbers, not just NaN :)
I wasn't using the interpolative option before so I guess the 'bst_headmodeler.m' update made some difference?
In one response to my posts I was told that the BEM head model doesn't support surface source simulations, and that still seems to be the case. Are you guys planning to add that feature, and if so will that happen anytime soon?
Cheers,
Thorsteinn
Sylvain
March 28th, 2007, 01:53
Welcome back Thorsteinn!
Regarding the simulator and BEM, you can play around by hand by loading the BEM gain matrix G, and simulating data : M=GJ. J is a distribution of currents you may generate also by hand quite easiliy.
Select a seed on the cortex (ie a vertex index) and use the patch_swell routine we have in the toolbow to growh a patch about this seed. Assign a current distribution to the resulting set of vertices and you get J.
See bstscript_forward_inverse_basic.m for basic manipulations of the gain matrix.
We are currently focusing our efforts on dramatic improvements of the BST database, visualization and analysis for processing multiple subjects and conditions.
Cheers
Thorsteinn
March 28th, 2007, 02:00
Thanks Sylvain,
I'll look into this for the BEM. Lately I´ve been using the 3 sphere Berg model and getting some nice results.
Cheers,
thorsteinn
Sylvain
March 28th, 2007, 02:02
Try out the overlapping_sphere approach too, which comes very close to the BEM wrt to accuracy but with no numerical llimitations.
guilhem.ibos
April 2nd, 2007, 04:11
YAHOUU
ok, it works now, I have done as it is told in the tutorial, and now it works. I don't know where did it came from but by unchecking th einterpolative button, my matrix wasn't NaN and the Min Norm was performed to the end. I will try with other subjects, I hope it will work as well.
Thanks for help, you all.
See you in others topics.
Guilhem.