Free SPM toolbox, FSL-flavour lib and R package to easily predict diagnosis from sMRI scans

Created by the Translational Neuroimaging Group,
FIDMAG Germanes Hospitalàries Research Foundation

home img

MRIPredict is a software package for using sMRI data to easily predict diagnosis (e.g. whether the patient will respond to a treatment, or whether the patient has one or another disorder).

Note that it is based on the glmnet library

The model may include covariates, and the software conducts both cross-validation of the model and fitting for its use with new VBM data in other dimensions.

FEDER logo
Work co-funded by the Instituto de Salud Carlos III - Subdirección General de Evaluación y Fomento de la Investigación and the European Regional Development Fund (FEDER). Project grants CP14/00041, PI14/00292, PI14/01148 and PI14/01151.
FIDMAG logo KCL logo   KI logo


MRIPredict is aimed to be easy to use and user friendly. Different versions are being developed to adapt best to every professional needs.

SPM logo

SPM toolbox

MRIPredict is aimed to be easy to use and user friendly. It has a Matlab version, with a graphical user interface to be used as an SPM toolbox.

FSL logo


The R version may be also called from bash to yield a flavor similar to that of FSL and software alike..

R logo

R package

R package.

feature img

SPM Toolbox

Written in Matlab, it has a GUI easy to use and understand for every user. To be used as an SPM toolbox.

FSL/Bash version

Written in R, can also be called from bash to yield a flavor similar to that of FSL and software alike.

feature img


  • For SPM: copy the MRIPredict folder from the matlab_spm folder to the SPM toolbox folder.
  • For FSL/bash: use the following commands from the bash folder:
    • mripredict model -mri mri_paths_file -data data_table_file -resp response_var -cov covariates to set a new model
    • mripredict_cv model to cross-validate the model
    • mripredict_fit model to fit the model
    • mripredict_predict model -mri mri_paths_file -data data_table_file -pred prediction_file to predict from new data
  • For R: type source("MRIPredict.r"). You can use the following functions:
    • mripredict(mri_paths_file, data_table_file, response_var, covariates) to set a new model
    • mripredict_cv(model) to cross-validate the model
    • mripredict_fit(model) to fit the model
    • mripredict_load(xml_file) to load a model
    • mripredict_predict(model, mri_paths_file, data_table_file, prediction_file) to predict from new data
    • mripredict_save(model, xml_file) to save the model
feature img


The different versions of MRIPredict are compatible with:





Download MRIPredict

Please note that the software downloadable from this preliminary website is a beta version created for the referees of the manuscript "Evaluation of machine learning algorithms and structural features for optimal MRI-based diagnostic prediction in psychosis".

The software is fully functional and may be already used within SPM / Matlab, FSL / bash or R, but the interface is being further developed to improve the user experience. Currently, it has the following limitations, which will be addressed promptly:

  • The graphical interface of the SPM toolbox only works in new versions of Matlab (+ R2011b).
  • R code works but it is not a proper documented R package yet.
feature img


Methodological details
The software is currently optimized for predicting binary variables from VBM data, which must be registered to the MNI space (we also recommend smoothing). For each fold of the cross-validation as well as for the final fitting, the software creates a mask of the voxels with >0.01 gray matter density, voxelwise applies a linear model to remove the effects of covariates, and includes the residuals into a lasso regression using the lambda that gives the minimum error in a cross-validation. The intercept of the lasso regression, as well as the MNI coordinates, the covariates coefficients and the lasso coefficient of the voxels with non-null lasso coefficients are saved.

Contact Us

Please, don't hesitate to contact us: