skip to primary navigation skip to content
fMRI experiments using DMDX

Using DMDX for fMRI experiments

Matt Davis and Mike Ford


  1. Timing issues for fMRI experiments
  2. Why use DMDX for fMRI experiments?
  3. Limitations of DMDX
  4. How does DMDX work?
  5. What's in an item file?
More to follow soon.

1. Timing issues for fMRI experiments

Triggers from the scanner are organised by TR (repeat time)

If ISI (inter-stimulus interval) is a multiple of TR then stimuli can be triggered directly from the scanner. For example:

Since the scanner takes images of slices of the brain at regular intervals through the TR this creates a confound between where in the brain is being imaged and time post-stimulus. This is discussed further in:

Price, C.J., Veltman, D.J., Ashburner, J., Josephs, O., Friston, K.J. (1999) "The critical relationship between the timing of stimulus presentation and data acquisition in blocked designs with fMRI". NeuroImage, 10, 36-44.

Price et al. recommend that ISI is not a direct multiple of TR and show that additional activations can be detected when using an ISI that is not a direct multiple of the TR. However, the mechanism by which changes in TR affect BOLD signal may not be as described by Price et al.

In order to use an ISI that is not a multiple of the TR requires software that can keep accurate timing for extended periods of time. A missed trigger caused by the software over-running would lead to an extended period in which subjects are not presented with any stimuli. DMDX is one software package that has sufficiently accurate timing to make missed triggers unlikely - though you still ought to check the timing of your experiment carefully before testing subjects at WBIC.

2. Why use DMDX for fMRI experiments?

DMDX can control the presentation of many types of stimuli
written words (in a variety of fonts and languages)
pictures (using .bmp files)
auditory stimuli (using .wav files)
digital video (using .mpg, .avi, quicktime files)

DMDX offers precise timing of stimulus presentation and subjects responses

e.g. presenting visual stimuli for a single raster-cycle (approx 10msecs)
combine and control different types of stimuli in the same experiment
millisecond accuracy for button-press responses
4 button response box is set up and has been tested for use in the magnet
there is a dual-monitor set-up (so you can keep track of RTs and errors whilst subjects are in the scanner)
DMDX has been interfaced with the scanner
stimulus presentation and responses can be synchronised with image acquisition
DMDX can be triggered every TR (event or trial based designs) but has sufficiently reliable timing to be triggered with many intervening TRs
DMDX is usable by non-programmers
Script files are rich text files (.rtf)
Scripts are created using standard applications (spreadsheet, word-processor etc.)
DMDX runs under Windows 95/98
Experiments can be pre-tested before going to the WBIC
Behavioural data can be collected at the CBU using the same software

3. Limitations of DMDX

DMDX is designed for experiments with a regular, predictable stimulus presentation
experiments in which trials depend on whether preceding trials were correct or incorrect (e.g. incremental span tasks) are difficult (but not impossible) to set up.
experiments with individually (subject by subject) randomised timing of stimulus presentation are problematic (can randomise the order of presentation within an experiment).
DMDX is not suitable for experiments where unique stimuli are generated for each subject (e.g. visual search tasks).
DMDX was designed for experiments requiring simple response measures
does not work touch-screens, joysticks or other directional responses
DMDX can record naming responses to disk for later analysis (though ? movement artefacts)

4. How does DMDX work?

DMDX experiments are constructed in two parts

Item Files

These are simple rich text files (.rtf) that contain a sequence of instructions telling DMDX:
1) What stimuli to present to subjects and when
2) When to start measuring response times
3) What response to expect (yes/no)
4) When to wait for a trigger from the scanner

Stimulus Files

These are files that contain the stimuli that you want DMDX to display
1) Speech Files (.wav)
2) Picture Files (.bmp)
NB Written words are typed directly in the item file

5. What's in an item file?

Item files start with a header line setting parameters for how the experiment will be run. After the header lines will be item lines indicating what stimuli to present, when to measure a response from, what response to expect, etc.

Header lines:

a) Information about how to set up the machine that is running the experiment
what video mode to use
what device(s) to use in measuring responses
b) Default settings for stimulus presentation
whether to wait for a scanner trigger before every item or only before some items
how long to display each stimulus for
how long to wait between items
what background and foreground colour to use
whether to randomise the order of presentation
c) Default settings for recording responses:
how long to use as a ‘time-out’ for responses
how much detail to record about responses
whether to give feedback about correct/incorrect response
An example header line is shown below with keywords marked as being of type (a), (b) or (c).

<vm 1024,768,768,16,0> <id PIO12> <id keyboard>
<cr> <fd 17> <d 169> <dbc 255255255> <dwc 0>
<t 2500> <rcot> <azk> <nfb>

Item lines:

The item lines shown below will present written words successively on the screen. Each item line includes information on:

what response to expect (yes/no)
when to start the RT clock
what stimuli to present on the screen
 -  1 * "TALKED" /;
 -  2 * "THINKING" /;
 -  3 * "JUMPS" /;
 + 4 * "LEAPING" /;
    0 <remark - wait here for trigger from scanner> ;
 -  5 * "FDDFFFD" /;
 -  6 * "MMSSMMM" /;
 + 7   * "SSMMMSSS" /;

DMDX will pause at items numbered 0 and wait for a trigger from the scanner before continuing. You will need to test your experiment to ensure that the preceding items finish before the trigger arrives from the scanner.

The item lines below come from an experiment in which an auditory word is played followed by a picture being presented on the screen. Participants are expected to respond indicating whether the word and picture are the same or different. Frames marked <wav 2> will play a sound file (in both channels). Frames marked <bmp> will display a bitmap picture file. So for the first item below, the files cat.wav and dog.bmp would need to be in the directory with the item file.

 -  1 <wav 2> "cat"  / * <bmp> "dog" /;
 +  2 <wav 2> "elephant"  / * <bmp> "elephant" /;
 - 3 <wav 2> "truck"  / * <bmp> "submarine" /;
 + 4 <wav 2> "scissors” / * <bmp> "scissors" /;

Multiple frames can be combined on a single item line. A good rule of thumb is to combine frames so that there is one response expected for each item line in the file.

For more information on header lines and item lines, see Mike Ford's DMDX tutorial.

Last updated: 29/11/99