Theory of Mind and Pain Matrix Localizer (Movie)

This script will localize theory-of-mind network areas and pain matrix areas by contrasting activation during scenes in which characters are engaging in mentalizing (mental) and action/pain sequences (pain).

To run this script, you need Matlab and the PsychToolbox. Make sure to follow the GStreamer instructions if prompted in order to make movie screenign from PsychoToolbox possible.

Note: If you use this localizer, you will need to purchase the movie, "Partly Cloudy" from Pixar Animation Studios. Save a copy of "Partly Cloudy" in the stimuli folder as "". For timing purposes, the movie files is 5:49 seconds.

Note: If you use this localizer, please credit Nir Jacoby, Emile Bruneau, Jorie Koster-Hale, and Rebecca Saxe.


subjID: STRING The string you wish to use to identify the participant. "PI name"_"study name"_"participant number" is a common convention. This will be the name used to save the files.

Example usage:


The script outputs a behavioural file into the behavioural directory. This contains information about the IPS of the scan, when stories were presented, reaction time, and response info. It also contains information necessary to perform the analysis with SPM. The file is saved as

In the event of a crash, the script creates a running behavioural file of partial data after each trial.

  1. mental -- characters mentalizing (events)
  2. pain -- characters in physical pain (events)
  3. social -- non-main characters interacting (events)
  4. control -- scenery, no focus on characters (events)
TIMING NOTES Make sure to change the inputs in the 'Variables unique to scanner/computer' section of the script.

We analyze this experiment by modelling each trial as a block with a boxcar lasting 14 seconds, during the whole period from the initial presentation of the story to the end of the question presentation. These boxcars are flanked by non-jittered rest periods of 12 seconds each (the fixation duration in the script). While we have analyzed the statement and question periods separately, we have found that the outcomes are nearly identical, due to the BOLD signal being predominantly due to participants reading and encoding the text, rather than answering the questions.

Analysis consists of five primary steps:
  1. Motion correction by rigid rotation and translation about the 6 orthogonal axes of motion.
  2. (optional) Normalization to the SPM template.
  3. Smoothing, FWHM, 5 mm smoothing kernel if normalization has been performed, 8 mm otherwise.
  4. Modeling
    • Each condition in each run gets a parameter, a boxcar plot convolved with the standard HRF.
    • The data is high pass filtered (filter frequency is 128 seconds per cycle)
  5. A simple contrast and a map of t-test t values is produced for analysis in each subject. We look for activations thresholded at p < 0.001 (voxelwise) with a minimum extent threshold of 10 contiguous voxels.

Random effects analyses show significant results with n > 10 participants, though it should be evident that the experiment is working after 3 - 5 individuals.

SPM Parameters

If using scripts to automate data analysis, these parameters are set in the SPM.mat file prior to modeling or design matrix configuration.

SPM.xGX.iGXcalc = {'Scaling'} -- global normalization: OPTIONS:'Scaling'|'None'
SPM.xX.K.HParam = filter_frequency -- high-pass filter cutoff (secs) [Inf = no filtering]
SPM.xVi.form = 'none' -- intrinsic autocorrelations: OPTIONS: 'none'|'AR(1) + w' = 'hrf' -- Basis function name
SPM.xBF.T0 = 8 -- reference time bin
SPM.xBF.UNITS = 'scans' -- OPTIONS: 'scans'|'secs' for onsets
SPM.xBF.Volterra = 1 -- OPTIONS: 1|2 = order of convolution; 1 = no Volterra

Download & Installation

  1. To download the script and its associate stimuli, click here [version: November 25, 2015]
  2. Extract the folder.
  3. From within matlab, cd into the extracted folder
  4. Type 'setup' and follow the onscreen instructions