Difference: DocsSectionsMarkerHandling (1 vs. 18)

Revision 1817 Nov 2014 - Main.PhilipVanDenBroek

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
<---Start1--->

Inserting Markers

Line: 6 to 6
 Generate current PDF
Added:
>
>

Introduction

Markers fulfil two roles, synchronising stimuli and triggering events. The synchronisation role is required to match moments of presented stimuli with at that time acquired data. While markers translate into rich events, an event itself can also directly trigger execution of other events in order to implement required program flow. Inserting markers as described in this paragraph is solely meant to achieve the synchronisation role. Triggering other events from events should be specified in a separate Trigger table, explained in more detail here.
 

Inserting markers in the data stream

Data is recorded by a hardware device. BrainStream does not connect to this hardware device directly, but via a FieldTrip buffer.

Revision 1711 Nov 2014 - Main.PhilipVanDenBroek

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
<---Start1--->

Inserting Markers

Line: 106 to 106
 The actual insertion time of the marker relative to the data is represented as a white block in figure 3. However, in the FieldTrip buffer, the marker will be treated as if it arrived together with the most recent data package. As described above, with a data package size of 16 samples and a hardware sampling rate of 2 kHz, the marker can appear to have been inserted up to 8 ms earlier than it actually was. Thus, the timing accuracy of markers inserted via the FieldTrip buffer (8 ms) is less accurate than that of markers inserted via the hardware (0.5 ms). However, markers that are sent to the FieldTrip buffer can immediately be processed by BrainStream without having to wait for a data package update.

Additional issues

Changed:
<
<
If markers that are sent via the FieldTrip buffer are not defined in the Dictionary table, BrainStream will internally assign a type and value for these markers. Nevertheless, it is better to make sure you specify all markers in the Dictionary table yourself.

Markers that are inserted via the FieldTrip buffer are not stored in the raw data file. Therefore, markers that you need for offline processing should be inserted via the hardware instead.

>
>
If markers that are sent via the FieldTrip buffer are not defined in the Dictionary table, BrainStream will internally assign a type and value for these markers. Markers that are inserted via the FieldTrip buffer are not stored in the raw data file. Therefore, markers that you need for offline processing (i.e., to sync moments of stimuli with the data) should be inserted via the hardware instead and must be defined in the Dictionary table.
 
<---End1--->

Revision 1604 Jan 2012 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
<---Start1--->

Inserting Markers

Line: 78 to 78
 delay = time in seconds before marker is inserted reference = relative to which timepoint is the delay specified, either: 'now': delay is specified relative to timepoint of bs_send_buffer_marker execution, or
Changed:
<
<
'marker': delay is specified relative to the onset of the event during which bs_send_buffer_marker is executed
>
>
'marker' (default): delay is specified relative to the onset of the event during which bs_send_buffer_marker is executed
 

In contrast to insertion via the hardware, a delay can be specified for marker insertion via the FieldTrip buffer. A short example shows the difference between the two possible 'reference' specifications:

Revision 1516 Dec 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
<---Start1--->

Inserting Markers

Line: 35 to 35
  event = event structure marker = marker name
Changed:
<
<
datasource = in which data source should the marker be inserted (you may leave this argument empty if only one data source is used)
>
>
datasource = in which data source should the marker be inserted (you may leave this argument empty if only one data source is used)

The bs_send_hardware_marker function does not send the markers to the hardware itself. Instead, it will look in the blocksettings for a sndMarker function which actually sends the markers to the hardware device. If you have not specified a sndMarker function in the block file, BrainStream will insert the markers via the FieldTrip buffer instead. If this happens, you will see the following message in the Matlab command window and the log file:

No 'send-marker-function' defined: marker (<marker name>) sent to BrainStream directly 
 

Timing accuracy and processing speed

Changed:
<
<
When the bs_send_hardware_marker function is executed, BrainStream will send the marker to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
>
>
When the bs_send_hardware_marker function is executed, BrainStream will send the marker to the hardware device. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
  HardwareMarker.png

Revision 1416 Nov 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
<---Start1--->

Inserting Markers

Line: 49 to 49
 The marker will be inserted in the data at a certain sample number, represented as a white block in figure 3. Thus, the timing accuracy of markers inserted via the hardware corresponds to one sample. For example, at a sampling frequency of 2 kHz the timing accuracy is 0.5 ms.

The data is sent from the hardware to the FieldTrip buffer in packages of a fixed number of samples, represented in the figure as light and dark blocks. The inserted marker will be sent to the FieldTrip buffer together with the corresponding data package. The time this may take depends on the number of samples per package and the sampling rate of the device. For example, if the package size is 16 samples and the sampling rate of the hardware is 2 kHz, data and markers will be sent to the FieldTrip buffer every 8 ms. Thus, in this case it may take up to 8 ms before the marker is received by BrainStream and can be processed.

Added:
>
>

Testing without hardware

It is possible to test your experiment on your own machine, without any hardware connected. If the bs_send_hardware_marker function is called when no hardware is connected, BrainStream will automatically send the marker via the FieldTrip buffer instead. When this happens, the following message will appear in the Matlab command window and the log file:
marker <marker name> (type <marker type>) sent to fieldtrip buffer directly

