User Reference:SpatialFilter
Function
The SpatialFilter computes an instantaneous linear transformation of its input. This linear transformation is described by a transformation matrix, and applied for each sample separately, not linking data across different points in time.
Typically, the SpatialFilter's input is the unfiltered brain signal from the source module.
BCI2000 V2 introduces three new spatial filters that can simplify implementing common filter types.
Parameters
SpatialFilterType
This parameter defines the method that will be used to design the spatial filter. The choices are:
- none
- full matrix
- sparse matrix
- common average reference (CAR)
These choices are described below.
None
In this case, no spatial filtering is performed; the input signal is copied to the output signal, and the spatial filter matrix is ignored.
Full Matrix
This is the standard spatial filter present in previous versions BCI2000. The SpatialFilter matrix parameter defines the linear transformation applied to the input signal.
Sparse Matrix
The sparse matrix filter uses the SpatialFilter to define an input channel, output channel, and weight for that channel.
Common Average Reference (CAR)
The common average reference spatial filter calculates the mean of every channel, and subtracts this value from selected output channels. The output channels from this filter are defined with the SpatialFilterCAROutput parameter (see below for more information on this parameter).
SpatialFilter
Full Matrix Filter Type

The full matrix filter uses the SpatialFilter parameter to define the linear transformation applied to the filter's input signal. In this matrix, columns represent input channels, and rows represent output channels. Each matrix element defines a weight with which the respective input channel (column) enters into the respective output channel (row).
If the spatial filter is an identity filter -- not modifying its input --, then the SpatialFilter matrix is a unit matrix (square matrix with ones on the main diagonal, and all other elements zero).
In a typical EEG experiment with fixed montage, you might want column labels to reflect the respective electrode location, simplifying the task of further modifications to the spatial filter.
Sparse Matrix Filter Type
The sparse matrix filter uses the SpatialFilter parameter to define the relationship between input channels and output channels with a given weight. In this case, the SpatialFilter matrix must have 3 columns, and a row for each input/output relationship. The first column contains the input channel, the third column defines the weight that the input channel is multiplied by before being assigned to the output channel, which is defined in the second column.
SpatialFilterCAROutput
This parameter is a list of channels that define which channels should be output from the common average reference spatial filter, and the order in which they should appear. That is, the location of the channel in this list determines the output channel position. For example, if input channels 6, 7, 10, and 12 should be passed to the output of the spatial filter as channels 3, 4, 1, and 2, then this parameter should be set to:
10 12 6 7
It is important to note that ALL channels passed to the spatial filter (typically defined in the TransmitChList) are used in the CAR calculation, but only a subset of these channels are actually output and passed to the next step in the signal processing chain.
If this parameter is left blank, then all input channels are passed to the output, and the number of input channels equals the number of output channels.
States
None.
Examples
Linked Mastoids (Full Matrix)
Physical reference is to the left mastoid (A1). The right mastoid (A2) is recorded vs A1 on channel 1. All other electrodes are recorded vs A1 as well, and use the remaining channels. In your spatial filter, you will want to re-reference all channels against "linked mastoids", i.e. against the mean of A1 and A2.
In the spatial filter matrix, you want to subtract half of the A2 channel from each of the remaining channels:
| A2 | Fz | Cz | Pz | ... | |
|---|---|---|---|---|---|
| Fz' | -1/2 | 1 | 0 | 0 | ... |
| Cz' | -1/2 | 0 | 1 | 0 | |
| Pz' | -1/2 | 0 | 0 | 1 | |
| ... | |||||
Common Average Reference (Full Matrix)
Signals are to be re-referenced against the average of all channels. To achieve this, begin with an identity matrix, and subtract a matrix of all ones, divided by the number of input channels:
| Fz | Cz | Pz | Oz | ... | |
|---|---|---|---|---|---|
| Fz' | 1-1/N | 1/N | 1/N | 1/N | ... |
| Cz' | 1/N | 1-1/N | 1/N | 1/N | |
| Pz' | 1/N | 1/N | 1-1/N | 1/N | |
| Oz' | 1/N | 1/N | 1/N | 1-1/N | |
| ... | |||||
Sparse Matrix
In this example, the mean of channels 1-4 are passed to output channel 1, and the negative mean of channels 10-13 are passed to output channel 2. The SpatialFilter matrix definition is given below.
| In | Out | Wt | |
|---|---|---|---|
| 1 | 1 | 1 | .25 |
| 2 | 2 | 1 | .25 |
| 3 | 3 | 1 | .25 |
| 4 | 4 | 1 | .25 |
| 5 | 10 | 2 | -.25 |
| 6 | 11 | 2 | -.25 |
| 7 | 12 | 2 | -.25 |
| 8 | 13 | 2 | -.25 |