Biowulf High Performance Computing at the NIH
SimNIBS on Biowulf

SimNIBS is used to simulate non-invasive brain stimulation. Calculations of the electric field induced by transcranial magnetic stimulation (TMS) and transcranial direct current stimulation (tDCS) are supported. It includes

The basic workflow of a SimNIBS analysis:

simnibs workflow

References:

Documentation
Important Notes

Quickstart

Copy the test data and set up your environment

[user@biowulf]$ cd /data/user/simnibs_test
[user@biowulf]$ cp -r $SIMNIBS_TESTDATA .
[user@biowulf]$ cp $SIMNIBS_GMSH_OPTIONS ~/.gmsh-options

The first step would usually be the construction of a 3D mesh from MRI images. Since this step is time consuming, it should be run as a batch job. For this you would create a batch script simiar to the following

#! /bin/bash

module load simnibs || exit 1
source $FREESURFER_HOME/SetUpFreeSurfer.sh

cd /data/user/test_simnibs/simnibs2.0_example
mkdir new_mesh
cd new_mesh
mri2mesh --all almi5 ../org/almi5_T1fs.nii.gz ../org/almi5_T2.nii.gz

and submit it as a batch job with

[user@biowulf]$ sbatch --time=18:00:00 --mem=10g make_mesh.sh

A more elaborate reconstruction script is included in the example directory (run_headreco).

Since the example directory already contains a mesh reconstruction of the example data, we can proceed with the tutorial without waiting for the batch job to finish. This next part uses the SimNIBS GUI and we will run it on an interactive node. Since this is a GUI program, using NX to connect to biowulf is likely to give better resonsiveness.

[user@biowulf]$ sinteractive --x11 --mem=10g
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job

[user@cn3144]$ module load simnibs
Bash users should now type: 
 source $FREESURFER_HOME//SetUpFreeSurfer.sh
Csh/tcsh users should now type:
source $FREESURFER_HOME/SetUpFreeSurfer.csh 
[+] Loading simnibs 2.0.1

[user@cn3144]$ source $FREESURFER_HOME/SetUpFreeSurfer.sh
...

[user@biowulf]$ cd /data/user/simnibs_test
[user@biowulf]$ Simnibs

This will start the following GUI:

GUI 1

Click 'Browse' and load the almi5.msh mesh. The model will appear in the righ box. Note that loading the head model can be slow.

GUI 2

To set up a TMS simulation click 'Add TMS Poslist', then click on 'Browse' to select a coil file for the instrument used. Then double click the position column to open the position window. Next double click the head to select the position where the coil center will be simulated. Double click again to select the direction of the coil handle.

GUI 2

Then select 'Run' and wait for the simulation to run. The result can be visualized with gmsh. For opimal gmsh settings, copy the SimNIBS provided .gmsh_options file first

[user@cn3144]$ gmsh simnibs_sim/almi5_001-0001_Magstim-70mm-Fig8-measured_scalar_160411-154729_elm_merge.msh

With some custom settings an image such as the following can be rendered by gmsh. Note however that gmsh performance on a remote server is relatively poor.

GUI 2