The example is here attachment:ExperimentTemplate.zip
This is an attention monitoring experiment. It may be used in the scanner, or out of the scanner, with a simple switch of a parameter. It contains a colleciton of modules (starting Exp...) that contain functions that should be generally useful for many experiments.
This program is provided as an illustration only. You should always check your code carefully.
General experimental settings. Most useful is probably
Public FullScreen As Boolean = True
By default, the experiment acquires the whole screen, to give accurate timing, and prevent other programs from being displayed. However, this can be irritating when debugging, so set this to False when programming.
Contains various subroutines to help you use DirectX for display.
Sets up screen, in full screen or windowed mode. Make sure the number of colours (third argument in
DXDevice.SetDisplayMode(ES.ScreenWidth, ES.ScreenHeight, 32, 0, False)
is set to the same as the colour depth that windows was started in, if you use .FROMARGB anywhere to convert RGB values to colours.
Clears the screen
Draws a fixation cross
To ensure that graphics are displayed tidily, drawing is done on an "off screen surface" and then flipped to the display. This command flips the display. If in fullscreen mode, a DirectX flip command is used, which will be executed by the graphics card, and give high performance. In the testing windowed mode, a copy command is used to emulate the action of the flip.
Various routines for getting accurate timing, synchronising with the scanner (if used), checking button boxes and the keyboard.
ExpTrial & AttentionTrial
The ExpTrial class that represents a single trial, storing the parameters of the trial. This class would usually be used as a base for your own class, which more fully implements the particular experiment in question. Here, this is done in AttentionTrial, which inherits ExpTrial, but extends the "Run" method to display an attention monitoring trial.
ExpTrialList & AttentionTrialList
ExpTrialList stores a list of trials, and knows how to randomise it (or individual parameters), run all of the trials, and dump various things to the output file. AttentionTrialList is a specific implementation for this experiment, that also prepares the grating stimuli.
This is the main form. The code behind the "Start" button actually runs the experiment