If for some reason the insertion of markers via the hardware fails while hardware is connected (i.e. during a 'real' experiment), BrainStream will give an error message and end the experiment.

 

Additional issues

Markers that are inserted via the hardware must always be defined in the Dictionary table. An error occurs if the marker is not found in the Dictionary.

Revision 1314 Nov 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
<---Start1--->

Inserting Markers

Revision 1214 Nov 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
Changed:
<
<
META TOPICPARENT name="BrainStreamDocs"
>
>
META TOPICPARENT name="WebHome"
 
<---Start1--->

Inserting Markers

Changed:
<
<
Generate current PDF
>
>
Generate current PDF
 

Inserting markers in the data stream

Line: 115 to 115
 
META FILEATTACHMENT attachment="BufferMarker.png" attr="" comment="" date="1319708080" name="BufferMarker.png" path="BufferMarker.png" size="107137" stream="BufferMarker.png" tmpFilename="/var/tmp/CGItemp57232" user="MarjoleinVanDerWaal" version="2"
META FILEATTACHMENT attachment="Delay_now.png" attr="" comment="" date="1319709527" name="Delay_now.png" path="Delay_now.png" size="51764" stream="Delay_now.png" tmpFilename="/var/tmp/CGItemp57367" user="MarjoleinVanDerWaal" version="1"
META FILEATTACHMENT attachment="Delay_marker.png" attr="" comment="" date="1319709537" name="Delay_marker.png" path="Delay_marker.png" size="54655" stream="Delay_marker.png" tmpFilename="/var/tmp/CGItemp57439" user="MarjoleinVanDerWaal" version="1"
Added:
>
>
META TOPICMOVED by="MarjoleinVanDerWaal" date="1321266204" from="BrainStream.DocsSectionsMarkerHandling" to="BrainStreamDocs.DocsSectionsMarkerHandling"

Revision 1109 Nov 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
<---Start1--->

Inserting Markers

Added:
>
>
Generate current PDF
 

Inserting markers in the data stream

Revision 1009 Nov 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
<---Start1--->

Inserting Markers

Line: 21 to 21
 Each marker route has its advantages and disadvantages, so which route is the best depends on the inserted marker's function. Markers inserted via the hardware have more accurate synchronization with the data, but markers inserted via the FieldTrip buffer can be processed faster. In addition, only markers that are inserted via the hardware are saved in the raw data file. This means that markers that are required for offline processing must always be inserted via the hardware.

We will now describe each of the marker routes in more detail.

Added:
>
>
 

Inserting markers via the hardware

The most accurate synchronization between markers and data is obtained when a marker is sent via the hardware. It is recommended to insert markers via the hardware when good synchronization between the markers and the data is important, for example when the markers represent the onset of stimuli in an ERP-based BCI.

Line: 36 to 38
 

Timing accuracy and processing speed

Changed:
<
<
When the bs_send_hardware_marker function is executed, BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
>
>
When the bs_send_hardware_marker function is executed, BrainStream will send the marker to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
  HardwareMarker.png

Revision 904 Nov 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
<---Start1--->

Inserting Markers

Line: 50 to 50
 Markers that are inserted via the hardware must always be defined in the Dictionary table. An error occurs if the marker is not found in the Dictionary.

Only markers that are inserted via the hardware are stored in the raw data (e.g. .bdf or .gdf) file. Markers that you need after your experiment has finished, for example for offline processing, should therefore always be inserted via the hardware.

Added:
>
>
 

Inserting markers via the FieldTrip buffer

Markers inserted via the FieldTrip buffer can be processed faster than markers inserted via the hardware. However, the synchronization between these markers and the data is less accurate.

Revision 831 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
<---Start1--->

Inserting Markers

Revision 727 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
Changed:
<
<

Marker Routing and Timing

>
>
<---Start1--->

Inserting Markers

 

Inserting markers in the data stream

Line: 11 to 12
  Figure 1: BrainStream is connected to the hardware via a FieldTrip buffer.
Changed:
<
<
The data is recorded by the hardware and streamed to the FieldTrip buffer in small packages of a fixed number of samples. BrainStream reads the data from the buffer. Markers can be inserted in the data either via the hardware device or via the FieldTrip buffer. The first method is the most accurate, but the second method is faster. Markers can be inserted by BrainStream itself or any of its clients. In the figure below, you can see a schematic representation of the two marker routes:
>
>
The data is recorded by the hardware and streamed to the FieldTrip buffer in small packages of a fixed number of samples. BrainStream reads the data from the buffer. Markers can be inserted in the data either via the hardware device or via the FieldTrip buffer. Markers can be inserted by BrainStream itself or any of its clients. The figure below shows a schematic representation of the two marker routes:
  MarkerRoutes.png

Figure 2: Markers can be inserted via the hardware or via the FieldTrip buffer.

Changed:
<
<
We will now describe each of the methods of inserting markers in more detail.

Inserting markers via the hardware (bs_send_hardware_marker)

