Using BESA to correct blink and EKG artifacts in MEG data

From BESA® Wiki
Revision as of 13:29, 5 May 2021 by Vibhin (Talk | contribs)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Module information
Modules BESA Research Standard or higher
Version BESA Research 6.1 or higher

Eyeblinks and EKG cause large artifact signals in the magnetometer channels. The artifact correction facilities of BESA can correct these artifacts quite well. The procedure is quite simple for blinks but more complex for EKG. The following text outlines the procedures and current limitations of BESA for artifact correction.

The principles of the artifact correction procedure are described in Berg and Scherg (1994).

In summary, the following steps are required:

  • Use pattern search and average to identify the latencies of blink/EKG signals in the raw data. Pattern search works best if you have recorded a vertical EOG and EKG with the MEG data, but it will also work on selected MEG channels, using the appropriate filters.
  • A spatial PCA is performed on the average to identify the main topographies/components of the artifact signal. For blinks, only one topography is required. For EKG, two or three topographies may be required.
  • The topographies/components are combined into a coefficient file (*.atf). Using the Artifact Menu, the atf file can be loaded and correction switched on. Contrary to the warning message displayed by the ERP module, averaging can be performed using artifact corrected data.
  • When the average is loaded into the Source Analysis module, the artifact coefficients (saved in the average file) need to be activated. They will then be incorporated into source modeling using Adaptive, Surrogate or Ssubspace projection (SSP – see also Uusitalo et al. (1997)). Note that SSP approach is not recommended. Usually, for continuous data, the best effect is achieved using the Adaptive method, for ERP Surrogate.


  • Berg, P., and Scherg, M. A multiple source approach to the correction of eye artifacts, Electroenceph. clin. Neurophysiol., 1994, 90: 229-241.
  • Uusitalo, M.A., Ilmoniemi, R.J. Signal-space projection method for separating MEG or EEG into components. Med. Biol. Eng. Comput., 1997, 35: 135-140.

Pattern search for blinks and EKG


  1. Select filters 0.5 – 8 Hz (Filters/Edit Filter Settings…). Make sure the low cutoff filter type is Forward! (This is to ensure that no contribution from the blink topography bleeds back into the baseline time interval).
  2. View Polygraphic signals only (press the Pgr button at the top right of the BESA window), so that the vertical EOG channel is displayed
  3. Define the search block from –100 ms to +400 ms (Edit/Default Block Epoch…)
  4. Select Pattern Search (Search/Pattern)
  5. Select Search Query (Search/Query)
  6. Select Buffer 1 for averaging (Tags/Pattern 1)
  7. Identify a clear blink signal on the vertical EOG channel. Right-click at the onset of the blink, and select Default Block in the dropdown menu. The marked block should look something like this: EKG artifacts in MEG data (1).png
  8. Click once on the VEOG channel label, so that a rightward arrow is displayed (ignore the correlation window that opens on the right): EKG artifacts in MEG data (2).png
  9. Press the SAW button (Search/Average/Write). BESA will start scanning through the file, and it will stop at each occurrence of a blink. Press “Yes” to accept. “No” to reject, or “Stop asking” to let BESA accept everything automatically. Save the result to a file name of your choice (e.g. name_artifact.fsg), labelling the segment, e.g. “blink”.

Note that instead of SAW the SAV can be displayed (Search/Average/View). This interaction has exactly the same meaning as SAW but does not prompt for saving averaged data but just display it in the average buffer. This behaviour can be switched in Search Menu by checking Search, Average, View option


  1. In contrast to blink averaging we use two steps: first, filters are set to enhance the EKG for pattern search. Second, the filters are opened up, and the average is repeated.
  2. Select filters 5-20 Hz. This should generate a fairly clear signal on the EKG.
  3. Set the default block epoch so that the R-wave and the T-wave are well inside the epoch. The setting used for blinks may be OK, but you may need to extend the post-cursor interval, e.g. from 400 to 500 ms.
  4. Proceed as with blinks, but selecting Buffer 2 for averaging (Tags/Pattern 2). Mark a block around the onset of an R-wave. The marked block should look something like this: EKG artifacts in MEG data (3).png
  5. Save the average in the same file as the averaged blinks, labelling the segment, e.g. “EKG”.
  6. Select filters 1-30 Hz. Select Search/Tagged Events, and press SAW. This repeats the average using the tags that were identified during the first step. Opening up the filters ensures that the average includes more of the EKG signal.

What to do if there is no VEOG or EKG channel

The procedure is similar to the above, but you need to identify a MEG channel that displays the blink or EKG waveform clearly. You may need to experiment with filter settings to make the artifact pattern clearer (the filter settings described above are not fixed rules – you may find that other settings work better for pattern search). You may find the “Create Triggers from EMG/EEG” tool helpful for detecting EKG (ERP/Create Triggers from EMG/EEG…). See the BESA help file (tutorial on creating triggers).

Spatial PCA and the *.atf file

Open the file in which you saved the averages (e.g. name_artifact.fsg). Make sure that prestimulus baseline correction is switched on (Filters/Use Prestimulus Baseline).


  1. Mark the whole blink epoch: Right-click onto the epoch, and select Whole Segment.
  2. Select Artifact/Assign/Blink. The spatial PCA is computed, and the first spatial component is assigned to describe the blink. You may check if the correction works by selecting Artifact/Correct.
  3. The coefficients are saved automatically to a file with the same basename as the average, and the extension “.atf”.


