From BCI2000 Wiki
Jump to navigation Jump to search


The FieldTripBuffer filter is an interface between BCI2000 and the FieldTrip Toolbox. The filter hosts a FieldTrip realtime buffer, and writes its input into that buffer, formatted as buffer data.

A separate MATLAB session on either the same or another computer can then use the reading and writing functions from the FieldTrip toolbox to communicate with the buffer asynchronously, reading data from BCI2000, and writing back results into BCI2000.

BCI2000 state variables may be translated into FieldTrip buffer events; in turn, buffer events are read back from the buffer into BCI2000 state variables. A dedicated FieldTrip buffer event type may be used to determine the filter's output into the BCI2000 processing pipe.




Jürgen Mellinger, Robert Oostenveld

Source Code Revisions

  • Initial development: 2044
  • Tested under: 2094
  • Known to compile under: 2095



The FieldTrip buffer's listening address, given as an IP:port combination. Software agents connect to this address using a TCP-based protocol.


A matrix-valued parameter that determines dimensions as well as initial values of the filter's output signal. In the matrix, rows map to signal channels, and columns map to elements.


A string representing the FieldTrip buffer event type that corresponds to the filter's output signal. For each block of data, the FieldTripBuffer filter checks whether an event of that type has been inserted into the buffer; whenever this is the case, the filter's output signal will be updated from the values contained in the event. If the event's data dimensions do not fit the output signal, parts of the output signal will not be updated, or event data will be ignored silently.


A list of states that are to be converted into FieldTrip events, and written into the buffer. The buffer event type matches the BCI2000 state name. An asterisk (*) represents any state name; a minus (-) sign before a state name means to exclude the respective state from the transmission. States may either be written to, or read from, the buffer, but not both; states listed in the FTStatesFromBuffer parameter are always excluded from writing.


A list of states that are to be set from FieldTrip events. When no event of matching type has been posted to the buffer, the state will not change; when multiple events have been posted since the FieldTrip buffer processed the last block of data, then the most recent event determines the state's value.


Any state name may be specified in the FTStatesToBuffer and FTStatesFromBuffer parameters.

See also

User Reference:MatlabFilter, Programming Reference:MatlabFilter

An example is given in the Programming Tutorial:Working with the FieldTrip buffer