Real-Time Visual Oddball Task
Tested on MEDUSA© Platform v2023.0
This app provides a visual oddball task to elicit event-related potentials (ERPs) and visualize them in real-time.
What is the basis of this task?
A visual oddball task is a commonly used paradigm in electrophysiology to study event-related potentials (ERPs), which are changes in the electrical activity of the brain that occur in response to specific stimuli. In a visual oddball task, participants are presented with a rapid sequence of visual stimuli, such as letters or symbols, and are asked to attend to the stimuli and perform a simple response when a rare or "oddball" stimulus appears.
The oddball stimulus is typically different from the other, more frequently presented stimuli in some way, such as being a different color or shape. The appearance of the oddball stimulus elicits an ERP response that is distinct from the responses to the more frequently presented stimuli. This allows researchers to study how the brain processes the oddball stimulus compared to other stimuli, and how attention and cognition influence ERP responses. These responses to the oddball stimulus can be measured using electroencephalography (EEG), which records the electrical activity of the brain from electrodes placed on the scalp. The ERP waveforms obtained from the EEG data can be analyzed to determine the latency and amplitude of the ERP components, which reflect different aspects of the neural processing of the stimuli.
In particular, one of the subcomponents of the ERP elicited by oddball tasks is the P300 potential. The P300 is a positive voltage deflection that occurs approximately 300 milliseconds after the onset of a stimulus and is most commonly elicited by unexpected or "oddball" stimuli in a rapid sequence of events. It is thought to reflect the allocation of attentional resources to the processing of the target stimulus, and the updating of working memory with information about the target. This component is sensitive to changes in cognitive demands, such as the difficulty of the task, the likelihood of the target stimulus, and the amount of information that needs to be processed.
We offer a simple application to conduct a visual oddball paradigm and visualize the ERPs in real-time. The app provides several key features to make the experiment easy and convenient to run:
Stimulus presentation: The application presents a rapid sequence of red circles and red squares on the screen. The target stimulus (small red square) occurs infrequently (e.g., 1/3 of the time), while the non-target stimulus (larger red circle) occurs frequently (e.g., 2/3 of the time). The timing of the stimuli and their duration is carefully controlled and standardized to ensure consistency between trials. By default, red circles and squares are used, but the stimulus can be modified by editing the images "images/non.png" and "images/target.png", respectively.
ERP monitoring: The ERP waveform shows the change in the electrical activity of the brain in response to the presentation of each stimulus. The application updates ERP graphs on the fly, whenever a new stimulus is received. Blue lines belong to the target stimuli, while orange lines indicate the non-target stimuli. Also, the 95% confidence intervals for both ERPs are represented by shaded areas.
Keypad recording: The application also records the keypresses of the "ENTER" key of the keypad. This allows the subject's attention to the target stimulus to be monitored, as the subject is instructed to press the "ENTER" key whenever they see the target stimulus. It is also advisable to instruct the user to count the number of objective stimuli received, in order to promote concentration on the task.
Data storage: The application stores the ERP waveform and the keypress data for each trial, along with the timing information for each stimulus. This allows the data to be analyzed later to determine the relationship between attention to the target stimulus and the ERP waveform.
About signal processing
The signal processing used in this app is very straightforward and simple, yet recommended. Only an infinite impulse response (IIR) Butterworth bandpass filter is applied, followed by a notch if required. Then, EEG epochs of a 800 ms from the stimulus onset are extracted and normalized using a z-score baseline of (-100, 0) ms. ERPs are computed by averaging the epochs whenever a new stimulus is displayed. For more information, check the update_erp function in main.py.
The configuration window allows to customize the following settings:
- No. targets (default: 6). Number of target stimuli to be presented in a sequence.
- No. non-targets (default: 12). Number of target stimuli to be presented in a sequence.
Important note: the no. non-targets must be greater than the no. targets, otherwise the requirements of the oddball tasks are not satisfied and P300 components will not be generated! By default, targets are 1/3 of the stimuli (i.e., 6/18).
- Stimulus duration (default: 500 ms): Duration of any stimulus.
- ISI range (default: 1100-1500 ms): Inter-stimulus interval (ISI) in which the screen remains empty. The range is used to generate a random number between the limits, so the ISI is not constant between different repetitions. This is important to avoid the generation of a steady-state visual evoked potential (SSVEP) at the stimulus rate.
- Bandpass cutoff (default: 0.5-30 Hz): Cutoff for the BPF filter. If the sampling rate of your biosignal is less than 60 Hz, update this parameter to avoid aliasing according to Nyquist theorem.
- Notch cutoff (default: 49-51 Hz): Cutoff for the notch filter. Notch filter is only applied if the cutoff falls inside the bandpass range of the previous parameter. Important: set it to 59-61 Hz if you live in a place where the electrical network runs at 60 Hz (e.g., USA)
- Trial window (default: 0-800 ms): Trial window range of the epochs averaged to get the ERP. Use a window length large enough to detect all the ERP components you want to analyze.
- Baseline window (default: -100-0 ms): Window range for the z-score normalization.