EKG coefficients are corrected analogously to blinks. A difference is that the topographic distribution of the EKG over the MEG sensors is more complex than that of blinks. It changes over time. The reasons for this are unclear, and may be due to movement of the heart (and its equivalent dipoles) over time, but also to ballistic effects: movement of the head due to blood flow.

Since topographic distribution changes over time, more than one component is required for correction. We choose the number of components in the Artifact Select Dialog Box empirically: As a rule of thumb, if a component explains more than 5-10% of the variance of the averaged EKG signal, the component is included. Note that the number of components you select can also be changed when the coefficients are applied to the raw data.

Correcting the raw data

  • After defining the artifact coefficients, they are automatically loaded and used for data. Note that you can enable and disable artifact correction by pressing CTRL-E or by menu Artifact/Correct you can load the defined artifact coefficient to another data set (i.e. subsequent recording from the same subject within the same session) using (Artifact/Load…) and providing the *.atf file you have created (by default with the same name as initial datafile)
  • Optionally, check that the artifact correction channels are visible (Artifact/View).
  • The figure below shows the result of correction of channels A75-A148 on a three-second interval containing both EKG and eye activity. The blue label “1” marks the onset of a blink found during pattern search. The red “2” shows the onset of R-waves found during pattern search.
  • Note that correction is quite good, but it is not perfect. In particular, there is some residual eye activity, e.g. around channels A91, A113, A131. It is intended behaviour since the most important during artifact correction is to not distort brain data.
uncorrected corrected
EKG artifacts in MEG data (4).pngEKG artifacts in MEG data (5).png EKG artifacts in MEG data (6).png

Averaging the raw data

When you press the Average button, a warning dialog will appear:

EKG artifacts in MEG data (7).png

You can leave artifact correction on during data averaging but it is not recommended.

Option “Yes” – turn off artifact correction

The averaged data will include EKG and eye artifacts, but these artifacts will not cause epochs to be rejected. The same number of epochs will be included in the average whether or not “Yes” or “No” is chosen. If you disable artifact correction during averaging you can reapply it using the "Artifact/Load" menu entry or loading artifact topographies later during Source Analysis. this approach assures that source analysis will be not affected by artifact correction and allows for full control of data. (i.e. comparing ERP data with artifact correction on and off, redefining the number of topographies used for artifact correction, and so on)

Option “No” – leave artifact correction on

The averaged data will be corrected. Since this operation cannot be reverted without recreating the average. Each epoch is corrected before being included in the average.

Artifact options: which correction model?

The result of the correction on the raw data or the averaged data can be slightly different. The effects of correction will also vary, depending on the settings in Artifact/Options. These differences can be considered as consequences of variations in the “surrogate” or “adaptive” model of brain activity concurrent with the artifact activity (cf. Berg & Scherg 1994). These differences lead to changes in the estimate of the amounts of artifact activity to be removed by correction. If you intend to use the data waveforms outside BESA, and if you don’t use SSP with the artifact coefficients, then the settings in Artifact/Options become important. In current versions of BESA, these settings are based on EEG amplitude levels. EKG artifacts in MEG data (8).png

Sending the data to Source Analysis

When the average is generated, the correction coefficients are saved in the *.fsg file. Before you send the data to the Source Module, these coefficients must be activated.

  • If you averaged the corrected data, coefficients are already activated. This should be apparent from the red “corrected” displayed above the channel labels.
  • If you averaged the uncorrected data, load the saved *.atf file (Artifact/Load…), and switch on correction (Artifact/Correct).

Then mark a time range and send the data to Source Analysis. At the right of the status bar, the text ART indicates that the artifact components are used in SSP.

EKG artifacts in MEG data (9).png

Alternatively, if you averaged the uncorrected data, load the average to Source Analysis, and then load the artifact coefficients as part of the dipole model (load or append solution, and use the dropdown list in the File Open box to select *.atf instead of *.bsa). This approach has the advantage that the source waveforms of the spatial components show the contribution of eye and EKG activity to the model.

This implicit application of artifact topographies during Source Analysis is mathematically equivalent to the “optimizing” correction method (cf. Berg & Scherg 1994)

Limitations of the correction method in BESA

Bad channels

The *.atf file contains a two-line header with a) the number of channels, and b) the channel labels. If these do not match with the current data file, artifact correction is not possible. Bad channels are marked (with an asterisk next to the label), and the corresponding coefficient is set to zero. The irritating, but logical, consequence is that if a channel was excluded (defined as “bad”) when the coefficients were generated, it is not possible to make the channel “good” again.

The solution is to regenerate the *.atf file, making sure the same bad channels are defined in the averaged artifact file as the to-be-corrected raw or average data file. You do not need to regenerate the artifact averages.

EKG correction is difficult because the topographic distribution of EKG signals is close to some MEG distributions: for instance, we sometimes observe a considerable reduction in alpha amplitudes with EKG correction. For event-related averaging, an EKG correction is often unnecessary, because the EKG is not synchronized with the stimulus.