Bug spaces in path breaking openmeeg script

I have spaces in my pathname which I cannot change because it's set by my school:

My brainstorm is here: C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm3

My temp folder is here: C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp

My openmeeg installation is here: C:\Program Files\OpenMEEG and I am using "OpenMEEG-2.4.9999-Win64.exe"

Bug description: when starting "Compute head model" openmeeg starts up correctly and then crashes with the following output:


** Error: OpenMEEG call: om_assemble -HM
** "C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.geom"
** "C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.cond"
** "C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg_hm.mat"
** OpenMEEG error #131:
** om_assemble version 2.4.9999 compiled at Feb 1 2020 11:53:55 using OpenMP
** Executing using 10 threads.
**
** | ------ om_assemble
** | -HM
** | C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.geom
** | C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.cond
** | C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg_hm.mat
** | -----------------------
** (DEPRECATED) Please consider updating your geometry file to the new format 1.1 (see data/README.rst): C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.geom
** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
** !!!!!!!!!!! WARNING !!!!!!!!!!!
** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
** Geometry::mesh: Error mesh id/name not found: "C:\Users\S185228\OneDrive
** Mesh reader::Exception: Unable to find interface "C:\Users\S185228\OneDrive. in the file C:\Users\S185228\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.geom
**
** For help with OpenMEEG errors, please refer to the online tutorial:
** https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#Errors


Please help or can you please have links to previous versions of brainstorm on the site. Thanks.

I've just tested OpenMEEG 2.4.1 with spaces in the path to the tmp folder, and it works:
openmeeg_log.txt (20.3 KB)

Why are you using this updated version? This is not the version recommended for Brainstorm.
Try the following: update Brainstorm, let the new plugin manager download the version of OpenMEEG it wants, and let me know how it goes.

okie, thanks, trying it now

@Alexandre FYI

Hi @Alexandre

I run into this error:

Error using cd
Cannot CD to C:\Program Files\OpenMEEG\bin\bin (Name is nonexistent or not a directory).

Error in bst_openmeeg (line 194)
cd(binDir);

Error in bst_headmodeler (line 472)
[Gain_om, errMessage] = bst_openmeeg(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 1251)
[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 2503)
gui_component('MenuItem', jPopup, [], 'Compute head model',
IconLoader.ICON_HEADMODEL, [], @(h,ev)panel_protocols('TreeHeadModel',
bstNodes));

Here's what I see:

I had been using the newer version of openmeeg without issue. An upgrade came out in February 2020.

Alright, using the 2.4.1 version results in the same issue

I'm out of ideas. Do you happen to have links to previous versions of brainstorm?

@Alexandre

Error using cd
Cannot CD to C:\Program Files\OpenMEEG\bin\bin (Name is nonexistent or not a directory).

I fixed this error, related with the fact that you are using your own version of OpenMEEG, instead of letting Brainstorm manage it. Not necessarily recommended, but it should be working now (after you update Brainstorm)
Bugfix: Plugin: Custom installation with test function in a subfolder… · brainstorm-tools/brainstorm3@26747c8 · GitHub

An upgrade came out in February 2020.

Given the number of bug reports we got concerning this version, I'm not sure it's a good idea to use it...
@Alexandre @mclerc @papadop?

Alright, using the 2.4.1 version results in the same issue

This is not the same issue.
Now you have an error concerning your surfaces (error message is truncated): check your surfaces.
If you can't fix it (using the recommendations from the tutorial), please post a screen capture showing all the layers you are using + the selected cortex surface + the sensors

Okie, thanks for the help, will give it another shot and let ya know how it goes

as usual can you share the problematic files and ideally open an issues on the openmeeg issue tracker with an URL

to download the problematic files?

https://github.com/openmeeg/openmeeg/issues

thanks

Alex

Made some progress, I keep getting the same error using my "MASTER" protocol which is my sandbox of testing out kernels for use in EEG connectivity studies. However, if I create a brand new protocol I can downsample the hi-res cortex and generate a head model off of that without issue.

So we've at least confined the mystery to having to be an issue within a protocol. My suspicion is there is a problem with the BEM output. I'll test that next and let ya know. Here's what my MASTER protocol looks like if you see an obvious problem.

Deleting and regenerating the head and bem files didn't work. Here's the log output from "C:\Users\Athena\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg_log.txt". Please let me know if that's not the most useful logfile needed or if other files/output would be more helpful. I can't upload the actual file but here's its contents:

om_assemble version 2.4.1 compiled at Aug 22 2018 19:47:28 using OpenMP
Executing using 4 threads.

| ------ om_assemble
| -HM
| C:\Users\Athena\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.geom
| C:\Users\Athena\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.cond

C:\Users\Athena\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg_hm.mat

(DEPRECATED) Please consider updating your geometry file to the new format 1.1 (see data/README.rst): C:\Users\Athena\OneDrive - University of Texas Southwestern\MATLAB\functions\brainstorm_tmp\openmeeg.geom
This geometry is a NESTED geometry.
Info:: Mesh name/ID : 1
# vertices : 1922
# triangles : 3840
Euler characteristic : 2
Min Area : 1.01182e-05
Max Area : 8.9307e-05
Info:: Mesh name/ID : 2
# vertices : 1922
# triangles : 3840
Euler characteristic : 2
Min Area : 9.21732e-06
Max Area : 8.44075e-05
Info:: Mesh name/ID : 3
# vertices : 1922
# triangles : 3840
Euler characteristic : 2
Min Area : 1.45864e-05
Max Area : 0.000149332
Info:: Domain name : Scalp
Conductivity : 1
Composed by interfaces : +1 -3
Interface "1"= { mesh "1", }
Interface "3"= { mesh "3"(outermost), }
Info:: Domain name : Skull
Conductivity : 0.0125
Composed by interfaces : +2 -1
Interface "2"= { mesh "2", }
Interface "1"= { mesh "1", }
Info:: Domain name : Brain
Conductivity : 1
Composed by interfaces : -2
Interface "2"= { mesh "2", }
Info:: Domain name : Air
Conductivity : 0
Composed by interfaces : +3
Considered as the outermost domain.
Interface "3"= { mesh "3"(outermost), }
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!! WARNING !!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 meshes are intersecting !
Info:: Mesh name/ID : 1
# vertices : 1922
# triangles : 3840
Euler characteristic : 2
Min Area : 1.01182e-05
Max Area : 8.9307e-05
Info:: Mesh name/ID : 3
# vertices : 1922
# triangles : 3840
Euler characteristic : 2
Min Area : 1.45864e-05
Max Area : 0.000149332

Hi @Alexandre, thanks again for the help. I can't upload the actual files as a new user but I could email them to you.

I pasted the text output from the logfile in the thread below.

For debugging:

  • Reset the default anatomy: it looks like you've edited it a lot and you might have been damaging something. Right-click on the Default anatomy folder > Use template > MNI > ICBM152
  • To modify it: create a new subject, using "Default anatomy: No", and then set the ICBM152 template for it as well (Right-click on the subject folder > Use template > MNI > ICBM152) - Use this as your sandbox.
  • Import your data, set your electrodes positions
  • Make screen captures and post them here: one with head + inner skull in red + outer skull + cortex that you want to use for the computation, one with semi-transparent head + sensors
  • Immediately after you get your OpenMEEG error: zip the contents of the $HOME/.brainstorm/tmp folder, upload it somewhere (dropbox, google drive...) and post the download link here