Diff for "Triggers" - Meg Wiki
location: Diff for "Triggers"
Differences between revisions 6 and 7
Revision 6 as of 2007-05-17 11:00:21
Size: 3209
Editor: JasonTaylor
Comment:
Revision 7 as of 2007-05-17 11:13:24
Size: 3401
Editor: JasonTaylor
Comment:
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
 . !DisplayTarget.!OnsetSignalEnabled = True !DisplayTarget.!OnsetSignalPort = &H378 !DisplayTarget.!OnsetSignalData = 1 !DisplayBlank.!OnsetSignalEnabled = True !DisplayBlank.!OnsetSignalPort = &H378 !DisplayBlank.!OnsetSignalData = 0 {{{
'
Enable port signal (value 1 for now) for DisplayTarget:
!DisplayTarget.!OnsetSignalEnable
d = True
!DisplayTarget.!OnsetSignalPort = &H378
!DisplayTarget.!OnsetSignalData = 1}}}
{{{
'Enable port signal (value 0) for
DisplayBlank:
!DisplayBlank
.!OnsetSignalEnabled = True
!DisplayBlank.!OnsetSignalPort = &H378
!DisplayBlank.!OnsetSignalData = 0 }}}
Line 20: Line 29:
 . !DisplayTarget.!OnsetSignalData = c.getattrib("!ConditionCode") {{{
'Set
DisplayTarget port signal value based on condition:
!DisplayTarget.!OnsetSignalData = c.getattrib("!ConditionCode") }}}
Line 22: Line 33:

About Triggers

In fMRI the scanner paces the experiment, and your experimental software will have to catch scanner pulses and sync the trials to them. In MEG the recording is basically continuous, so to know when a trial happened, and what was actually presented, you will have to send triggers to be recorded with the brain signals.

Triggers can be send through the PIO card or the parallel port. E-Prime can only use the parallel port, DMDX only the PIO card. On the parallel port 8 channels are available for triggers, allowing a total of 255 different trigger values to be send. If you need more, you will need to send several triggers in each trial.

There's a box on the table, next to the stimulus computer, to which the trigger pulses have to be send. Two other boxes are connected to the parallel port and the PIO card. The appropriate connections can be made with patch cables.

E-Prime and Trigger Timing

Much has been written on the topic of accurate timing using E-Prime. There are several ways to send a trigger signal from the stimulation (STIM) computer to the MEG acquisition computer, but some of these will produce unpredictable timing errors under certain circumstances (e.g., using inline code & pre-release time together). I strongly recommend [http://www.pstnet.com/e-prime/support/kb.asp?TopicID=1318 this page] on the E-Prime support site.

Timing seems to work well with the 'OnsetSignalEnabled' method. The basic strategy is to insert inline code at the beginning of the experiment telling E-Prime to send a trigger every time it presents a certain object or objects (e.g., 'Target' and 'Blank'). This ensures that the trigger is time-locked to the presentation of the stimulus. [Note that this time-locking is NOT guaranteed if you simply insert an inline 'writeport' command ahead of the object if you are using pre-release time and vertical refresh syncing!] You will generally want to reset the port to 0 by enabling OnsetSignal on the following object with a value of '0' or by inserting inline code with 'writeport' and value 0 after the object. If you want the trigger value to vary with stimulus condition, you can accomplish this using inline code at the beginning of the trial.

Here's an example. Imagine a simple trial structure with a DisplayTarget text object followed by a DisplayBlank text object. We want to send a trigger from STIM to MEG whenever DisplayTarget is presented, and we want the trigger value to reflect the stimulus condition.

At the beginning of the session procedure, insert an inline object containing:

'Enable port signal (value 1 for now) for DisplayTarget:
!DisplayTarget.!OnsetSignalEnabled = True
!DisplayTarget.!OnsetSignalPort = &H378
!DisplayTarget.!OnsetSignalData = 1

'Enable port signal (value 0) for DisplayBlank:
!DisplayBlank.!OnsetSignalEnabled = True
!DisplayBlank.!OnsetSignalPort = &H378
!DisplayBlank.!OnsetSignalData = 0 

At the beginning of the trial procedure, insert an inline object containing:

'Set DisplayTarget port signal value based on condition:
!DisplayTarget.!OnsetSignalData = c.getattrib("!ConditionCode") 

Where 'ConditionCode' is a numeric variable in the range (1:255). This variable can be defined as a column in your List or using inline code. Be sure to add a 'Port' device with address '&h378' using Edit -> Experiment.

CbuMeg: Triggers (last edited 2015-02-05 14:09:12 by MaartenVanCasteren)