>
>
Each marker route has its advantages and disadvantages, so which route is the best depends on the inserted marker's function. Markers inserted via the hardware have more accurate synchronization with the data, but markers inserted via the FieldTrip buffer can be processed faster. In addition, only markers that are inserted via the hardware are saved in the raw data file. This means that markers that are required for offline processing must always be inserted via the hardware.
 
Changed:
<
<
Insert markers via the hardware if
  • you need the most accurate synchronization possible between markers and data
  • you need the markers for offline processing after the experiment is finished
>
>
We will now describe each of the marker routes in more detail.

Inserting markers via the hardware

 
Changed:
<
<
The most accurate synchronization between markers and data is obtained when a marker is sent via the hardware. It is recommended to insert markers via the hardware when good synchronization between the markers and the data is important, for example when the markers represent the onset of stimuli in an ERP-based BCI. In order to do this, you must use the following function:
>
>
The most accurate synchronization between markers and data is obtained when a marker is sent via the hardware. It is recommended to insert markers via the hardware when good synchronization between the markers and the data is important, for example when the markers represent the onset of stimuli in an ERP-based BCI.

Function: bs_send_hardware_marker

In order to insert a marker via the hardware, you must use the following function:

 
bs_send_hardware_marker(event, marker, datasource)

event      = event structure
marker     = marker name
Changed:
<
<
datasource = in which data source should the marker be inserted (you may leave this empty if only one data source is used)
>
>
datasource = in which data source should the marker be inserted (you may leave this argument empty if only one data source is used)
 
Changed:
<
<
BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
>
>

Timing accuracy and processing speed

When the bs_send_hardware_marker function is executed, BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.

 
Changed:
<
<
HardwareMarker.png
>
>
HardwareMarker.png
 
Changed:
<
<
The marker will be inserted in the data at a certain sample number, represented as a white block in figure 2. Thus, the timing accuracy of markers inserted via the hardware corresponds to one sample. For example, at a sampling frequency of 2 kHz the timing accuracy is 0.5 ms.
>
>
Figure 3: Schematic timeline of marker insertion via the hardware.
 
Changed:
<
<
The data is sent from the hardware to the FieldTrip buffer in packages of a fixed number of samples, represented in the figure as black and grey blocks. The inserted marker will be sent to the FieldTrip buffer together with the corresponding data package. The time this may take depends on the number of samples per package and the sampling rate of the device. For example, if the package size is 16 samples and the sampling rate of the hardware is 2 kHz, data and markers will be sent to the FieldTrip buffer every 8 ms. Thus, in this case it may take up to 8 ms before the marker is received by BrainStream and can be processed.
>
>
The marker will be inserted in the data at a certain sample number, represented as a white block in figure 3. Thus, the timing accuracy of markers inserted via the hardware corresponds to one sample. For example, at a sampling frequency of 2 kHz the timing accuracy is 0.5 ms.

The data is sent from the hardware to the FieldTrip buffer in packages of a fixed number of samples, represented in the figure as light and dark blocks. The inserted marker will be sent to the FieldTrip buffer together with the corresponding data package. The time this may take depends on the number of samples per package and the sampling rate of the device. For example, if the package size is 16 samples and the sampling rate of the hardware is 2 kHz, data and markers will be sent to the FieldTrip buffer every 8 ms. Thus, in this case it may take up to 8 ms before the marker is received by BrainStream and can be processed.

Additional issues

  Markers that are inserted via the hardware must always be defined in the Dictionary table. An error occurs if the marker is not found in the Dictionary.

Only markers that are inserted via the hardware are stored in the raw data (e.g. .bdf or .gdf) file. Markers that you need after your experiment has finished, for example for offline processing, should therefore always be inserted via the hardware.

Changed:
<
<

Inserting markers via the FieldTrip buffer

>
>

Inserting markers via the FieldTrip buffer

Markers inserted via the FieldTrip buffer can be processed faster than markers inserted via the hardware. However, the synchronization between these markers and the data is less accurate.

Function: bs_send_buffer_marker

 
Changed:
<
<
Insert markers via the FieldTrip buffer if
  • synchronization between the markers and the data is less important
  • you don't need the markers for offline processing
>
>
In order to insert markers via the FieldTrip buffer, you must use the following function:
bs_send_buffer_marker(event, marker, datasource, delay, reference)
 
Changed:
<
<
Inserting a marker in the data stream via the FieldTrip buffer is faster than inserting markers via the hardware. However, the synchronization between these markers and the data is less accurate. In order to insert markers like this, you must specify sndBufferMarker as your SendMarkerFnc in the block file. BrainStream sends the marker to the FieldTrip buffer, where it will be approximately synchronized with the data.
>
>
event = event structure marker = marker name datasource = in which data source should the marker be inserted (you may leave this argument empty of only one data source is used) delay = time in seconds before marker is inserted reference = relative to which timepoint is the delay specified, either: 'now': delay is specified relative to timepoint of bs_send_buffer_marker execution, or 'marker': delay is specified relative to the onset of the event during which bs_send_buffer_marker is executed
 
