User Tools

Site Tools


Quick Navigation:








Why Simulate?

In event-related fMRI, it is often beneficial to capture data showcasing different parts of the hemodynamic response function (HRF) within each condition. However, it is extremely inefficient (in terms of both time and finance) to simply allow the HRF to return to baseline after every stimulus. Therefore, in order to capture as much of the HRF as possible without wasting valuable scanner time, researchers incorporate a technique called jittering in experimental design to include controlled variance in interstimulus intervals (ISIs). With the necessary assumption of linear additivity, co-occurring HRs can be deconvolved using what we learn about the shape of the function from capturing these different points of the HRF.

It goes without saying that different patterns of jittering will result in different portions of the HRF being captured, so there exist both efficient and inefficient patterns. Testing each pattern you develop on a real participant and evaluating the results is simply not an option. This is where fMRI simulation comes into play. It's possible to do yourself with a bit of MATLAB/Python code, or with some programs put out by the AFNI group at the NIH (detailed on the CogNeuroStats Blog here), or with OptSeq2, a simulation program developed by researchers at Massachusetts General Hospital.

Downloading OptSeq2

OptSeq2 can be downloaded from the FreeSurfer website here. Simply put the downloaded file in the directory in which you wish to simulate, or drop it into a source path like your AFNI or FreeSurfer binaries directory so you can access it from anywhere.

Using OptSeq2

OptSeq2 can accept a number of options, which are denoted by a double-dash (--). A full list of options can be found here, but only seven pieces of basic information are necessary in order to begin simulating fMRI experiments:

  • TR (--tr)
  • Number of timepoints (--ntp)
  • Range of allowable ISIs (--PSDwin)
  • Event definitions (--ev)
  • How long to simulate (--nsearch)
  • How many timing files to keep (--nkeep)
  • An output prefix with which to label the timing files generated (--o)


Here is an example of an OptSeq2 call that models an fMRI experiment with 200 acquisitions, a TR of 2.0 seconds, a post-stimulus duration window [2 4], and two conditions of thirty stimuli each. OptSeq2 will generate 100,000 timing files and keep the top three.

optseq2 \
--ntp 200 \
--tr 2.0 \
--psdwin 2 4 \
--ev condA 2 30 \
--ev condB 2 30 \
--nsearch 100000 \
--nkeep 3 \
--o best

Discussion on Options and Necessary Arguments

Post-stimulus Delay Window

--psdwin min max dPSD

Simply enough, psdwin requires two arguments, the minimum and maximum amount of time between the offset of one stimulus and the onset of the next. dPSD is an optional argument which specifies the sampling rate and must be an even multiple of the TR. If left unspecified, OptSeq2 sets this equal to the TR. Both min and max must be multiples of dPSD.

Event Definition:


You must provide an event definition for each condition in the experiment you want to simulate. ev takes three arguments: a label for the condition, the duration of each event in this condition (must be an even multiple of the TR), and the number of events of this condition which are to occur.

optseq2.txt · Last modified: 2014/10/03 13:05 by eric