ROAST: A fully automated, Realistic, vOlumetric Approach to Simulate Transcranial electric stimulation. This is an open-source tool that runs on Matlab and calls open-source C software packages such as iso2mesh and getDP. Starting from an MRI structural image, it segments the full head, places virtual electrodes, generates an FEM mesh and solves for voltage and electric field distribution -- at 1 mm resolution all this in about 10--30 minutes.

Download ROAST (v 1.1) | Contribute your code to ROAST | A Docker version

Unzip this file, load Matlab and change to the roast directory, then enter:


This will demo a modeling process on the MNI152 head. Specifically, it will use the T1 image of the 6th gen MNI-152 head to build a TES model with anode on Fp1 (1 mA) and cathode on P4 (-1 mA).

See video demonstration

One can specify an individual head (in NIfTI format) and any combination of electrodes and currents as follows:


This will build a model for subject1.nii with anodes F1 (0.3 mA) and P2 (0.7 mA), and cathodes C5 (0.6 mA), O2 (0.4 mA).

Modeling it includes the following steps:
1) Segment the MRI into skin, bone, CSF, white matter, gray matter and air cavities (using SPM in Matlab as explained here).
2) Touch-up the segmentation to be sure there are no "holes" (using a touch-up script in Matlab).
3) Place virtual electrodes of 6 mm radius at locations Fp1 and P4 (using this script in Matlab).
4) Generate a Finite Element Model (FEM) mesh (using iso2mesh).
5) Solve the FEM for voltage and electric field distributions (using getDP).
6) Resample the result into the original 3D volume and make some interactive displays (using Matlab).

Changing electrode diameter is a simple change of parameters inside the code. If you don't want to operate on individual MRI, then you should use a high-quality standard, such as the NY Head. You can skip the segmentation step as that standard is already segmented with great care at 0.5 mm resolution.

You may want to review the result of the automated segmentation on your individual heads, and if necessary, touch it up "by hand" using volume editing software, e.g. ITK-SNAP.

A somewhat longer description and preliminary comparision with other modeling tools is here (please use this as reference):

Yu Huang, Abhishek Datta, Marom Bikson, Lucas C. Parra, Realistic vOlumetric-Approach to Simulate Transcranial Electric Stimulation -- ROAST -- a fully automated open-source pipeline, bioRxiv 217331, Nov 10, 2017.

This work was supported by NIH through grants R01MH111896, R44NS092144, R41 NS076123, and by Soterix Medical Inc.

Yu (Andy) Huang and Lucas C Parra

Latest update, November 11, 2017