Changed:
<
<
BufferMarker.png
>
>
In contrast to insertion via the hardware, a delay can be specified for marker insertion via the FieldTrip buffer. A short example shows the difference between the two possible 'reference' specifications:
Actions table
marker time function
mrk1 EVENT fnc1, fnc2, bs_send_buffer_marker('mrkA','eeg',2,'now')
 
Changed:
<
<
The actual insertion time of the marker relative to the data is represented as a white block in figure 3. However, in the FieldTrip buffer, the marker will be treated as if it arrived together with the most recent data package. As described above, with a data package size of 16 samples and a hardware sampling rate of 2 kHz, the marker can appear to have been inserted up to 8 ms earlier than it actually was. Thus, the timing accuracy of markers inserted via the FieldTrip buffer (8 ms) is less accurate than that of markers inserted via the hardware (0.5 ms). However, markers that are sent to the FieldTrip buffer can immediately be processed by BrainStream without having to wait for a data package update.
>
>
Delay_now.png
 
Changed:
<
<
For markers sent via the FieldTrip buffer, a delay can a be specified as a fourth input argument for the sndMarker function.
>
>
Actions table
marker time
function
mrk1 EVENT fnc1, fnc2, bs_send_buffer_marker('mrkA','eeg',2,'marker')

Delay_marker.png

This example shows that the 'now' option specifies the delay relative to the onset of the bs_send_buffer_marker function, whereas the 'marker' option specifies the delay relative to the onset of the event during which bs_send_buffer_marker is executed. In the latter case, if processing of the event takes longer than the specified delay, the marker cannot be inserted at the scheduled time. Instead, the marker will be inserted as soon as the execution of all functions prior to the bs_send_buffer_marker is completed.

Timing accuracy and processing speed

When the bs_send_buffer_marker function is executed, BrainStream sends the marker to the FieldTrip buffer, where it will be approximately synchronized with the data:

BufferMarker.png

Figure 4: Schematic timeline of marker insertion via the FieldTrip buffer.

The actual insertion time of the marker relative to the data is represented as a white block in figure 3. However, in the FieldTrip buffer, the marker will be treated as if it arrived together with the most recent data package. As described above, with a data package size of 16 samples and a hardware sampling rate of 2 kHz, the marker can appear to have been inserted up to 8 ms earlier than it actually was. Thus, the timing accuracy of markers inserted via the FieldTrip buffer (8 ms) is less accurate than that of markers inserted via the hardware (0.5 ms). However, markers that are sent to the FieldTrip buffer can immediately be processed by BrainStream without having to wait for a data package update.

Additional issues

 
Changed:
<
<
If markers that are sent via the FieldTrip buffer are not defined in the Dictionary table, BrainStream will internally assign a type and value for these markers. Nevertheless, it is better to specify all markers in the Dictionary table yourself.
>
>
If markers that are sent via the FieldTrip buffer are not defined in the Dictionary table, BrainStream will internally assign a type and value for these markers. Nevertheless, it is better to make sure you specify all markers in the Dictionary table yourself.
  Markers that are inserted via the FieldTrip buffer are not stored in the raw data file. Therefore, markers that you need for offline processing should be inserted via the hardware instead.
Deleted:
<
<

Processing of incoming markers

 
Changed:
<
<
  • HardwareMarker? .png:
>
>
<---End1--->
 
Changed:
<
<
  • HardwareMarker? .png:
>
>
<-- 
  • Access control
    • Set DENYTOPICVIEW =
-->
 
META FILEATTACHMENT attachment="FTbuffer.png" attr="" comment="" date="1319198471" name="FTbuffer.png" path="FTbuffer.png" size="54340" stream="FTbuffer.png" tmpFilename="/var/tmp/CGItemp47508" user="MarjoleinVanDerWaal" version="1"
META FILEATTACHMENT attachment="MarkerRoutes.png" attr="" comment="" date="1319199246" name="MarkerRoutes.png" path="MarkerRoutes.png" size="130322" stream="MarkerRoutes.png" tmpFilename="/var/tmp/CGItemp47539" user="MarjoleinVanDerWaal" version="1"
META FILEATTACHMENT attachment="HardwareMarker.png" attr="" comment="" date="1319206305" name="HardwareMarker.png" path="HardwareMarker.png" size="115882" stream="HardwareMarker.png" tmpFilename="/var/tmp/CGItemp47650" user="MarjoleinVanDerWaal" version="2"
Changed:
<
<
META FILEATTACHMENT attachment="BufferMarker.png" attr="" comment="" date="1319205864" name="BufferMarker.png" path="BufferMarker.png" size="112750" stream="BufferMarker.png" tmpFilename="/var/tmp/CGItemp47553" user="MarjoleinVanDerWaal" version="1"
>
>
META FILEATTACHMENT attachment="BufferMarker.png" attr="" comment="" date="1319708080" name="BufferMarker.png" path="BufferMarker.png" size="107137" stream="BufferMarker.png" tmpFilename="/var/tmp/CGItemp57232" user="MarjoleinVanDerWaal" version="2"
META FILEATTACHMENT attachment="Delay_now.png" attr="" comment="" date="1319709527" name="Delay_now.png" path="Delay_now.png" size="51764" stream="Delay_now.png" tmpFilename="/var/tmp/CGItemp57367" user="MarjoleinVanDerWaal" version="1"
META FILEATTACHMENT attachment="Delay_marker.png" attr="" comment="" date="1319709537" name="Delay_marker.png" path="Delay_marker.png" size="54655" stream="Delay_marker.png" tmpFilename="/var/tmp/CGItemp57439" user="MarjoleinVanDerWaal" version="1"

