@Francois : Yvonne is our "beta" tester of the Bst-Duneuro, she is from Carsten's group.
To come back to your error, it seems the the FEM mesh is not correct,
could you check the data of the structure "FEM 41605 V' by right click > view file contents
I can't spot a major difference to yours, but maybe you see something in here. It might be a mac-related problem; I now set up brainstorm on a windows aswell and there it worked fine. I had to manually download the iso2mesh toolbox on my mac, because the automatic installation didn't work properly, but i assume that shouldn't be the issue.
If that's not in your focus right now, don't worry! I know you have a lot on your agenda and I will work on the windows version for now!
The problem comes from the fact that the indices in the array "Tissue" are not matching the number of tissues defined by "TissueLabels" (= 3). There are some elements that have a Tissue index > 3, which is not supposed to happen with today's version of Brainstorm.
Can you please try to update Brainstorm to today's version, and recompute you FEM meshes.
Then, if you still get the same error, it means that there is something wrong in the mesh generation. In that case, could you send me a minimal dataset to reproduce this error?
Right-click on the subject > File > Duplicate subject
Delete all the files that are not needed to reproduce the behavior:
in the anatomy, delete the ASEG atlas, all the FEM meshes, and all the surfaces but the low-resolution cortex (= source space) and the surfaces you use for computing the FEM mesh,
in the functional data, keep only one channel file and one short block of imported data (1s long or less) - delete forward and inverse models
Make sure you can still reproduce the error with this minimal dataset
Right-click on the subject > File > Export subject
Upload the zip file somewhere (dropbox, google drive...) and share the download link here
Describe exactly how you generate the faulty FEM mesh (exactly where you click and in which order)
I had to manually download the iso2mesh toolbox on my mac, because the automatic installation didn't work properly, but i assume that shouldn't be the issue.
It could: Could you please help me debug and fix this issue?
Please describe any issue you have if you let the automatic installer download iso2mesh in $HOME/.brainstorm/iso2mesh. (copy-paste the full error messages)
I updated brainstorm to yesterday's version, but I still get the same error. I sent you the link to the minimal dataset via private message (for data security reasons).
In order to generate the FEM mesh I select the anatomy view and activate the files, that you find in the minimal dataset. I manually add the iso2mesh-master toolbox to the path (downloaded from https://github.com/fangq/iso2mesh).
right click on the subject
"generate FEM mesh"
select "Iso2mesh"
select "MershMesh"
keeping default settings (max tetrahedal volume: 0.1; Percentage of elements kept: 100)
*select OK
The Mesh is then created and saved without any bug, but then I can't open it (see error in my original post). MergeSurf leads to the same problem.
For the automatic installation:
If I do not add the manually downloaded iso2mesh toolbox to my matlab path and i repeat the steps above, I agree to let brainstorm download the latest version of iso2mesh, it downloads, tries to install and then I get the following error:
** Error: Iso2mesh could not be installed in: /Users/yvonnebuschermohle/.brainstorm/iso2mesh/mac64
When I check the .brainstorm folder, I find the iso2mesh toolbox, but it is not properly installed; when repeating the FEM generation now, I get the error:
** Error: Line 117: surf2mesh (line 117)
** Tetgen command failed
**
** Call stack:
** >surf2mesh.m at 117
** >process_generate_fem.m>Compute at 377
** >process_generate_fem.m>ComputeInteractive at 950
** >process_generate_fem.m at 33
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_generate_fem,'ComputeInteractive',iSubject,[]) at 583
**
** Error: The FEM mesh generation failed.
** Check the Matlab command window for additional information.
**
I hope that helps! Let me know if you have further questions!
I downloaded the file on a Windows 10 laptop (using the iso2mesh package downloaded automatically by Brainstorm),
loaded it with the menu File > Load protocol > Load from zip file
right-clicked on the subject > Generate FEM mesh > Iso2mesh > MergeMesh > Default settings
it takes about 5 seconds to create a FEM mesh file with 14254 nodes
If this does not work on your mac, there is maybe something wrong with iso2mesh on MacOS?
I'll ask the iso2mesh developers if there is any reason for this difference.
@MartinC Could you quickly check if it works on your Mac?
(I'll forward you the example file in a separate email)
For now you should be able to work with the version of iso2mesh you manually downloaded, until we figure out what's wrong with the version downloaded automatically by Brainstorm.
Thanks a lot! I think we finally found the problem in the automatically downloaded version (see github discussion).
The problem comes from the fact that the indices in the array "Tissue" are not matching the number of tissues defined by "TissueLabels" (= 3). There are some elements that have a Tissue index > 3, which is not supposed to happen with today's version of Brainstorm.
However, this problem is not yet solved, I still get the same error when trying to open the generated meshes
Yes, I can reproduce the second error now as well, when enforcing the use of Tetgen 1.5 on my Windows laptop (which was defaulted to use 1.4).
Waiting for so input on fixing this.
In the meantime, you could modify the line 378 of process_generate_fem.m to enforce the use of the older Tetgen version (option method='tetgen'), and now you would finally get what I obtained on Windows: