All you ever wanted to know about markers in BrainVision Analyzer 2

by Dipl.-Psych. Michael Hoppstädter & Dr. Michael Schubert
Scientific Consultants (Brain Products)

Why markers? Investigating electrophysiological effects that evolve over hundreds of milliseconds requires precisely timed triggers that can be used for trial alignment or averaging. This article will give you an overview of how to manage, edit and process your markers most efficiently in BrainVision Analyzer 2.

In the first part, we will introduce the marker concept in BrainVision Analyzer 2, tell you how they are visualized, and how you can edit them. In the second part, we will discuss transformations and solutions in Analyzer 2 which make use of markers during your data analysis.

Table of Contents

First Part

Second Part

Getting to know your markers

Let us start by checking how the data is structured in Analyzer 2. If you are familiar with our BrainVision native format as it is written by the BrainVision Recorder software, you will know that there are typically three files per recording: the EEG data file (.eeg), the BrainVision header file (.vhdr) and the BrainVision marker file (.vmrk). The latter of these three is the file containing all information necessary to represent your markers. The marker file is actually only read once when the raw files are read for the first time. All marker information is then embedded into the newly created History Files. All markers present in the History File can be easily visualized on the level of any history node via right-clicking a node and selecting Markers from the context menu. This will open a table that either summarizes the information grouped by marker description or the full list of all current markers.

Have now a look at Figure 1 to see how the marker file is structured.

Marker Management - Figure 1: BrainVision Marker File (.vmrk). Color coding refers to individual marker properties.

Figure 1: BrainVision Marker File (.vmrk). Color coding refers to individual marker properties.

The file is structured using several fields, whereby Marker Infos is a list of all markers present in the recording. The markers are enumerated starting from Mk1. All properties of an individual marker are defined within a single line. Each line is structured column-wise and columns are delimited by commas. What every column refers to is defined in the heading information of Marker Infos as follows:

Mk<Marker number> = <Type>,<Description>,<Position in data points>,<Size in data points>,
<Channel number (0 = marker is related to all channels)>,<Date (YYYYMMDDhhmmssuuuuuu)>.

Type and Description are the two defining properties of a marker. While type refers to a whole class of markers (e.g. stimulus triggers), description denotes a member of this class and is usually assigned to each occurrence of this marker (e.g. S1 or standard tone). There are certain preset marker types (see below) whereas marker descriptions can be freely chosen. The combination of type and description can be used in Analyzer 2 to reference a certain marker, e.g. when doing a marker-based segmentation.

Position is the most important property of the marker as this determines the exact placement of the marker. For all kinds of event-related designs, the position is thus crucial information and should be reliably recorded. The position is not given in time points but in data points instead. This makes the marker placement dependent on the sampling interval of your recording. For instance, if the position of a marker is 1000, and your sampling interval is 4 msec (corresponding to a sampling rate of 250 Hz), then it is possible to calculate the time point of the marker as:

Time points [msec] = (Data points – 1) * sampling interval [msec],
or as in our example: (1000 – 1) * 4 msec = 3996 msec.

Size of a marker refers to its length. Most markers will only have a size of 1 data point, as they are point markers. But some markers (e.g. Bad Interval markers; see below) are meant to be interval markers and thus extend to more than 1 data point.

Channel number determines if the marker is set for all channels or only for a specific one. If a marker is valid for all channels, it is coded with 0 while a marker that is assigned to a single channel is coded with the channel’s number (corresponding to the current channel order).

Only markers of type “New Segment” have an additional column for date which codes the exact time point of this marker (as long as time information is accessible during recording).

The whole story is of course different if a third party file format is used. Some file formats store the marker information together with the EEG data in a single file (as digital markers or sometimes as analog signal), or they come as a separate file in addition to the EEG data while again other formats might not incorporate markers at all. If you want to use BrainVision Analyzer 2 with a third party EEG dataset, it is thus strongly recommended to check how the markers are handled by the specific file format that is used for data transfer.

back to top

Visualization of markers

No matter if you use our native BrainVision format or another format, as soon as your electrophysiological data is loaded in Analyzer and fused with the corresponding marker information, you will be able to check the presence of your markers right away. In the main data window of Analyzer 2, all markers are displayed together with the EEG data and additionally the navigation bar (which is a representation of the whole timeline of the recording) will show all markers of the dataset as colored bars (see Figure 2). You can select which markers should be displayed in the navigation bar via right-clicking on the navigation bar and checking the marker types of interest. Per default all markers will be shown.

Marker Management - Figure 2: Markers in the Analyzer 2’s user interface. The display in the main window refers to the data portion highlighted in the navigation bar (1). The Marker Navigation tool (2) can be used to jump to specific markers. Global markers are shown below all channels or as shaded areas across all channels (A). Channel markers are shown attached to a specific channel (B).