Revision 621 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"

Marker Routing and Timing

Line: 34 to 34
  BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
Changed:
<
<
[Figure 2: timeline of sndMarker via hardware]
>
>
HardwareMarker.png
  The marker will be inserted in the data at a certain sample number, represented as a white block in figure 2. Thus, the timing accuracy of markers inserted via the hardware corresponds to one sample. For example, at a sampling frequency of 2 kHz the timing accuracy is 0.5 ms.
Line: 51 to 51
  Inserting a marker in the data stream via the FieldTrip buffer is faster than inserting markers via the hardware. However, the synchronization between these markers and the data is less accurate. In order to insert markers like this, you must specify sndBufferMarker as your SendMarkerFnc in the block file. BrainStream sends the marker to the FieldTrip buffer, where it will be approximately synchronized with the data.
Changed:
<
<
[Figure 3: timeline of sndMarker via buffer]
>
>
BufferMarker.png
  The actual insertion time of the marker relative to the data is represented as a white block in figure 3. However, in the FieldTrip buffer, the marker will be treated as if it arrived together with the most recent data package. As described above, with a data package size of 16 samples and a hardware sampling rate of 2 kHz, the marker can appear to have been inserted up to 8 ms earlier than it actually was. Thus, the timing accuracy of markers inserted via the FieldTrip buffer (8 ms) is less accurate than that of markers inserted via the hardware (0.5 ms). However, markers that are sent to the FieldTrip buffer can immediately be processed by BrainStream without having to wait for a data package update.
Line: 62 to 62
 Markers that are inserted via the FieldTrip buffer are not stored in the raw data file. Therefore, markers that you need for offline processing should be inserted via the hardware instead.

Processing of incoming markers

Added:
>
>
  • HardwareMarker? .png:

  • HardwareMarker? .png:
 
META FILEATTACHMENT attachment="FTbuffer.png" attr="" comment="" date="1319198471" name="FTbuffer.png" path="FTbuffer.png" size="54340" stream="FTbuffer.png" tmpFilename="/var/tmp/CGItemp47508" user="MarjoleinVanDerWaal" version="1"
META FILEATTACHMENT attachment="MarkerRoutes.png" attr="" comment="" date="1319199246" name="MarkerRoutes.png" path="MarkerRoutes.png" size="130322" stream="MarkerRoutes.png" tmpFilename="/var/tmp/CGItemp47539" user="MarjoleinVanDerWaal" version="1"
Added:
>
>
META FILEATTACHMENT attachment="HardwareMarker.png" attr="" comment="" date="1319206305" name="HardwareMarker.png" path="HardwareMarker.png" size="115882" stream="HardwareMarker.png" tmpFilename="/var/tmp/CGItemp47650" user="MarjoleinVanDerWaal" version="2"
META FILEATTACHMENT attachment="BufferMarker.png" attr="" comment="" date="1319205864" name="BufferMarker.png" path="BufferMarker.png" size="112750" stream="BufferMarker.png" tmpFilename="/var/tmp/CGItemp47553" user="MarjoleinVanDerWaal" version="1"

Revision 521 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
Changed:
<
<

Marker Routing and Timing

>
>

Marker Routing and Timing

 
Changed:
<
<

Inserting markers in the data stream (sndMarker)

>
>

Inserting markers in the data stream

 
Changed:
<
<
Markers can be inserted in the data stream by means of the follwoing function:
sndMarker(event,<marker>,<datasource>,<delay>)
marker     = name of the marker to insert
datasource = in which data source should the marker be inserted
delay      = time in seconds before inserting this marker (WARNING: this option is only allowed when sending markers via the FieldTrip buffer) 
>
>
Data is recorded by a hardware device. BrainStream does not connect to this hardware device directly, but via a FieldTrip buffer.
 
Changed:
<
<
There are two ways to insert markers in the data stream: via the hardware or via the FieldTrip buffer. The first method is the most accurate, but the second method is slightly faster. Markers can be inserted by BrainStream itself or any of its clients. In the figure below, you can see a schematic representation of the two marker routes:
>
>
FTbuffer.png
 
Changed:
<
<
[Figure 1: Schematic of bs, ftbuffer and hardware]
>
>
Figure 1: BrainStream is connected to the hardware via a FieldTrip buffer.
 
