BrSt hangs when trying to launch - Error using bst_get

I am unable to launch BrSt. Here is the sequence of events:

  1. launched BrSt, did some exploration of reducing the # of vertices in the cortical mesh.
  2. I eventually tried the 3rd option, inhomogeneous, and was informed I needed to download the iso2mesh package
  3. I did so, and added its path to Matlab
  4. I closed and re-launched Matlab OK
  5. I tried to launch brainstorm, and got the following console response:

Tuesday, February 20, 2024
1:36 PM

>> brainstorm
 
BST> Starting Brainstorm:
BST> =================================
BST> Version: 06-Feb-2024
BST> Compiling main interface files...
BST> Deleting old process reports...
BST> Loading configuration file...
BST> Checking internet connectivity... ok
BST> Update available online: 20-Feb-2024
BST> Initializing user interface...
BST> Starting OpenGL engine... hardware
BST> Plugin mff: D:\downloads\EEGlab\eeglab_current\eeglab2023.1\plugins\MFFMatlabIO4.1
BST> Reading process folder...
BST> Loading current protocol...
Error using bst_get
Subject name not specified.

Error in node_create_db_subjects (line 58)
CurrentSubject = bst_get('Subject');

Error in panel_protocols>UpdateTree (line 432)
            case 'Subjects',     [selNode, dbNode, numNodes] = node_create_db_subjects(nodeRoot, iSearch);

Error in panel_protocols>CreatePanel/DatabaseTabChanged_Callback (line 316)
        UpdateTree(0);

Error in panel_protocols>CloseAllDatabaseTabs (line 1569)
    bakCallback();

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

Error in gui_brainstorm>SetCurrentProtocol (line 955)
    panel_protocols('CloseAllDatabaseTabs');

Error in gui_brainstorm (line 34)
eval(macro_method);

Error in bst_startup (line 643)
    gui_brainstorm('SetCurrentProtocol', GlobalData.DataBase.iProtocol);

Error in brainstorm (line 123)
        bst_startup(BrainstormHomeDir, 1, BrainstormDbDir);
 

Here is what the screen showed. It never finished so I closed it down.

I thought the iso2mesh path might be the problem, so I removed that path and tried again and got the same result. I am now unable to continue my BrSt work. Am I going to have to re-install BrSt? Or perhaps rebuild my database? Cannot do that if I cannot start BrSt though.

Could it be that the files in the protocol SmokingCut were manually moved or deleted?

No, I did nothing in that regard. I reported all the steps I took.

Here is my folder structure, seems fine to me. Would you like to see the contents of any of the sub-folders?


I get the same errors this morning, so am still unable to run BSt.
I know there is a way to rebuild the database, but I cannot do that if I cannot launch BSt, right?
It seems re-installng BSt may be the only way to fix this. How can I do that and preserve what I did so far?
FYI, here is the top of the search path:
image

In Matlab, try to run:

>> brainstorm reset

It will reset the configuration of Brainstorm. It will not delete your database.
Then try to restart Brainstorm, and choose the path for the Brainstorm database:
(D:\Brainstorm\brainstorm_db in your case)

That fixed it, thanks. Now to try to add iso2mesh in again and see what happens

Well, I was able to add iso2mesh to the path, and it worked until I tried to use iso2mesh to create a reduced vertices version of cortex_15005V. Then the same console errors occurred and BSt hung waiting for something to finish. Same as last time.
This time, though, when I closed all the BSt windows I could re-launch BSt.
I fear the iso2mesh is the culprit. Could you please try to replicate?

Yes, it seems the version iso2mesh in the suggested link is messing with the anatomy files in the DB.

We have updated Brainstorm automatically handle iso2mesh as a plugin when downsizing in commit:69e8e0d

Try:

  1. Remove the manual installation of iso2mesh and remove it from the Matlab path
  2. Reset Brainstorm as indicated above
  3. Update your Brainstorm instance to 22-feb-2024
  4. Try again the downsizing with the homogeneous option.
    When asked install the iso2mesh plugin, accept.