Figure 2: Markers in the Analyzer 2’s user interface. The display in the main window refers to the data portion highlighted in the navigation bar (1). The Marker Navigation tool (2) can be used to jump to specific markers. Global markers are shown below all channels or as shaded areas across all channels (A). Channel markers are shown attached to a specific channel (B).

There are some additional general marker settings which handle marker visualization for the different views. These can be configured in the settings of each view (File > Configuration > View-Settings).

The current set of markers within your history node can also be used to navigate through the data using a tool called Marker Navigation (Add Ins > Tools > Marker Navigation). You can specify a currently used marker type or description (or a combination of both) and jump back and forth between markers that match your selection (see Figure 2).

back to top

About marker types

Now back to our BrainVision marker file. There is a predefined set of marker types, which are either added during recording or are set by specific transformations in Analyzer 2. Those types are Bad Interval, Comment, DC Correction, New Segment, Peak, Response, Stimulus, Threshold, Time 0, and Voltage. This list is not an exhaustive one, it is possible to create custom marker types when new markers are written or existing ones are edited. It is also worth mentioning that some transformations will only work with markers of a particular type. For instance, in order to export data from ERP peaks (e.g. P300) it is necessary to have the peak marked with a Peak marker.

back to top

Some specialities

There are two types of markers which seem quite similar and are still different. Let’s compare New Segment and Time 0 markers. New Segment markers will be present at least once in every marker file created by BrainVision Recorder as the first marker is always a New Segment one. There can also be more of them, for example when the recording was paused and resumed. The main purpose of this marker is to indicate a discontinuity in data flow which would otherwise be interpreted as a sudden voltage step. Additionally, these markers will be created by segmentation. This is quite logical as cutting the EEG signal into smaller bits and rearranging them will lead to discontinuities. On the contrary, Time 0 markers will only be available after segmentation and indicate time point zero of each segment. It sounds like they will be sitting in the same spot as the New Segment markers and, admittedly, they can but they do not have to. If the first data point of your segments is zero, then both markers will be located at this first data point. In case the segments were cut containing a pre-stimulus baseline (e.g. -200 to 1000 msec in relation to a reference marker), then the Time 0 marker will be sitting at zero, thus dividing pre- and post-stimulus time while the New Segment marker stays at the first data point of each segment.

Another special marker type is the Bad Interval marker. As mentioned above, this marker usually has a length greater than one data point. It is then not displayed as a bar at a defined point in time but instead as a shaded red area overlaying all channels (if the marker is set for all channels) or a red instead of a black trace (if the marker is set for a specific channel). These markers show another important behavior as they serve to mark portions of bad data. Instead of cutting out these bad data stretches, there are a few transformations which will ignore all data portions marked with Bad Intervals. For instance, ICA will not use Bad Interval data for matrix decomposition and Average will not include segments containing Bad Intervals at all.

As previously mentioned, markers can be globally set to all channels or locally set for a specific channel. This has two implications. The first one is that global markers will be shown per default at the bottom line of the main window while channel markers are shown directly attached to the specific channel (see Figure 2). The second one is that global markers will also be valid for all newly created channels while channel markers only affect the channel that is specified in the marker properties. This means if you delete a channel containing channel markers, the marker information of this channel will be lost together with the channel data.

back to top

Editing your markers in Analyzer 2

The transformation Edit Markers (Transformations > Others > Edit Markers) is the all-rounder when it comes to handling your markers: editing marker properties like type or description, shifting markers in time, creating new markers, or deleting unwanted markers. But let’s start with the basics. Edit Markers has three operation modes which are Automatic, Table and Graphical modes (see Figure 3). Briefly, Automatic mode can be used to change properties or to introduce time shifts for a whole class of markers (coded by type and description) at the same time. It is thus very easy to rename a whole marker set very quickly (e.g. from numerical markers to string markers, like “S1” to “Standard” in an Oddball paradigm), and this can then be applied via a History Template to all subjects. Table and Graphical modes are more suited for individual marker editing. Table mode displays all markers in a list and properties can be changed by editing the single cells, while Graphical mode opens an interactive window where you can navigate through the data and edit markers by just clicking on them. There are a few differences in handling the three modes. New markers can only be created in Table and Graphical mode while existing markers can be deleted in all the three modes. Shifting markers in time also works slightly different: in Automatic mode a time shift has to be entered in msec, in Table mode the absolute position of the marker has to be changed (in data points!), and in Graphical mode the marker has to be shifted by drag and drop while the current time index can be read off the status bar. Conveniently, Graphical mode includes instructions within the interactive window (see Figure 3). You can also call the Graphical mode of Edit Markers directly from the toolbar instead of the ribbon (via the button Marker Edit Mode showing a capital letter M). This is a nice feature since the interactive window will be opened at your current position within the dataset.

