optseq2 - tool for automatically scheduling events for rapid-presentation event-related fMRI experiments. See also


optseq2 --ntp <# time points> --tr <TR> --psdwin <PSD min> <PSD max> --ev <event label> <event duration> <repetitions> --o <outstem> --tsearch <search time> --nkeep <# schedules to keep>


Positional Arguments


Required Flagged Arguments

--ntp <time points>

number of time points

Number of time points to be acquired during the scan. This should be for one 'run' not for the entire session. The Total Scanning Time is the number of time points times the TR plus the prescan period, ie, tScanTot = Ntp*TR+tPreScan.

--tr <TR>

TR in seconds

Time between functional volumes (in seconds).

--psdwin <PSD min> <PSD max> <dPSD>

PSD window specifications

Specifications for the FIR event response window. It will be assumed that the entire response can be captured within this window. PSDMin is the minimum PostStimulus Delay (PSD), PSDMax is the maximum PSD. dPSD is the sampling interval within the window. dPSD is optional; if left unset, it will default to the TR. dPSD controls how finely spaced the event onsets can be scheduled (ie, the onsets will only appear at integer multiples of the dPSD).

--ev <label> <duration> <repetitions>

event/condition label, duration, and number of repetitions

Event Type specification. The label is just a text label (which may be more informative than a numeric id). Duration is the number of seconds that the stimulus will be presented; it should be an integer multiple of the dPSD (see --psdwin). Nrepetitions is the number of times that this event type will be presented during the course of the run. The number of repetitions can be optimized using the --repvar option. Use a different --ev flag for each event type. NOTE: DO NOT INCLUDE THE NULL STIMULUS AS AN EVENT TYPE. The total stimulation time, tStimTot, equals the product of the duration and the number of repetitions summed over all the events. It should be obvious that the total stimulation time must be less than the total scanning time.

--o <outstem>

Save scheduless in outstem-RRR.par

detailed description (eg, help file information)

--tsearch <hours> or --nsearch <schedules>

Seach for t hours or over n schedules.

Search for Tsearch hours. optseq will randomly construct as many schedules schedules as it can in the given time, compute the cost of each one, and keep the ones with the highest cost. Search over Nsearch iterations. optseq will randomly construct Nsearch schedules, compute the cost of each one, and keep the ones with the highest cost. It is not permitted to specify both Nsearch and Tsearch.

--nkeep <schedules>

keep n schedules

Save nKeep of the best schedules. Increasing this number does not substantially increase the search time, so it is a good idea to specify more than you think you will need.

Optional Flagged Arguments


--tprescan <time>

start events t seconds before first acquisition


--repvar <percent> <per-evt>

allow "repetitions" to vary by +/- percent


--polyfit <order>

add polynomial regressors as nuisance variables


--focb <number>

counterbalancing of the event sequence


--cost <cost name> <params>

Specify cost function. Legal values are eff, vrfavg, vrfavgstd.


--seed <seed value>

initial random number generator to seed value










Example 1


Example 2




See Also

othercommand1, othercommand2


FreeSurfer, FsFast

Methods Description




Reporting Bugs

Report bugs to <>



optseq2 (last edited 2008-04-29 11:46:04 by localhost)