The BERGEN Plug-in for EEGLAB

July 2009, Version 1.0

 

What is the Bergen Plug-in for EEGLAB?

Requirements

Download and Installation

Tutorial

STEP 1 – fMRI Volume onsets detection

STEP 2 – Artifact Duration Parameters

STEP 3 – Baseline Correction

STEP 4 – Correction Method

STEP 5 – Filtering Options

Batch jobs with the Bergen Plug-in

Bugs and Suggestions

Contributors

Citing the Bergen plug-in

Licence

References

What is the Bergen Plug-in for EEGLAB?

The Bergen plug-in is a set of Matlab tools developed at the fMRI group, University of Bergen, Norway, which allow the correction of fMRI-related gradient artifacts from EEG data. These tools are designed to work within the EEGLAB environment, providing a GUI to remove fMRI gradient artifacts from the EEG. All of the tools can also be used from the Matlab command line, providing expert users with the ability to use them in custom scripts.

The Bergen plug-in basically offers the choice between the moving average algorithm which was introduced by Allen and co-workers (Allen et al. Neuroimage, 2000) and the realignment parameter informed algorithm (RP-info, Moosmann et al. Neuroimage, 2009). The RP-info algorithm that takes potential head movements into account for a better correction of the fMRI gradient artifacts.

Requirements

Download and Installation

The Bergen plug-in can be downloaded at: http://fmri.uib.no/tools/EEG_fMRI_recording.zip

Extract the zip file and copy the content into your 'plugins' directory of your  EEGLAB distribution. A printable manual can be downloaded here: http://fmri.uib.no/tools/Manual_Bergen_Plugin.pdf

Tutorial

The correction process is structured in 5 individual steps which are described below

STEP 1 – fMRI Volume onsets detection

In this step the timing of the fMRI volume onsets is estimated, or defined according to recorded markers. If no markers coding the beginning of each fMRI volume were recorded during the experiment the plug-in tries to estimate the onsets via an autocorrelation method.

Options:

èUse Marker from fMRI recording:

Use this option if the EEG dataset was recorded with a marker coding the timing onset of each MR volume (uses the EEG.event structure)

·        Marker:

Choose the marker that codes the fMRI volume onsets from the drop-down menu. When selecting a marker, a plot of the first 7 fMRI Volumes will appear. A red cross indicates the fMRI volume onsets.

èManual fMRI volume onsets detection:

By choosing this option the time onsets of the fMRI volumes plug-in are estimated using an autocorrelation method. The algorithm requires an approximate value of the repetition time (TR) of the fMRI recording. For continuous fMRI recordings (no "silent gap") it might require more accurate values (+- 50ms). Around the specified TR fMRI volume onsets are identified by a threshold criterion that takes the first derivative of the signal into account. After all settings are defined, press the “Read fMRI volumes onset” button. A plot of the first 7 Markers will appear. A red cross indicates the fMRI volume onsets. If the volume onset detection fails, an error message is generated and the user has to change the settings before proceeding.

·        Specify approximate fMRI repetition rate (TR):

Time between two consecutive fMRI volume in milli-seconds. For  continuous fMRI recordings ('no silent gap') this number has to be quite accurate (+-50ms).

·        EEG reference channel:

Here the user can specify a particular EEG channel on which the detection method will be based on.. “Auto” option will automatically select the channel with median variance. Make sure that the channel selected is not an accidentally unplugged electrode. Users can check the channel with the Preview button.

·        Preview:

It plots the first derivative of selected channel. It might be useful to estimate a value for the Artifact Threshold. This button is only available if an EEG reference channel is selected.

·        Threshold for fMRI artifact detection:

Threshold that defines the occurrence of an fMRI gradient artifact. The first derivative (gradient value) of the EEG signal is taken into account. It can be specified as an absolute value (in micro volts per data point) or in percentage relative to the maximum value of the gradient of the artifact signal. Use the 'Preview' button to adjust to dedicated values.

 

STEP 2 – Artifact Duration Parameters

During step 2 artifact duration parameters such as 'start' and 'end' of the artifact period relative to the marker onset are specified.

Options:

èContinuous recording:

