ROAST


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 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 and fully automated.

This work was made possible by NIH through a number of grants (see below), but especially NIMH R01-MH111896 and NINDS R44-NS092144. Also Soterix Medical Inc provided significant support.

Getting started

Download ROAST (v 4.0, codenamed Dyker Heights)* | All major versions | Full documentations

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


roast
 

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 | A short talk at IEEE EMBC 2018 | A 1-hour tutorial at NYC Neuromodulation Online 2020; Tutorial slides

Examples

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


roast('example/subject1.nii',{'F1',0.3,'P2',0.7,'C5',-0.6,'O2',-0.4})

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

If you don't have an individual MRI, then you should use a high-quality standard, such as The NY Head. ROAST will skip the segmentation step as this standard head was already segmented with great care at 0.5 mm resolution (though simulations will be slower due to the more detailed spatial resolutions). To run this standard head with calibrated conductivity values use the following:


roast('nyhead',{'Fpz',1,'Oz',-1},'conductivities',struct('white',0.11,'gray',0.21,'csf',0.53,'bone',0.02,'skin',0.90))

These values were calibrated to best match intracranial voltage recordings from 10 human subjects (Huang, Liu, et al 2017, specifically for the Fpz--Oz configuration).

Since version V2.0 the following features are supported: customized electrodes; addition of T2 images to improve segmentation; customize mesh options; user-defined tissue conductivities; resampling MRI into 1 mm resolution; add empty slices (zero-padding) to MRI to allow specific electrode placement; save all the results into NIfTI format; easier to manage simulation data. See README file for more details and examples. Here is an 'awesomeSimulation' demonstrating many of these features:


roast('example/subject1.nii',{'Fp1',0.3,'F8',0.2,'POz',-0.4,'Nk1',0.5,'custom1',-0.6},...
        'electype',{'disc','ring','pad','ring','pad'},...
        'elecsize',{[],[7 9 3],[40 20 4],[],[]},...
        'elecori','ap','T2','example/subject1_T2.nii',...
        'meshoptions',struct('radbound',4,'maxvol',8),...
        'conductivities',struct('csf',0.6,'skin',1.0),...
        'resampling','on','zeropadding',30,...
        'simulationTag','awesomeSimulation')


To review the simulation results that are computed in this example, you can just enter the subject name and the simulation tag as follows:


reviewRes('example/subject1.nii','awesomeSimulation')

Since version V3.0 the targeting feature was added. The first step to do targeting is to run ROAST with the 'leadField' keyword as the 'recipe':


roast('example/MNI152_T1_1mm.nii','leadField','simulationTag','mni152LF')

This will generate the lead field automatically for use in the targeting program roast_target():


roast_target('example/MNI152_T1_1mm.nii','mni152LF',[-48 -8 50],'optType','wls-l1','targetingTag','mni152LeftMotorMaxFoc')

This will perform the targeting on the MNI152 head trying to maximize the focality of the electric field at the left primary motor cortex (MNI coordinates [-48 -8 50]) using the weighted least squares algorithm. This targeting run is tagged as 'mni152LeftMotorMaxFoc'. See README file for more details and examples.

To review the targeting results that are computed in this example, you can just use the targeting tag (See README file for more details and examples):


reviewRes('example/MNI152_T1_1mm.nii','mni152LF','','','mni152LeftMotorMaxFoc')

Since version V3.5 you can model heads with abnormal anatomy such as lesions by using a deep neural network known as MultiPriors:


roast('example/subject1.nii',[],'multipriors','on')

This will run simulation on subject1 with default recipe, and segmentaion will be done by the MultiPriors.

As the MultiPriors still rely on SPM to run, in Version 4.0, we replaced MultiPriors by Multiaxial, which is independent of SPM (you can still choose to use SPM for segmentation though):


roast('example/subject1.nii',[],'multiaxial','on')

From V4.0, you can turn on an interactive 3D graphic interface to check the registration and to either confirm it or modify it by manually selecting the anatomical landmarks. This is very useful when running ROAST on a lesioned head for the first time to confirm if registration worked well:


roast('example/subject1.nii',[],'multiaxial','on','manualGui','on')

Processing pipeline

Modeling includes the following steps:

  1. Segment the MRI into skin, bone, CSF, white matter, gray matter and air cavities (using SPM8 in Matlab as explained here), or MultiPriors in V3.5, or Multiaxial in V4.0.
  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).

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.

How to ask questions

Subscribe to the ROAST users group to post and answer any questions, and share experiences.
https://groups.google.com/group/roast-users/subscribe

Google Groups
Subscribe to roast-users
Email:

Acknowledgements

Comparisions of ROAST with other modeling tools are here (please use these as references):

If you also use New York head in the simulation, please also cite:

If you also use the targeting feature (roast_target), please cite these: If you also use the MultiPriors for segmentation by turning on the multipriors option in V3.5, please cite this: If you also use the Multiaxial for segmentation by turning on the multiaxial option in V4.0, please cite this:

This work was supported by NIH through grants R01MH111896, R01MH111439, R01NS095123, R44NS092144, R41NS076123, and by Soterix Medical Inc.

Notes and Disclaimers

* Version 4.0 is incompatible with simulation data generated by earlier versions.
** A Docker version

Latest update, September 27, 2025, Yu (Andy) Huang and Lucas C Parra