Error in SimNIBS call: headreco all --noclean

Hi all,

I am creating FEM meshes for 10 subjects in Brainstorm. I have a Linux machine and I open Matlab from the terminal and run Brainstorm from Matlab. Then, I run FEM mesh generation using T1w and T2w images with SimNIBS for each participant (one by one).
Since it takes min 3 hours to generate the FEM mesh, I opened 3 terminals from three different computers and opened Matlab and Brainstorm from those different computers (but from the same account in the computer). I created 2 more Protocols inside the brainstorm_db and in each protocol, I was running one FEM mesh generation for one participant.
However, I got an error from one of the FEM mesh generations, and 2 of them are still running even though it's been more than 8 hours.

I got the following error in Brainstorm UI: SimNIBS call:
headreco all --noclean Subject03 /home/glale/.brainstorm/tmp/simnibs/Subject03T1.nii /home/glale/.brainstorm/tmp/simnibs/Subject03T2.nii
SimNIBS error #1: See command window

And this error from the Matlab command window:
No such file or directory as /shome/glale/.brainstorm/tmp/simnibs/m2m_Subject03/tmp/wmx.nii1.off

I should also specify that I'm using the latest Brainstorm version and 2020b version for Matlab.
Also, I had no errors before when I was running the FEM meshes one by one.
Are these errors and the long-running time for FEM meshes caused by multiple Brainstorm jobs inside the same database? Or might there be a problem with the files?

I wonder what could be the problem and I appreciate your answers in advance.
Best,
Gülce

Multiple instances of Brainstorm can't be executed simultaneously on the same computer from the same user. The database can't handle concurrent accesses, and most of the processes are not equipped to run in parallel.
In your example, each instance of SimNIBS you start erase the contents of the same folder /home/glale/.brainstorm/tmp/simnibs/ when it starts, causing the others to crash the next moment they need to access the intermediary files that are expected to be in this folder.

However, you don't need to run SimNIBS from Brainstorm. You should be able to start three terminals to run in parallel three instances of SimNIBS.
The command line you need to execute is available in your error message:

headreco all --noclean Subject03 /home/glale/.brainstorm/tmp/simnibs/Subject03T1.nii /home/glale/.brainstorm/tmp/simnibs/Subject03T2.nii

Then you can can import the SimNIBS outputs by right-clicking on the subject node in the Brainstorm database explorer (make sure you select the "Anatomy" view) > Import anatomy folder > Select the file format "SimNIBS".
You can also select the menu "Import anatomy folder (auto)" if you do not need the fiducials to be anywhere special and would prefer Brainstorm to set default positions for these points based on the SPM linear MNI registration.

1 Like