Choose this option if you have an fMRI recording without silent gaps. If selected, the 'Start' of the artifact period is defined as the volume onset (as defined in 'step 1'). The 'End' of the Artifact will be the time point immediately before the subsequent volume onset marker. (i.e. Start = 0, End = TR).

è Manually adjust Start and End values of the artifact period:

If selected, the user can adjust the 'Start' and 'End' of the artifact relative to the first volume onset marker (as defined in 'step 1'). 'Start' and 'End' values must be in milliseconds and will be positive or negative depending if they are after or before the volume onset marker position (respectively). Alternatively, user may select graphically Start and End points by pushing 'Select Point from graph'. A zoom tool is available and the buttons '+' and '-'' can be used adjust the artifact position. Note: Overlapping artifact periods (negative 'silent gap') are not  cannot be negative.

 

STEP 3 – Baseline Correction

Baseline Correction (BL) of the artifact periods as defined in 'step 2'

Options:

èUse mean of artifact period itself:

The artifact period itself (as defined in 'step 2') is used as baseline epoch. This option is recommended for continuous fMRI recordings without 'silent gap'. Each baseline interval (equiv. to artifact volume) is mean corrected.

èUse mean of preceding silent gap:

The period of the 'silent gap' (as defined in 'step 2') is used as baseline epoch (i.e. BL start='stop of artifact volume t ', BL stop='start of artifact volume t+1') This option is only available if silent gaps exists. If selected, each artifact interval as defined in 'step 2' is averaged and shifted to the average of precedent silent gap.

èUse mean of a specific time interval:

If selected, each artifact interval as defined on step 2 is averaged and shifted to the mean of defined time interval. The time interval is defined in the “BL start” and “BL stop” fields. The values are in milliseconds and are be positive or negative depending if they are after or before the marker, respectively.

·        Advanced Option - Baseline correct data before and after the fMRI recording:

This option corrects borders at the beginning and end of the fMRI recording. In this case, the whole initial part of dataset (until the beginning of fMRI recording) is averaged and then shifted to the average of the first corrected artifact. In the same way, the last part of the dataset (from the end of fMRI recording until the end of the dataset) is averaged and then shifted to the average of last artifact corrected. If selected, it will take effect after baseline correction as defined above.

 

STEP 4 – Correction Method

In this step the user chooses the method for the correction gradient artifacts. All methods are based on a template subtraction algorithm. A correction matrix is showing graphically which artifact volumes (x-axis) constitute to the individual template for the correction of the respective artifact volume (y-axis).

Options:

èMoving Average:

This artefact correction method is based on Allen et al (Neuroimage, 2000) and calculates individual templates which are subtracted from respective artefact periods to correct the MR-imaging related artefacts. The templates are calculated from a moving average of a constant number of artefact volumes centred around the artefact volume to correct. A correction matrix is showing graphically which artifact volumes (x-axis) constitute to the individual template for the correction of the respective artifact volume (y-axis)

·        Number of artifacts volumes that constitute the templates:

Number of Number of artifacts volumes that constitute the individual templates of the Moving Average correction algorithm. A typical number is 25 artifact volumes.

èRealignment Parameter Informed :

Modification of the Moving Average algorithm which yields a better artifact correction in case of abrupt head movements of the subject.  The head movements of the subject (as identified by the realignment procedure of the fMRI preprocessing) are taken into account to identify the appropriate artifact volumes that constitute the individual correction templates. Basically, movements above threshold act as a barrier in order to avoid averaging over discontinuities of the artefact properties. See Moosmann et al. Neuroimage, 2009 for more details. If no head movements are present this methods is equivalent to the 'Moving average' correction algorithm. A correction matrix is showing graphically which artifact volumes (x-axis) constitute to the individual template for the correction of the respective artifact volume (y-axis).

·        Number of Artifacts that constitute the template:

Number of Number of artifacts volumes that constitute the individual templates of the 'Realignment Parameter Informed' correction algorithm. A typical number is 25 artifact volumes

·        Threshold of head movement (in millimeter per data point):