OK, here is what I did:

  1. deleted iso2mesh files and emptied trach
  2. checked path - did not see iso2mesh (I had removed yesterday)
  3. started BSt - got this:
    Warning: Name is nonexistent or not a directory: D:\Research\Matlab projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6
  4. brainstorm reset
  5. updated to 22-Feb-2024
  6. brainstorm - got this:
    BST> Downloading brainstorm.jar...

BST> Starting Brainstorm:
BST> =================================
BST> Version: 22-Feb-2024
BST> Compiling main interface files...
BST> Deleting old process reports...
BST> Loading configuration file...
BST> Checking internet connectivity... ok
BST> Initializing user interface...
BST> Starting OpenGL engine... hardware
BST> Plugin mff: D:\downloads\EEGlab\eeglab_current\eeglab2023.1\plugins\MFFMatlabIO4.1
BST> Reading process folder...
BST> Loading current protocol...
Error using bst_get
Subject name not specified.

Error in node_create_db_subjects (line 58)
CurrentSubject = bst_get('Subject');

Error in panel_protocols>UpdateTree (line 432)
case 'Subjects', [selNode, dbNode, numNodes] = node_create_db_subjects(nodeRoot, iSearch);

Error in panel_protocols>CreatePanel/DatabaseTabChanged_Callback (line 316)
UpdateTree(0);

Error in panel_protocols>CloseAllDatabaseTabs (line 1569)
bakCallback();

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

Error in gui_brainstorm>SetCurrentProtocol (line 955)
panel_protocols('CloseAllDatabaseTabs');

Error in gui_brainstorm (line 34)
eval(macro_method);

Error in bst_startup (line 643)
gui_brainstorm('SetCurrentProtocol', GlobalData.DataBase.iProtocol);

Error in brainstorm (line 123)
bst_startup(BrainstormHomeDir, 1, BrainstormDbDir);

and I am back to the same place as I was before with Applying search... box continuously scrolling a green progress bar

Does not look like iso2mesh is completely removed?

Were you asked again to select database folder?

Additional info:

  1. closed all BSt windows
  2. brainstorm reset
  3. exit Matlab
  4. launch Matlab
  5. still getting this:
    Warning: Name is nonexistent or not a directory: D:\Research\Matlab projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6
  6. brainstorm reset
  7. agreed to license
  8. asked to point to database, did so
    9 asked to load existing protocols - did so
  9. seems ok now, can view my cortex_15002 and the reduced sets I had created

Thanks.

I was, and did, and still had the problem. But as you see in my other response it is working now after repeating all the steps one more time.

And I wrote too soon. Problem back again. To verify I

  1. closed BSt
  2. closed Matlab
  3. launched Matlab, got same Warning message about not finding iso2mesh folder
  4. brainstorm
    for same errors on console and Applying search progress bar

Seems like we have to figure out how to get rid of that initial warning.

Going to exercise for 30 minutes and will check back then. Maybe you try to re-replicate this problem at your end?

The warning (below) is because, you did delete the manual installation for iso2mesh, but it was not removed from the Matlab path.
Warning: Name is nonexistent or not a directory: D:\Research\Matlab projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6

  1. With Matlab and Brainstorm closed. Go to your Protocol folder and rename the file ProtocolFolder / data / protocol.mat to something like protocol_backup.mat or so.
  2. Start Matlab
  3. >> brainstorm reset
  4. >> brainstorm

All works now, checked repeated closing and launching.
I had to search for the protocol.mat files, now I know there is one for each experimental Protocol. They only seem to update if I switch to a particular Protocol, then exit BSt. All 4 of mine have been regenerated at this point.

The odd thing, though, is that when I launch Matlab, I still get this warning:
Warning: Name is nonexistent or not a directory: D:\Research\Matlab projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6

