Diff for "Triggers" - Meg Wiki
location: Diff for "Triggers"
Differences between revisions 28 and 29
Revision 28 as of 2009-04-21 18:45:56
Size: 8461
Comment:
Revision 29 as of 2009-04-21 18:48:57
Size: 8428
Comment:
Deletions are marked like this. Additions are marked like this.
Line 41: Line 41:

||<tablewidth="583px" tableheight="314px" tablealign="">Condition||Trigger Values||Trigger w/ignore||Ignore Value||
||<tablewidth="583px" tableheight="314px">Condition ||Trigger Values ||Trigger w/ignore ||Ignore Value ||
Line 44: Line 43:


||humans||1||1||N/A || ||flies||2||2||N/A ||
||humans ||1 ||1 ||N/A ||
||flies ||2 ||2 ||N/A ||
Line 48: Line 46:


||insects||2||2||N/A ||
||insects ||2 ||2 ||N/A ||
Line 54: Line 50:
||humans||1||1||N/A || This can be scaled up to any experiment. This can be scaled up to any experiment.

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. These triggers will be used as the basis for averaging your trials later, or even online if you want.

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. We strongly prefer E-Prime, not because it is better, but to make sure everybody uses the same software. On the parallel port 8 channels are available for sending 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. In addition, 5 channels are available for responses. The PIO card has a total of 24 channels, which can all be configured to be either input or output in banks of 8 channels. At the moment, only two banks of 8 are available.

You have to realise that the MEG acquisition software will only recognise something as a trigger when it is preceeded by a pattern consisting of all zero values. You do not necessarely need to zero out all channels on the parallel port, as the software can be configured to only look at a subset, in which case only these need to be set to zero before the trigger is send. Normally it is more pratical to just set all 8 bits to zero at once.

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 BNC patch cables.

ImageLink(EN_stim_box.png, //MegCbu, height=400)

On the picture you can see, from left to right, the Elekta Neuromag Trigger Unit, the parallel port box and the PIO card box.

These boxes can be used to either send triggers to the acquisition machine, or to receive input from, for example, one of the button boxes. I'll further explain the situation for the parallel port, as this will be the one being used most.

A parallel port has 8 output bits and 5 input bits available. This is because it used to be the 'printer port' and the 8 output bits were used to send (ASCII) characters to the printer, while the 5 input bit were used to send information about the printer status back to the computer. The output bits are numbered D0-D8, while the 5 input bits are numbered S3-S7. Again, these are the historical names with 8 Data bits and 5 Status ones.

Normally all 8 output bits will be connected to the acquisition channels 1-8, which are available for recording within the acquisition software as channels STI01 to STI08.

From E-Prime a single number can be send to the parallel port. More details about this are given below in the next section. Important is to know that the single number send will be represented binary on the 8 output channels. This is the reason why only 255 values are available as triggers.

===Trigger Tricks===

There are a couple of tricks to designing the triggers in order to minimize your efforts later in your experiment. I will show you a small example, but there are an almost infinite number of tricks, which can be done with our hardware. Please set this up carefully as this will save both you and your collaborator's mountains of effort later. Let's take a simple example where you have three different stimuli (monkeys, humans, and flies). For this experiment you want to be able to compare these into many different conditions:

monkeys, humans, flies

mammals, insects

non-humans, humans

In order to accomplish this we will use some very clever and simple trigger coding.

humans = 1

flies = 2

monkeys= 3

Because of the earlier mentioned binary nature of the triggers it is easy to separate out each of the earlier comparisons: monkeys, humans, flies mammals, insects non-humans, humans

Condition

Trigger Values

Trigger w/ignore

Ignore Value

monkey

3

3

N/A

humans

1

1

N/A

flies

2

2

N/A

mammals

1, 3

1

2

insects

2

2

N/A

non-humans

2, 3

2

1

This can be scaled up to any experiment.

The EN trigger box is connected to an identical box that lives in the stimulus cabinet, which is a metal cabinet that has a connection to the inside of the MSR (Magnetically Shielded Room). Equipment that needs to be fed into the MSR, like button boxes, needs to be placed in the stimulus cabinet. It can then be connected to the EN trigger box inside the cabinet.

ImageLink(EN_stim_cabinet.png, //MegCbu, height=500)

The two boxes, in the cabinet and on the table, will normally work in 'mirrored mode', which means that everything that happens on one box will be mirrored on the other. In that way a button box can be connected to the stimulus computer via these two boxes.

You will have to be careful, though, as these two boxes can also be used in independent mode. The mode is switched by selecting a different channel in the channel selection dialog of the Neuromag acquisition software. The EN manual has this entry on the issue:

  • The electric interface of the trigger signals is called a Remote Trigger Unit, which is connected to the System Control Card (SCC) housed in the data acquisition system cabinet. Elekta Neuromag systems include two Remote Trigger Units, which by default operate in parallel, i.e. input #1 and output #1 on both Remote Trigger Units refer to trigger line #1 on the trigger channel (STI101) associated with the 1st interface unit, however, the two interfaces can be treated separately by turning on (selecting for acquisition) also the trigger channel (STI102) associated with the 2nd interface unit.

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)