How to sync time from e-prime behavior data with fMRI

Dear experts,

I’m trying to create a temporal file from the e-prime behavioral data that refers to duration/onset_time for events in my fmri data, but I don’t know how to synchronize the time. I did not design the study and only have the data. For example, in a certain block, the recorded time in e-prime shows: ‘Finished.OnsetTime’ is 365877, the first ‘Choose.OnsetTime’ is 21419, the last ‘Choose.OnsetTime’ is 358901. From the fMRI side, the number of TRs in the block is 435 and each TR = 720ms, which gives 313200 for the total block scanning time. How should I align the two times? Shall I reset the first ‘Choose.OnsetTime’ to 0 and subtract all following rows in the column by 21419? But if I do so the total time duration would still be 337482, which doesn’t match up to the 358901 from fmri. In that case, shall I actually refer to another time variable for time reference? I’m confused. Could anyone point me in the right direction?


The information you have provided is underspecified to provide a good answer. You need to know when the e-prime experiment was started with relationship to the scanner.

  1. Open the E-prime experiment up in E-Studio and find the event that paused until the scanner began. For example, in my example the event “Instructions” will pause until a scanner pulse is detected. The Offset time of this even should be subtracted from the onset time of all your events. The experiment was started, and paused until the scanner was ready. At that stage, the many part of the experiment began.
  2. You need to know how the scan was triggered with respect to the scanner. Most scanners discard the first few images before the main scans are acquired. Assuming you have a Siemens scanner and your repetition time (TR) is in milliseconds, the formula is Dummy scans = ROUNDUP(3001/TR). The dummy scans are discarded, and the next scan will send an optical trigger. Assuming your center used this trigger to start your E-Prime experiment, the start time of the first volume will be the same as the end of your E-Prime pause. On the other hand, if your experiment was triggered by the beginning of the RF pulses (not the optical trigger), you need to adjust your times based on the number of dummy scans. If your scanner is not Siemens, you will want to see how they send triggers and whether they discard dummy scans. If the sequence does not discard dummy scans, you may want to manually remove the first few volumes to minimize T1-effects (the first couple fMRI scans are unusually bright, as they were not preceded by RF pulses that attenuate the atoms alignment with the scanner).

Hi Chris,

Thank you for your reply! The experiment was conducted using a 3-Tesla (3T) Siemens PRISMA magnet resonance imaging system. And my TR is 720ms. Using the formula 3001/720 gives me around 4 dummy scans. However, I was under the impression that the machine doesn’t create any dummy scans. If you are certain that Siemens always create dummy scans, I would double-check with other researchers who used the same machine. Or else I might just manually remove the first few volumes to minimize T1-effects.

Another follow-up question is that do I need to discard the same number of dummy scans at the beginning of each block or just discard once at the beginning of the whole study? Each block in my study is separately E-prime. I manually drag and run each file after the subject’s brief break in the scanner.


If you used a Prisma with a TR=720ms, the first five volumes are discarded (round up not down). Consider you set up to acquire 300 measurements in the BOLD tab on the console. In this case, the scanner will actually acquire 305 volumes, but only reconstruct and save 300 volumes. The first optical EPI pulse will be sent at the beginning of the 6th volume. Since the first 5 volumes are discarded, the remaining volumes will all look pretty similar to each other. This is one reason why on the FSL FEAT data tab you can set the Delete Volumes to zero: the troublesome first five volumes were implicitly discarded. This will happen for each series: the number of images acquired will be 5 more than the number specified or saved to disk. Since there is a temporal pause between each series, one needs to acquire a few scans for each series to allow the T1 effects to saturate.

Assuming your E-Prime experiment paused until the first EPI trigger was sent, you will notice that the experiment pauses for 3600ms after the scanner starts making the signature loud sounds associated with driving your gradients. Just make sure your team used the optical EPI pulse to end the EPrime pause - if they directly measured RF signals your experiment un-paused 3600ms before the first saved EPI scan.

