View Full Version : Division by zero
fvadakku
October 14th, 2006, 19:53
Hi all,
I tried to generate a head model for the Brainstorm tutorial data using BEM. I have followed every instruction in the tutorial except that I downsized the surfaces to about 3000 vertices, instead of 10000 vertices as the tutorial suggests.
I kept receiving "Division by Zero" warning during the head model generation. I later found that Brainstorm generated a gain matrix with many NaN enties. And, of course, I am not able to try any reconstruction methods.
Has anyone experienced this before? What may I do to fix this?
Thank you very much
Fijoy
Sylvain
October 15th, 2006, 13:23
Thanks Fijoy,
I'm going to try to replicate your bug now. In the meantime, please let me know how you donsized the surfaces ? You may use the BEMTool for this by specifiying the number of vertices you need per envelope. Otherwise, you have probably tried the reducepatch.m Matlab function right ?
Sylvain
October 15th, 2006, 14:30
OK there was a bug indeed because we did not control close enough for the outcome of the reducepatch.m routine; which happens to be potentially problematic depending on the original surface envelopes and the ratio applied for downsizing.
Please replace bem_kernel.m in the Toolbox folder by the one I'm attaching here. Next nightly update fo BST will include this fix anyway.
Anoher thing: the resulting matrix can be read with the read_gain.m routine. There are some NaNs where the MEG reference channels are stored (in the tutorial data, for rows 1:31). In order to view the gain matrix for the MEG sensors only, use the good_channel.m routine to find which channels are what. An example of its usage can be found in the script example: bstscript_ForwardInverse_basic.m, also in the Toolbox folder (line 153).
please let me know how things are doing and thank you for finding about this bug !
fvadakku
October 15th, 2006, 22:26
Hi Sylvain,
Thank you so much for your quick response. I was just about to post a message with more details about the bug.
Fijoy
adrianoperry
October 18th, 2006, 05:57
Hi,
Even i got a similar error and i am still waiting for someone to fix it for me.
adrianoperry
Sylvain
October 18th, 2006, 06:09
Dear adrianoperry,
Did you try with the latest BST version that includes the patch I've sent in this thread ? If yes, please provide more information about the bug so that we can replicate it here.
Also, thanks for not posting any link to (non)commercial sites which are not related to the topics discussed in this forum.
Best,
adrianoperry
October 22nd, 2006, 23:50
Hi,
No i did not try with that link.I will try with that and check the result.
adrianoperry