Bayesian Non-Parametric Spatio-Temporal Models for fMRI data
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.





This is a user-friendly Matlab GUI that implements a unified, probabilistically coherent nonparametric Bayesian framework for the analysis of task-related fMRI data from multi-subject experiments. The modeling approach is based on a spatio-temporal linear regression model that speciifically accounts for the between-subjects heterogeneity in neuronal activity via a spatially informed multi-subject nonparametric variable selection prior. A characteristic feature of the approach is that it results in a clustering of the subjects into subgroups characterized by similar brain responses, while simultaneously producing group-level as well as subject-level activation maps.

Methodology and the software are described in the manuscripts below:

Zhang, L., Guindani, M., Versace, F., Engelmann, J.M. and Vannucci, M. (2016). A Spatio-Temporal Nonparametric Bayesian Model of Multi-Subject fMRI Data. Annals of Applied Statistics, 10(2), 638-666.

Kook, J.H., Guindani, M., Zhang, L. and Vannucci, M. (2018). NPBayes-fMRI: Nonparametric Bayesian General Linear Models for Single- and Multi-Subject fMRI Data. Statistics in Biosciences, in press.

The code was released to the public on 10/31/17.


The repository contains the following folders:

  1. Example folder containing a Matlab dataset and Automated Anatomical Labeling(AAL) Region of Interest (ROI) NIFTI files, excluding the cerebellum regions. They will be used to demonstrate how the GUI works.

  2. NPBayes_fMRI_MAC : Installation files for MAC users.

  3. NPBayes_fMRI_windows : installation files for Windows users.


  • For proper installation of the GUI, you must have Matlab installed in your OS.

  • Run the MyAppInstaller file located in the for_distribution subfolder of the NPBayes_fMRI_YOUR_OS folder. Upon completion, you should get a NPBayes_fMRI executable (or app) file in your specified directory.



Once you run NPBayes_fMRI, select Model Fitting and follow the instructions below:

  1. Define the output directory by clicking on OUTPUT

  2. Insert 30 for Number of Subjects

  3. For 2D or 3D Analysis, select 3-Dimensional and insert the following for each options:

    • Matrix of ROI names: Insert the 'ROI_names.mat' file found on the Example\MARSBAR_ROIs subfolder

    • Neighbor Matrix: Select the 'nei_vec.mat' file on the Example folder

    • ROI NIFTI Directory: Select the Example\MARSBAR_ROIs folder

    • Brain Template Image: Select Load Nifti Brain Template Image and load the 'ch2.nii' file found in the Example folder

  4. For Data Files, select:

    • data.mat file found on the Example folder

For long time-points select:

* multi_data.mat file found on the Example folder for the multiple simulus case
* single_data.mat file found on the Example folder for the single simulus case
  1. For Parameter Setting select the default setting by clicking yes

  2. Initiate model fitting by pressing Run Model. Upon completion, a 'result.mat' file will be generated in the output directory that you defined at Step 1


To visualize your inference results, select the Visualization tab after loading NPBayes_fMRI and load the 'result.mat' file located in the output directory using Load Output

There are a couple thing to keep in mind while using the Visualization part of the GUI.

  • If you close the figure plot after visualization, changing the sliders or other input parameters will not return a new figure. You will have to restart from Visualization and select the viewing options.

  • If you observe that some of the parameters (False Discovery Rate or PPI) or figures are not being updated properly, press the refresh button.

  • For 3D Analysis, if you are using a 'Reference Image' and trying to control the transparency of the overlayed image using the transparency bar, use the refresh button for the change to apply. Again, you must ensure that the dimension of the Reference Image and ROI images are identical.

  • Plotting can take some time while applying an overlay image. Do not move the figure plot or control figure while a visualization is taking place.

    • If you move around while the GUI is plotting something, the displayed figured may be plotted in the control figure, not the actual figure plot.

    • For smooth experience of the GUI, while using the sliders, you may find it easier to drag the slider around the location where you want it to be, and then use the arrows to adjust the value for precision (Rather than using the arrows to get to the location/value you want).