Marker Management - Figure 3: Edit markers and its three operation modes: Automatic (1), Table (2), and Graphical (3).

Figure 3: Edit markers and its three operation modes: Automatic (1), Table (2), and Graphical (3).

back to top

In and out – interfacing markers with external applications

Sometimes you might want to manipulate your markers in a more individual way going beyond the various options of Edit Markers. In this case it could be necessary to interface your markers between Analyzer and external software. Thus you will need import and export functions for markers and Analyzer 2 offers you both.

Importantly, we do not recommend editing the original BrainVision marker files (.vmrk). First, the philosophy of Analyzer 1 and 2 has always been not to touch the raw data after acquisition but instead all changes are implemented in the History Files. Keeping the raw data unchanged enables you to always go back and start your processing anew by just creating new History Files. This also prevents accidental overwriting of original data. Second and as mentioned above, markers are incorporated into the History File when loading the raw data for the first time. Therefore, changing a subject’s marker file will not have any effect unless you create new History Files for this subject and this will erase all previous processing.

Thus, if you want to externally edit your markers (e.g. using Microsoft Excel or a text editor with column operations like Notepad++), we suggest to first use the Export Markers module (Export > Node Export > Markers) to create a new marker file in ASCII (or XML) format, process the marker data in any suited application, and then to re-load your markers in Analyzer 2 with Import Markers (Transformations > Others > Import Markers > Import Markers from File). A prerequisite to import the changed marker file is that the format of the input file is the same as that of the Export Markers output file. This holds especially for column delimiters. There are some slight differences in the Export Markers output file compared to the original marker file (.vmrk): there is no enumeration column (Mk1,Mk2,…) and channels are not indicated by numbers but by channel names instead or All for global markers.

Another method to interface Edit Markers and Microsoft Excel (or other software operating on cells) is via the Table mode. It is possible to copy and paste cells from the Table mode to Excel, edit them there and copy and paste them back to Table mode. If you want to edit marker positions using this pipeline, keep in mind that they are specified in data points and not in time points.

By the way, you can also use the MATLAB Transformation to easily shift your markers to MATLAB®, edit them using some self-written code and shift them back into Analyzer 2. Importantly, the variable containing the edited markers has to be called NewMarkers as Analyzer will look for this name. For an example how to do this, check our Press Release (1/2013) article “How to add methods to Analyzer? An example of the MATLAB® Interface

Of course, this pipeline of imports and exports can also be used if you want to upload marker files from another application (e.g. if your markers are not part of your data files), or if you need to provide markers to another program.

back to top

Copying markers

There is another very handy feature of Import Markers worth mentioning. You cannot only import markers to a dataset from an external file but also from another history node (Transformations > Others > Import Markers > Import Markers from History Node). This is especially helpful if you want to copy markers from one node to another within a subject’s processing tree. Though please keep in mind that markers will only sit at the exact same position if you have the same sampling rate in both history nodes and, in case of segmented data, if your segments are of equal length in both nodes.

back to top

Using markers in Analyzer 2

After going through the theory of markers in BrainVision Analyzer 2, let us now move on to some common steps of EEG analysis in which markers help to make our lives easier. Several Analyzer 2 transformations work with different marker types. The ones that create or manipulate markers, as well as those that export marker information shall be described in the following. In addition, many of the solutions in Analyzer 2 make use of the markers for more specific purposes. Let us see how.

> Finding a peak

Are you looking for an easy way to find the latency and amplitude of your characteristic ERP component (e.g. P300) or would you like to find the individual alpha frequency for each subject? You are looking for peak detection! The Peak Detection transform (Transformations > Segment Analysis Functions > Result Evaluation > Peak Detection) is used to detect and mark local minima and maxima within an averaged EEG waveform.

In contrast to Peak Detection, the MinMax Markers solution (Solutions > Markers > MinMax Markers) lets you find the minimum and/or maximum amplitude in each segment and in this sense is great for single trial analysis. Here, a marker is set at the time point or frequency bin with the lowest or highest value within a given search window. Additionally, this solution also works on averaged frequency data to find spectral peaks.

Both Peak Detection and MinMax Markers place markers of type Peak. You can select specific channels in which the peaks are to be marked as channel markers or choose a reference channel to place global markers.

Of course, peak processing does not end with marking latencies and amplitudes. Peak Information Export (Export > Multiple Export > Peak Information) and the Peak Export solution (Solutions > Export > Peak Export) help you to export peak marker information by writing it to a *.txt file usable for further processing or statistical analysis. Additionally, peak to peak and area measures can be selected for export. Similarly, to finding peaks, Peak Information Export is applied to averaged data, whereas Peak Export is used for single trial analysis.

> Dealing with artifacts

Oh no, artifacts! Generally, you have two options: Reject them or correct them.