Changed:
<
<
In the block file of your experiment, you can specify the method for inserting markers under topic device and key SendMarkerFnc:
[device]
SendMarkerFnc = 'sndBufferMarker' % send markers via FieldTrip buffer (default)
SendMarkerFnc = 'sndMidiMarker'   % send markers via hardware 
>
>
The data is recorded by the hardware and streamed to the FieldTrip buffer in small packages of a fixed number of samples. BrainStream reads the data from the buffer. Markers can be inserted in the data either via the hardware device or via the FieldTrip buffer. The first method is the most accurate, but the second method is faster. Markers can be inserted by BrainStream itself or any of its clients. In the figure below, you can see a schematic representation of the two marker routes:

MarkerRoutes.png

 
Changed:
<
<
We will now describe these two methods in more detail.

Inserting markers via the hardware

>
>
Figure 2: Markers can be inserted via the hardware or via the FieldTrip buffer.

We will now describe each of the methods of inserting markers in more detail.

Inserting markers via the hardware (bs_send_hardware_marker)

  Insert markers via the hardware if
  • you need the most accurate synchronization possible between markers and data
  • you need the markers for offline processing after the experiment is finished
Changed:
<
<
Inserting a marker in the data stream via the hardware is the most accurate method. It is recommended to insert markers via the hardware when good synchronization between the markers and the data is important, for example when the markers represent the onset of stimuli in an ERP-based BCI. In order to do this, you must specify sndMidiMarker as your SendMarkerFnc in the block file. BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.
>
>
The most accurate synchronization between markers and data is obtained when a marker is sent via the hardware. It is recommended to insert markers via the hardware when good synchronization between the markers and the data is important, for example when the markers represent the onset of stimuli in an ERP-based BCI. In order to do this, you must use the following function:
bs_send_hardware_marker(event, marker, datasource)

event      = event structure
marker     = marker name
datasource = in which data source should the marker be inserted (you may leave this empty if only one data source is used) 

BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.

  [Figure 2: timeline of sndMarker via hardware]

The marker will be inserted in the data at a certain sample number, represented as a white block in figure 2. Thus, the timing accuracy of markers inserted via the hardware corresponds to one sample. For example, at a sampling frequency of 2 kHz the timing accuracy is 0.5 ms.

Changed:
<
<
The data is sent to the FieldTrip buffer in packages of a fixed number of samples, represented in the figure as black and grey blocks. The inserted marker will be sent to the FieldTrip buffer together with the corresponding data package. The time this may take depends on the number of samples per package and the sampling rate of the device. For example, if the package size is 16 samples and the sampling rate of the hardware is 2 kHz, data and markers will be sent to the FieldTrip buffer every 8 ms. Thus, in this case it may take up to 8 ms before the marker is received by BrainStream and can be processed.
>
>
The data is sent from the hardware to the FieldTrip buffer in packages of a fixed number of samples, represented in the figure as black and grey blocks. The inserted marker will be sent to the FieldTrip buffer together with the corresponding data package. The time this may take depends on the number of samples per package and the sampling rate of the device. For example, if the package size is 16 samples and the sampling rate of the hardware is 2 kHz, data and markers will be sent to the FieldTrip buffer every 8 ms. Thus, in this case it may take up to 8 ms before the marker is received by BrainStream and can be processed.
  Markers that are inserted via the hardware must always be defined in the Dictionary table. An error occurs if the marker is not found in the Dictionary.

Only markers that are inserted via the hardware are stored in the raw data (e.g. .bdf or .gdf) file. Markers that you need after your experiment has finished, for example for offline processing, should therefore always be inserted via the hardware.

Deleted:
<
<
It is not allowed to specify a delay for markers inserted via the hardware. If a delay is specified in the sndMarker function, the marker will automatically be sent via the FieldTrip buffer, even if the SendMarkerFnc is set to 'sndMidiMarker'. If this happens, a warning will appear in the Matlab command window and in the Log file of the experiment.
 

Inserting markers via the FieldTrip buffer

Insert markers via the FieldTrip buffer if

Line: 59 to 61
  Markers that are inserted via the FieldTrip buffer are not stored in the raw data file. Therefore, markers that you need for offline processing should be inserted via the hardware instead.

Processing of incoming markers

Added:
>
>
META FILEATTACHMENT attachment="FTbuffer.png" attr="" comment="" date="1319198471" name="FTbuffer.png" path="FTbuffer.png" size="54340" stream="FTbuffer.png" tmpFilename="/var/tmp/CGItemp47508" user="MarjoleinVanDerWaal" version="1"
META FILEATTACHMENT attachment="MarkerRoutes.png" attr="" comment="" date="1319199246" name="MarkerRoutes.png" path="MarkerRoutes.png" size="130322" stream="MarkerRoutes.png" tmpFilename="/var/tmp/CGItemp47539" user="MarjoleinVanDerWaal" version="1"

Revision 421 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"

Marker Routing and Timing

Line: 11 to 11
 delay = time in seconds before inserting this marker (WARNING: this option is only allowed when sending markers via the FieldTrip? buffer)