So that is a Matlab problem, not a BSt problem. Matlab still seems to have this stored somewhere. I wonder what process of Matlab start-up needs to be reset to make this go away. I am not facile with this sort of Matlab manipulation.

Thanks for your help so far. I will try the iso2mesh now.

Remove the Path D:\Research\Matlab projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6 from the Matlab search path. See the section ** Change Folders on Search Path Interactively** in this link:
Change Folders on Search Path - MATLAB & Simulink

this happened:

rmpath("D:\Research\Matlab projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6")

Warning: "D:\Research\Matlab
projects\iso2mesh-1.9.6-allinone\iso2mesh-1.9.6" not found in
path.

In rmpath (line 71)

I can scroll through the whole search path and see for myself that it is not in there.
I wonder now if this may be a permissions issue somewhere.

Does the warning appear at starting Matlab? or at Brainstorm?
If there is more text along the warning, can you post it?

I think I just fixed it. It happens at Matlab launch, as I noted above it is only a Matlab problem.
I searched for my pathdef.m file, found it on the C: drive, noticed it was last updated yesterday. That is strange since when I start Matlab it does not show the iso2mesh in the path, which is why I thought it was gone. Here is the beginning of it:
image

Just in case, I hit the Save button on the Set Path window in Matlab. Lo and behold, the pathdef.m file updated to today's date and time.
Now the warning message does NOT appear. I do not understand what temporary location Matlab saves my path in when I open and close Matlab.

I noted a permissions error when the iso2mesh plugin was installing, but it did not seem to hurt anything.
I prefer to install all software on the D: drive and keep just the OS on the C: drive. Going through this I found that BST and iso2mesh are installed on the C: drive. Can you tell me how to re-install them to the D: drive?

The iso2mesh option worked for me to reduce and re-mesh the cortex_15002V model. It did find errors in the mesh and had to fix them in the process:
BST> Downloading URL : https://github.com/fangq/iso2mesh/releases/download/v1.9.6/iso2mesh-1.9.6-allinone.zip

BST> Saving to file : C:\Users\Jeff.brainstorm\plugins\iso2mesh\plugin.zip

Warning: Permission denied to create file

"C:\Users\Jeff.brainstorm\plugins\iso2mesh\iso2mesh-1.9.6\bin\tetgen.mexmaci64".

In unzip (line 103)

In bst_unzip (line 33)

In bst_plugin>Install (line 1486)

In bst_plugin (line 111)

In tess_downsize>iso2mesh_resample (line 553)

In tess_downsize (line 347)

In tree_callbacks>@(h,ev)tess_downsize(filenameFull,,) (line

BST> Adding plugin iso2mesh to path: C:\Users\Jeff.brainstorm\plugins\iso2mesh\iso2mesh-1.9.6

BST> Executing callback LoadedFcn: assignin('base', 'ISO2MESH_TEMP', bst_get('BrainstormTmpDir'));

Warning: Your input mesh contains topological defects, and the

mesh resampling utility aborted during processing. Now iso2mesh is

trying to repair your mesh with meshcheckrepair. You can also call

this manually before passing your mesh to meshresample.

In meshresample (line 26)

In tess_downsize>iso2mesh_resample (line 558)

In tess_downsize (line 347)

In tree_callbacks>@(h,ev)tess_downsize(filenameFull,,) (line 1183)

INFO- Loaded 15002 vertices and 29974 faces.

Saving Manifold Oriented Triangulation ...

WARNING- Some cuts were necessary to load non manifold configuration.

WARNING- Some triangles have been reversed to achieve orientation.

WARNING- 36 non-manifold vertices have been duplicated.

That was a long message - the only real Q I have is how I might re-install BST and iso2mesh to the D: drive.

One new note: apparently iso2mesh leaves some temp files behind. Both times I have used it and exited BSt, then re-launched BSt, I get this:
image
I clicked Yes to delete them.