Optimize the design of event-related fMRI

This Matlab script will optimize the timing of the stimulus presence based on specified constraints (e.g., the TR of fMRI acquisition, the duration of the experiment, the minimal inter-stimulus-interval allowed, etc). The output can be either a text file or a Matlab data (.mat) file, either one of which can be further exported to other stimulus presentation software, such as Presentation or E-PRIME.

Codes

You need to have all the files to run these scripts. Please download here.

Example 1:

This example attempts to optimize the timing of the stimulus presentation using the following parameters:
HRF duration: 30 seconds
HRF pre-stimulus duration: 6 seconds
HRF basis function: canonical HRF basis
TR= 2 seconds (fMRI data acquisition repetition time)
Time step in optimizing the stimuli: 1 second
Experiment duration: 4 min. (240 seconds)
Experiment minimal inter-stimulus-interval (ISI): 1 second
Total type of total stimuli: 1
Total number of stimuli: 64
Optimizing contrast: condition “1″ alone
Optimization iterations: 100

Input code: efficiency_test1.m
Output Matlab mat file: ex1-opt_param_24-Nov-2008.mat
Output Text file: ex1-opt_param_24-Nov-2008.txt

Example 2:

This example attempts to optimize the timing of the stimulus presentation using the following parameters:

HRF duration: 30 seconds
HRF pre-stimulus duration: 6 seconds
HRF basis function: finite impulse response (FIR) function
TR= 0.1 second (fMRI data acquisition repetition time)
Time step in optimizing the stimuli: 1 second
Experiment duration: 4 min. (240 seconds)
Experiment minimal inter-stimulus-interval (ISI): 3 second
Total type of total stimuli: 2
Total number of stimuli: 32
Optimizing contrast: between condition “2″ and condition “3″
Optimization iterations: 1000

Input code: efficiency_test2.m
Output Matlab mat file: ex2-opt_param_09-Jan-2017.mat
Output Text file: ex2-opt_param_09-Jan-2017.txt