Changed:
<
<
There are two ways to insert markers in the data stream: via the hardware or via the FieldTrip buffer. The first method is the most accurate, but the second method is slightly faster. In the figure below, you can see a schematic representation of the two marker routes:
>
>
There are two ways to insert markers in the data stream: via the hardware or via the FieldTrip buffer. The first method is the most accurate, but the second method is slightly faster. Markers can be inserted by BrainStream itself or any of its clients. In the figure below, you can see a schematic representation of the two marker routes:
  [Figure 1: Schematic of bs, ftbuffer and hardware]

Revision 320 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"

Marker Routing and Timing

Line: 7 to 7
 Markers can be inserted in the data stream by means of the follwoing function:
sndMarker(event,<marker>,<datasource>,<delay>)
marker = name of the marker to insert
Changed:
<
<
datasource = in which data source should the marker be injected
>
>
datasource = in which data source should the marker be inserted
 delay = time in seconds before inserting this marker (WARNING: this option is only allowed when sending markers via the FieldTrip? buffer)
Line: 38 to 38
  Markers that are inserted via the hardware must always be defined in the Dictionary table. An error occurs if the marker is not found in the Dictionary.
Changed:
<
<
Only markers that are inserted via the hardware stored in the raw data (e.g. .bdf or .gdf) file. Markers that you need after your experiment has finished, for example for offline processing, should therefore always be inserted via the hardware.
>
>
Only markers that are inserted via the hardware are stored in the raw data (e.g. .bdf or .gdf) file. Markers that you need after your experiment has finished, for example for offline processing, should therefore always be inserted via the hardware.
  It is not allowed to specify a delay for markers inserted via the hardware. If a delay is specified in the sndMarker function, the marker will automatically be sent via the FieldTrip buffer, even if the SendMarkerFnc is set to 'sndMidiMarker'. If this happens, a warning will appear in the Matlab command window and in the Log file of the experiment.

Inserting markers via the FieldTrip buffer

Line: 47 to 47
 
  • synchronization between the markers and the data is less important
  • you don't need the markers for offline processing
Changed:
<
<
Inserting a marker in the data stream via the FieldTrip buffer is faster than inserting markers via the hardware. However, the synchronization between these markers and the data is less accurate. In order to insert markers like this, you must specify sndBufferMarker as your SendMarkerFnc in the block file. BrainStream sends the marker to the FieldTrip buffer, where it will be synchronized with the data as accurately as possible.
>
>
Inserting a marker in the data stream via the FieldTrip buffer is faster than inserting markers via the hardware. However, the synchronization between these markers and the data is less accurate. In order to insert markers like this, you must specify sndBufferMarker as your SendMarkerFnc in the block file. BrainStream sends the marker to the FieldTrip buffer, where it will be approximately synchronized with the data.
  [Figure 3: timeline of sndMarker via buffer]

Revision 219 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="BrainStreamDocs"
Changed:
<
<

How BrainStream processes markers

>
>

Marker Routing and Timing

 
Changed:
<
<

Inserting markers in the data stream

>
>

Inserting markers in the data stream (sndMarker)

 
Changed:
<
<
It is useful to insert markers in the data stream at important moments in the experiment, for example every time a stimulus is presented to the subject.
>
>
Markers can be inserted in the data stream by means of the follwoing function:
sndMarker(event,<marker>,<datasource>,<delay>)
marker = name of the marker to insert
datasource = in which data source should the marker be injected
delay = time in seconds before inserting this marker (WARNING: this option is only allowed when sending markers via the FieldTrip buffer) 
 
Changed:
<
<
There are two ways of inserting markers in the data stream: via the hardware or via the FieldTrip buffer. The first method is the most accurate, but the second method is slightly faster.
>
>
There are two ways to insert markers in the data stream: via the hardware or via the FieldTrip buffer. The first method is the most accurate, but the second method is slightly faster. In the figure below, you can see a schematic representation of the two marker routes:
  [Figure 1: Schematic of bs, ftbuffer and hardware]
Added:
>
>
In the block file of your experiment, you can specify the method for inserting markers under topic device and key SendMarkerFnc:
[device]
SendMarkerFnc = 'sndBufferMarker' % send markers via FieldTrip buffer (default)
SendMarkerFnc = 'sndMidiMarker'   % send markers via hardware 
 We will now describe these two methods in more detail.

Inserting markers via the hardware

Changed:
<
<
Inserting a marker in the data stream via the hardware is the most accurate method. In order to do this, you must specify sndMidiMarker as your sndMarkerFnc function. BrainStream will send the marker to the hardware device, where it will be injected into the status channel. Together with the data, the markers that are inserted like this return to BrainStream via the FieldTrip buffer.
>
>
Insert markers via the hardware if
  • you need the most accurate synchronization possible between markers and data
  • you need the markers for offline processing after the experiment is finished

Inserting a marker in the data stream via the hardware is the most accurate method. It is recommended to insert markers via the hardware when good synchronization between the markers and the data is important, for example when the markers represent the onset of stimuli in an ERP-based BCI. In order to do this, you must specify sndMidiMarker as your SendMarkerFnc in the block file. BrainStream will send the marker via the MIDI route to the hardware device, where it will be injected into the status channel. Together with the data, markers that are inserted like this return to BrainStream via the FieldTrip buffer.

  [Figure 2: timeline of sndMarker via hardware]