As an aside, when we evaluated fMRI protocols on our Prisma with the 32-channel head coil we preferred to the ABCD sequence (2.4mm isotropic, m=3, TR=800) to the HCP isotropic (2mm isotropic, m=8, TR=720), in particular for subcortical SNR. The HCP sequence seems to make a lot of compromises for the spatial resolution (spatial distortion, multiband aliasing), and both auto-correlation and T1-relaxation means there is diminishing returns for the shorter TR on a 3T system. While I have not personally used the 64-channel head/neck (48/16) coil, I have heard the integrated neck coil rotates the head, pushing the frontal lobes further from the (smaller) antennas which likely exacerbates these concerns. In future, I would suggest that you at least do a short SNR study on your own system to see if this is an ideal general purpose fMRI scan. These are all tradeoffs and there is nothing fundamentally wrong with the HCP sequence. Even if a chosen sequence has lower SNR, if you find statistically significant results it suggests your study had sufficient statistical power.

Hi Chris,

Thank you for your reply. I’m still checking with the team to see if they used optic trigger or RF trigger. Just to make sure that I understand you correctly, I should cut off the first 5 volumes for each block no matter which trigger I used, right? Because if the experiment uses optic trigger, the scanner will intentionally acquire 5 additional scans that won’t be useful. If the experiment uses RF trigger instead, the first 5 scans won’t be ‘additional’ but are still suggested to be cut off due to T1 effects.

Btw, I used fmriprep for data preprocessing, do you happen to know if that will automatically delete dummy scans or not?


The first 5 volumes are never reconstructed or saved to DICOMs. They were acquired only to allow for T1 saturation. So if the user requested 320 scans, 325 will be acquired but you will only have 320 volumes saved to DICOMs, and therefore a 320 volume NIfTI file. Therefore, you do not need to delete any volumes.

If an optical trigger was used, the offset time for the offset of the E-Prime event that paused the experiment until a trigger detected corresponds to the first slice of saved fMRI data. If you use an RF trigger, the offset of the E-Prime pause occurred 3600ms before the first saved MRI data.

Consider an EPrime output in milliseconds

Pause.OnsetTime 1000
Pause.OffsetTime 3800
red_square.OnsetTime 5000
red_square.OffsetTime 5600
blue_square.OnsetTime 9400
blue_square.OffsetTime 10000

If you used an optical trigger, you would subtract the pause offset time from each value when generating your events.tsv:

 onset duration  trial_type  response_time stim_file
 1.2 0.6 go  1.435 images/red_square.jpg
 5.6 0.6 stop  1.739 images/blue_square.jpg

e.g. the first event occurred 1.2 seconds after the first saved slice.

If you used a RF trigger, you would subtract the pause offset time (3800ms) plus the dummy scan time (3600ms) from each value:

 onset duration  trial_type  response_time stim_file
 -2.4 0.6 go  1.435 images/red_square.jpg
 2.0 0.6 stop  1.739 images/blue_square.jpg

e.g. the first event occurred while dummy scans were still being acquired, 2.4 seconds before the first saved slice.

I strongly suggest using an optical trigger. Siemens, Current Designs and PST all sell these. Or you can make one yourself. The fiber-optic trigger sends a brief pulse of light at the start of acquisition for each EPI volume (except dummy volumes). Since the signal is optical, not electric, there is complete electrical isolation between your detector and the scanner (there is no way to damage your scanner). While some vendor’s optical triggers emulate mouse or keyboard clicks, as I note in the linked page I prefer emulating a joystick button press. This will not enter the keyboard buffer and will allow you to use work on your EPrime computer when you are acquiring EPI data (e.g. you might want to set up an EPrime experiment while an EPI-based DTI scan is being acquired). In my experience RF based triggers are very finicky, and you need to make sure they only detect the scans, not the variable-duration shimming that precedes scanning.

Thank you so much for your thorough response, Chris!

Dear Chris,

I hope you don’t mind if I ask a follow-up question. I checked with my team and it turns out the experiment used RF pulse. I did see variables such as choose.OnsetTime in the data file, but I did not see a variable called OffsetTime. Is that normal? I was told that the first choose.OnsetTime which usually happens at around 30s is the first event of E-prime. Shall I just assume that’s also when the first scan (after getting rid of the dummy scans) starts? Therefore, I will just reset the time of the first event to 0 and subtract all following events time by that 30s. Does that sound right?

I have insufficient information to answer your question. Open the experiment in EStudio to determine the order and the logging of events. Once you understand the timing of events and the timing from the trigger to the acquisition of the saved images, you can resolve this using the formula I provided above.

I teach a class named Image to Inference and all the PowerPoints and tutorials are online. You may also want to take a look at Andrew Jahn’s YouTube channel.

Sorry for the late response, Chris. Thank you for your reply!