Portions of bad data can be marked on continuous data using Raw Data Inspection (Transformations > Artifact Rejection/Reduction > Raw Data Inspection) or on segmented data using Artifact Rejection (Transformations > Artifact Rejection/Reduction > Artifact Rejection). The former allows you to check your data for artifacts and mark respective time periods as Bad Intervals. The same is done in Artifact Rejection but it allows you to not only mark but also remove whole segments if they contain artifacts. The inspection can be carried out manually, semiautomatically or automatically. Markers are of type Bad Interval and indicate to many transformations that the marked intervals should not be considered, unless stated/set differently. Please refer to the first part of this article for the special characteristics of Bad Interval markers.

Rejecting artifacts has the disadvantage that valuable portions of data are lost, while correcting them lets you keep the affected time periods. Thankfully a number of sophisticated correction methods exist for certain kinds of artifacts and are implemented in Analyzer 2. All of these methods include a detection algorithm which can be used to set markers indicating the occurrence of artifacts.

Ocular Correction and Ocular Correction ICA can both reduce the effect of eye movements on the EEG signal using different methodological approaches. However, both can either detect and correct the data in one step or they can be used to set markers of type Blink as either interval or start/stop markers without applying the correction itself. This can be very useful to evaluate the result of the detection method or even to decide which correction method would be the most promising for a particular data set.

If you are dealing with ECG artifacts, the EKG Markers solution (Solutions > EKG > EKG Markers) searches for R-waves in a selected ECG channel. For each component P, Q, R, S, T of the ECG complex, markers of type Peak can be placed. These can be set as either global or channel markers.

Also, the CB Correction transform (CB – cardio ballistic; Transformations > Special Signal Processing > CB Correction) deals with the detection of R-waves but also correction of artifacts originating from the heart beat during combined EEG-fMRI measurements. CB Correction either uses existing R-markers (as from EKG Markers solution) or can set R-markers of type Peak based on a selected ECG channel. Furthermore, it can be used to set R-markers only without data correction.

Another artifact in simultaneous EEG-fMRI recordings is due to gradient coils’ pulse sequences. The MR Correction transform (Transformations > Special Signal Processing > MR Correction) allows the detection and correction of these non-physiological artifacts. It either uses existing volume markers sent from the MR scanner or can set markers based on selected channel(s) and adjustable detection values.

Note that exact timing is crucial for a successful MR correction. Therefore, it should be mentioned here that an easy way to check for potential timing differences is to use the solution Marker Timing (Solutions > Views > Marker Timing). It generates a data set with only one channel containing the time difference between subsequent volume markers. A flat line indicates the constant time difference between markers that is necessary for MR correction.

> Defining onsets

Data dependent marker placement becomes important when you are looking for neurophysiological correlates between brain activity and behavior. For example, if you have recorded a signal indicating crucial points in time, such as a force sensor, during the task along with your EEG, the Level Trigger transformation (Transformations > Dataset Preprocessing > Level Trigger) can be used to set markers of type Threshold if a certain force (or other) limit is exceeded. These markers can be placed as channel markers or as global markers and can be used as a basis for segmentation.

When working with simultaneous EEG-EMG recordings, you may be interested in finding the onset of a movement on the basis of the EMG signal. The EMG Onset Search solution (Solutions > EMG > EMG Onset Search) does exactly that. This solution searches for EMG onsets in selected channels of segmented data. Markers are of type Peak and are given the name EMG Onset. They can be used as a basis for a subsequent segmentation.

> Response and reaction times

In many paradigms it’s all about reaction time. An easy way to export the time between stimulus presentation and reaction (e.g. indicated by a button press) is to use the Write Markers solution (Solutions > Markers > Write Markers). This also allows you to export additional marker information such as type, name, position and duration.

What if you would like to analyze your data depending on different reaction times? In other words, how does the ERP look in trials of slow compared to faster reaction times? For this you can use the Recode Markers solution (Solutions > Markers > Recode Markers). This solution recodes reaction (time) markers according to specified marker properties. Depending on the information provided, the reaction markers are grouped into statistically derived categories. As an example, reaction time markers can easily be distinguished as below or above the median or as lying inside or outside of specified percentiles depending on their latencies. New Comment markers are placed in each trial indicating to which category a trial belongs. This can be used for a subsequent segmentation to compare data between the defined categories.

back to top

Concluding remarks

As you can see, markers can be useful in many situations. To make the most of them in BrainVision Analyzer 2 this article is here to help you understand the theoretical concept of markers and how they are used in various transformations and solutions to make your analysis more efficient. You can find a more extended documentation of all of the mentioned transformations in the Analyzer 2 User Manual or, in case of the solutions, directly in Analyzer 2 in the Solutions Help. By the way, the solutions discussed in this article are all downloadable from our website. If you have further questions regarding markers or how to make them work for you in Analyzer 2, you can send an email anytime to

©Brain Products GmbH 2016
2 0