DUNEuro problem

Hello everyone, I am experiencing an issue with DUNEuro. I am quite new with the FEM models applied to EEG and MEG data. I am trying to calculate a FEM Model for both EEG end MEG in MRI Volume but, when I am using a three layers mesh generated with iso2mesh, I get this error

DUNEURO> FEM computation completed in: 806.6512s
Error using in_duneuro_bin (line 28)
Could not open file: No such file or directory

Error in bst_duneuro (line 545)
GainEeg = in_duneuro_bin(fullfile(TmpDir, cfg.BstEegLfFile))';

Error in bst_headmodeler (line 502)
[Gain_dn, errMessage] = bst_duneuro(OPTIONS);

Error in panel_headmodel>ComputeHeadModel (line 673)
[OPTIONS, errMessage] = bst_headmodeler(OPTIONS);

Error in panel_headmodel (line 27)
eval(macro_method);

Error in panel_protocols>TreeHeadModel (line 1239)
[OutputFiles, errMessage] = panel_headmodel('ComputeHeadModel', iChanStudies);

Error in panel_protocols (line 44)
eval(macro_method);

Error in tree_callbacks>@(h,ev)panel_protocols('TreeHeadModel',bstNodes) (line 2526)
gui_component('MenuItem', jPopup, [], 'Compute head model', IconLoader.ICON_HEADMODEL, [],
@(h,ev)panel_protocols('TreeHeadModel', bstNodes));

I also tried with a 5 layers mesh generated with brain2mesh but in this case, the computing remains stuck at the initial phase. Can you help me to figure this issue? Thank you so much.

It looks like the DUNEuro computation doesn't finish correctly, and does not save the gain matrix in the temporary folder. Some more debugging is required to understand what is going on:

  • How long does it take before it crashes?
  • How many vertices do you have in your FEM model?
  • While the error is displayed on your screen: zip the contents of the folder $HOME/.brainstorm/tmp, upload it somewhere and post the download link here.

Please include screen captures of:

  • the Brainstorm database showing the subject anatomy files
  • the Brainstorm database showing the channel file
  • the FEM mesh opened in a 3D figure
  • the channel file opened in a 3D figure together with the head surface

It could be due to memory issues.
How much RAM do you have on your computer?
What operating system is this? (copy-paste the output of the ver command in Matlab)

To check whether this is a memory issue: compute a FEM mesh with a much lower resolution (start from BEM meshes with a ~100 vertice).
https://neuroimage.usc.edu/brainstorm/Tutorials/FemMesh

If the issue is the memory: I don't understand why the crash would not be captured by the system call:

@juangpc @tmedani Any suggestion?

Hello Francois, thank you so much for your reply. So I have some updates for you. This is what I found:

  • I can correctly calculate the FEM model for EEG and MEG but only if they are selected one at a time and only if I have a three layers mesh. In this case, the EEG model takes ~100 sec and the MEG one around 800 sec for a number of vertices ~15.000. The problem I send to you happens when I want to save everything in the same model no matter the number of vertices. As soon as it finishes calculating the model for the MEG and starts calculating the model for the EEG it crashes with that errors.
  • I also tried to calculate the BEM surfaces with 162 vertices but both the versions of iso2mesh gave me an error.
  • I don't think it is a memory problem since I tried to do this model on two different workstations with a Windows 10 (Home and for Workstation) operating system and with a RAM of 32 Gb and 64 Gb respectively but I'll attach the output in a zip file;
  • A different situation happens when I want to use a 5 layers mesh computed with brain2mesh. The model remains stacked at the beginning without giving errors or refreshing the command window even if I selected just an EEG/MEG model (I tried this with three different subjects and I really want to give it a try for my analysis).

Please find the zip file in this google drive folder:

Let me know if you need anything else from my side. I really appreciate your hard work.
Margherita

@tmedani @juangpc
Can you please try to explore this issue? - Thanks!

1 Like

I will have a look and come to you asap

Hello Margherita

I just tested it for both MEG and EEG with the default options and it works,
which operating system are you using?

could you share the FEM mesh and the location of the EEG electrodes and MEG sensors?
I can check what is wrong with your data.

also, what do you mean by:
". The problem I send to you happens when I want to save everything in the same model no matter the number of vertices. "?

When you select both EEG/MEG you have to keep all the layers, and the computation should starts first with the EEG and then the MEG.

I don't understand what you are trying to do hre?
are you traying to generate the FEM mesh from the surfaces?

If you use the 5 layer model, the computation can last few hours for EEG (~2 hours) and more for the MEG, it depends on the number of the sensors and the mesh resolution.

Could you report what are seeing on the matlab command line?