Changed:
<
<
The marker will be inserted at a certain sample number (white block in the figure). The data is transmitted to the FieldTrip buffer in blocks of a fixed number of samples, represented in the figure as black and grey blocks. The inserted marker will travel with the data to the FieldTrip buffer as soon as the next block of samples is sent. The time this may take depends on the size of the sample blocks. For example, if the block size is 16 samples and the sampling rate of the hardware is 2000 Hz, data will be sent to the FieldTrip buffer every 8 ms.
>
>
The marker will be inserted in the data at a certain sample number, represented as a white block in figure 2. Thus, the timing accuracy of markers inserted via the hardware corresponds to one sample. For example, at a sampling frequency of 2 kHz the timing accuracy is 0.5 ms.

The data is sent to the FieldTrip buffer in packages of a fixed number of samples, represented in the figure as black and grey blocks. The inserted marker will be sent to the FieldTrip buffer together with the corresponding data package. The time this may take depends on the number of samples per package and the sampling rate of the device. For example, if the package size is 16 samples and the sampling rate of the hardware is 2 kHz, data and markers will be sent to the FieldTrip buffer every 8 ms. Thus, in this case it may take up to 8 ms before the marker is received by BrainStream and can be processed.

Markers that are inserted via the hardware must always be defined in the Dictionary table. An error occurs if the marker is not found in the Dictionary.

Only markers that are inserted via the hardware stored in the raw data (e.g. .bdf or .gdf) file. Markers that you need after your experiment has finished, for example for offline processing, should therefore always be inserted via the hardware.

It is not allowed to specify a delay for markers inserted via the hardware. If a delay is specified in the sndMarker function, the marker will automatically be sent via the FieldTrip buffer, even if the SendMarkerFnc is set to 'sndMidiMarker'. If this happens, a warning will appear in the Matlab command window and in the Log file of the experiment.

 

Inserting markers via the FieldTrip buffer

Deleted:
<
<

Marker timing

 \ No newline at end of file
Added:
>
>
Insert markers via the FieldTrip buffer if
  • synchronization between the markers and the data is less important
  • you don't need the markers for offline processing

Inserting a marker in the data stream via the FieldTrip buffer is faster than inserting markers via the hardware. However, the synchronization between these markers and the data is less accurate. In order to insert markers like this, you must specify sndBufferMarker as your SendMarkerFnc in the block file. BrainStream sends the marker to the FieldTrip buffer, where it will be synchronized with the data as accurately as possible.

[Figure 3: timeline of sndMarker via buffer]

The actual insertion time of the marker relative to the data is represented as a white block in figure 3. However, in the FieldTrip buffer, the marker will be treated as if it arrived together with the most recent data package. As described above, with a data package size of 16 samples and a hardware sampling rate of 2 kHz, the marker can appear to have been inserted up to 8 ms earlier than it actually was. Thus, the timing accuracy of markers inserted via the FieldTrip buffer (8 ms) is less accurate than that of markers inserted via the hardware (0.5 ms). However, markers that are sent to the FieldTrip buffer can immediately be processed by BrainStream without having to wait for a data package update.

For markers sent via the FieldTrip buffer, a delay can a be specified as a fourth input argument for the sndMarker function.

If markers that are sent via the FieldTrip buffer are not defined in the Dictionary table, BrainStream will internally assign a type and value for these markers. Nevertheless, it is better to specify all markers in the Dictionary table yourself.

Markers that are inserted via the FieldTrip buffer are not stored in the raw data file. Therefore, markers that you need for offline processing should be inserted via the hardware instead.

Processing of incoming markers

Revision 119 Oct 2011 - Main.MarjoleinVanDerWaal

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="BrainStreamDocs"

How BrainStream processes markers

Inserting markers in the data stream

It is useful to insert markers in the data stream at important moments in the experiment, for example every time a stimulus is presented to the subject.

There are two ways of inserting markers in the data stream: via the hardware or via the FieldTrip buffer. The first method is the most accurate, but the second method is slightly faster.

[Figure 1: Schematic of bs, ftbuffer and hardware]

We will now describe these two methods in more detail.

Inserting markers via the hardware

Inserting a marker in the data stream via the hardware is the most accurate method. In order to do this, you must specify sndMidiMarker as your sndMarkerFnc function. BrainStream will send the marker to the hardware device, where it will be injected into the status channel. Together with the data, the markers that are inserted like this return to BrainStream via the FieldTrip buffer.

[Figure 2: timeline of sndMarker via hardware]

The marker will be inserted at a certain sample number (white block in the figure). The data is transmitted to the FieldTrip buffer in blocks of a fixed number of samples, represented in the figure as black and grey blocks. The inserted marker will travel with the data to the FieldTrip buffer as soon as the next block of samples is sent. The time this may take depends on the size of the sample blocks. For example, if the block size is 16 samples and the sampling rate of the hardware is 2000 Hz, data will be sent to the FieldTrip buffer every 8 ms.

Inserting markers via the FieldTrip buffer

Marker timing

 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback