Dear Yann,
Some general comments: If you think duration is critical you should increase microtime resolution, e.g. for TR = 2 s go with 2000 to have time bins corresponding to 1 ms (or a lower microtime resolution reflecting the frame rate of your stimulus projector, say 120 for a TR = 2 s and a projector running at 60 Hz). If you go with time bins of e.g. 1/8 s this means that stimulus onset functions (on / off) are rounded to the nearest full TR, thus e.g. 100 ms and 150 ms would be treated the same way, as 1/8 s (which might be suboptimal for some settings).
Also note that due to the settings in spm_get_ons, one time bin = 1/(microtime resolution) * repetition time is added to any of the rounded durations automatically. Thus, a duration of e.g. 0 s is treated as one "on" time bin = 1/(microtime resolution) * repetition time, a duration corresponding to exactly one time bin would be treated as two "on" time bins and so on. Instead of
ton = round(ons*TR/dt) + 33; % onsets
tof = round(dur*TR/dt) + ton + 1; % offset
you could go with
ton = round(ons*TR/dt) + 33; % onsets
tof = round((ons+dur)*TR/dt) + 33; % offset
This works properly then except for durations that would be rounded to 0 (those for which the new tof = ton).
Best
Helmut
|