The translational realignment parameters of the fMRI realignment procedure are transformed to a single parameter by Euclidian metric, resulting in a measure for the speed of the movements. This motion parameter is then thresholded so that only critical abrupt movements remained, and not slow drifts of the head. Typical values are ~0.5mm for 1.5T and ~0.3mm for 3T fMRI recordings (@ a EEG sampling rate of 5kHz).

·        Realignment Parameter File:

Choose the realignment parameter file from the SPM realignment procedure. Typically it is called "rp_*.txt" and is located in the same folder as the fMRI image files.

If fMRI images are excluded before the realignment procedure (to allow T1 saturation) the number of volume onset markers as identified in 'step 1 '(equiv. to the number of artifact volumes to correct) and the number of lines in the realignment parameter file (equiv. to the number of fMRI image files used for the realignment procedure) do not match. In this case the movement vector zero-padded.

èAll artifacts volumes:

This method uses all artifact volumes with the same weight to calculate the correction template.

èLoad correction matrix file:

This option allows users to load their own correction matrix by Matlab (*.MAT) file. This file must contain a variable called 'weighting_matrix'. This variable must be quadratic [N x N], where N is the number of artifacts considered for correction. If N is smaller than the number of fMRI volume onsets identified in 'step 1', the first (M-N) artifacts will be discard from correction.

STEP 5 – Filtering Options

In this step some basic filtering and down sampling options are provided.

Options:

èResample dataset:

Choose new (lower) sampling rate. Use this option to reduce the size of your dataset. This option uses the pop_resample() function from EEGLAB.

            Define new sampling rate in Hz, e. g. 200 Hz

èApply band-pass filter:

Band pass filter data using an elliptic IIR filter. Forward and reverse filtering are used to avoid phase distortions. It uses the pop_iirfilt()function from EEGLAB.  It applies consecutively the low-pass filter and then the high-pass filter.

Specify the filter border is Hz, e.g 'From 1 Hz To 70 Hz'.

Batch jobs with the Bergen Plug-in

After having processed a single subject with the GUI of the Bergen plug-in you might want to apply the same settings to several other subjects. To do this call the EEG.history function in Matlab to modify the filenames and folders.

Bugs and Suggestions

If bugs show up please send us a note (moosmann@gmail.com and netemanuel@gmail.com). Also, please do not hesitate to contact us with suggestions or comments. We would also welcome any collaboration in extending the tools or adding new features


Contributors

This plug-in was written by Emanuel Neto and Matthias Moosmann. Valuable comments were provided by Karsten Specht and Kenneth Hugdahl.


Citing the Bergen plug-in

This is a free software distributed under the GPL. However, we do ask those that find this program of use to cite it in their work. Please refer to it as the "Bergen plug-in for EEGLAB, provided by the fMRI group of the University of Bergen, Norway" and cite reference [1] below. Also, please make sure that EEGLAB is cited properly as described in the EEGLAB website.


Licence

The Bergen plug-in for EEGLAB, Release 1.0 2009, The University of Bergen (the "Software").

The Software remains the property of the University of Bergen ("the University").

The Bergen plug-in functions, sources and programs are released under the terms of the GPL (http://www.gnu.org/copyleft/gpl.html).

The Bergen plug-in is distributed "AS IS" under this Licence in the hope that it will be useful, but in order that the University as a charitable foundation protects its assets for the benefit of its educational and research purposes, the University makes clear that no condition is made or to be implied, nor is any warranty given or to be implied, as to the accuracy of the Software, or that it will be suitable for any particular purpose or for use under any specific conditions. Furthermore, the University disclaims all responsibility for the use which is made of the Software. It further disclaims any liability for the outcomes arising from using the Software.

By downloading or making this software available to others you agree to the terms of this licence and agree to let these terms known to other parties to whom you make this software available.

References

(1) Realignment parameter-informed artefact correction for simultaneous EEG–fMRI recordings. Moosmann M, Schönfelder VH, Specht K, Scheeringa R, Nordby H, Hugdahl K. Neuroimage. 2009, 45(4):1144-50.

 (2) A method for removing imaging artifact from continuous EEG recorded during functional MRI. Allen PJ, Josephs O, Turner R. Neuroimage. 2000 12(2):230-9.