Welcome to TDT - The Decoding Toolbox

--- UPDATE ---

TDT version 3.999F - now with time-resolved designs, improved speed-up detection (and more, as usual)

For Mac-User: Learn here how to solve the problem that SPM12 crashes on MacOS

Welcome to TDT – The Decoding Toolbox

TDT (download) is an easy to use, fast and versatile Matlab toolbox for the multivariate analysis of functional and structural MRI data. It contains searchlight, region-of-interest, and whole-brain analyses, as well as many feature selection and parameter selection methods including recursive feature elimination. More recent versions allow fast and efficient representational similarity analysis in a regression framework. The toolbox is optimized for the use with SPM or AFNI and can be used with minimal or no programming experience. A simple decoding analysis can be conducted in just one line of code or in SPM with a simple graphical user interface. At the same time, for people with a little programming background in Matlab the full functionality can be exploited very easily, and new features can be added without problem.

The key benefits of TDT are:

  • Accessibility: If you classify on betas created with SPM or did run-wise deconvolutions in AFNI, you can get to run your first decoding analysis with decoding_example in minutes, and with almost no programming experience with decoding_tutorial in less than 10 minutes

  • Speed: This is probably one of the fastest toolboxes out, with an SVM-based searchlight on runwise beta estimates, two classes and 100.000 voxels completed in 3-5 minutes. Speed is of essence if you want to quickly inspect your results.

  • Experience: Originally the toolbox was created in 2009 and continuously improved to be released to the public only in 2014. This means that you can trust the core functionality (but as with any tool: no guarantee ;).

  • Error management: We spend a lot of time on optimizing error management, i.e. we prevent you from making many mistakes (e.g. non-independence) and you get informative feedback and not some cryptic error message. If you do get an error message you don't understand - contact us so we can fix it.

  • Readability: We try to make code accessible and easy to follow and it should be no problem to extend the toolbox for your own classifier or method.

For more details and description and a basic tutorial with example code, please consult our publication: Martin N Hebart*, Kai Görgen* and John-Dylan Haynes (2015). The Decoding Toolbox (TDT): A versatile software package for multivariate analyses of functional imaging data. Front. Neuroinform. 8:88. doi: 10.3389/fninf.2014.00088. *equal contribution.

Download: Click here to download TDT.

Getting started: We believe that no tutorial is necessary, the toolbox should be self-explanatory. Just look at the README.txt in the decoding_toolbox folder, or consider our publication as reference.

Questions: Please use the TDT mailing list on Neurostars and always add the tag "tdt" (please also check the archive of our former mailing list).

Example dataset: We have made an example dataset for one subject available (SPM.mat and betas, ROIs, structural image and description; a lower resolution version (18MB) is available here). If you are interested in pre-processing the data yourself, we also provide DICOM files for subject 1, for subject 2, behavioral data for onsets and durations, and a batch script for preprocessing in SPM8. This is not a published study, data were acquired only for illustrating the use of TDT.

Happy decoding!

Kai & Martin

Click here to download TDT

What we are currently working on:

- MEG interface for time-resolved decoding

- More tutorials on example data

Update to version 3.999F (2022/08/15) (download)

- Added min0max1global scaling and improved auto-speedup detection for libsvm

- Added demo13 how to load a design from a .csv

- Added make_design_timeresolved to create time-resolved designs

Update to version 3.999E (2021/09/09) (download still available)

Quite some changes (despite the seemingly small change of the little E added

to the version number):

- Added a confusion matrix with an undecided column (the standard confusion

matrix adds undecided test cases to the first class), see demo3_1

- Changed extension to store design matrices: using .pdf instead of .eps as default

(Matlab decided to store .eps no longer as vector graphics)

- Introduced parameter change and an error if libsvm is used without scaling

(can be extremely slow). Note: Change the error to a warning if to be


- Multitarget functionality, see demo12

Update to version 3.999 (2020/06/17):

- Many improvements, e.g. allowing to use decoding() in PARFOR.

- Bugfix that transres_accuracy_matrix & transres_accuracy_pairwise

and both _minus_chance versions produced wrong results (only worse, not too

systematically to good) when label order was not increasing.

- typical errors detected when nans occur for corr and zcorr outputs

- improved documentation, and explanation & implementation of prevalence

- weights for regression

Update Version 3.997 (2019/04/29):

- reporting searchlight size (e.g. in number of voxels) in results file

- fixed minor bugs

- multiple furher improvements

Update Version 3.991 (17/12/23):

Bugfix in display_regressor_names

Update Version 3.99 (17/11/15):

Templates for between-subject and between_group decoding

More RSA output measures (Pearson, Spearman, Kedall's correlation)

Update Version 3.98 (17/02/08):

Simpler crossnobis distance calculation (decoding_template_crossnobis.m)

Other minor fixes and improvements

Update Version 3.95 (16/08/23):

Prevalence Inference added. It is a valid way for group-level population inference on e.g. accuracies. For details, see

Allefeld, C., Görgen, K., & Haynes, J.-D. (2016). Valid population inference for information-based imaging: From the second-level t-test to prevalence inference. NeuroImage. http://doi.org/10.1016/j.neuroimage.2016.07.040

Demos for using our demo data creating permutation designs

Faster SVM weight calculation using kernels and faster SVM pattern reconstruction

Bugfix: Order of multiclass output for decision values now sorted in ascending order

(3.93 had a small bug that prevented reading files in different SPM versions, so we removed it)

Update Version 3.90 (16/07/07):

AFNI interface added (check out decoding_example_afni)

Support for reading 4D data

Faster pairwise SVM decoding for more than two classes using accuracy_pairwise as output

Update Version 3.50 (15/10/09):

Advanced representational similarity analysis and pattern component modeling features available (see decoding_template_similarity.m)

Introduced possibility for multivariate pattern scaling using residuals of original images (akin to Mahalanobis distance)

Added features to automatically create residuals from an SPM.mat and load them in the right format (decoding_load_misc.m and residuals_from_spm.m)

Introduced possibility to use multi-mask (multiple ROI masks in one file, indexed by integers)

Other minor improvements in readability, functionality and bug fixes

Updated license file (thanks to Nick Oosterhof)

Update Version 3.03 (15/03/03):

Introduced basic SPM GUI for non-programmers and binary Fisher LDA with speed-optimized analytic shrinkage (Ledoit-Wolf and Oracle Approximating Shrinkage)

Click here to download TDT