Добавил:
kiopkiopkiop18@yandex.ru t.me/Prokururor I Вовсе не секретарь, но почту проверяю Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Ординатура / Хирургия / Библиотека им академика М.И. Перельмана / Книга_6027_Библиотеки_им_академика_М_И_Перельмана.pdf
Скачиваний:
0
Добавлен:
31.08.2026
Размер:
29 Мб
Скачать
21 Online Processing 273
classication. Depending on the platform, the options can be numerous. Avail­able platforms include OpenViBE (Renard et al., Jolla,
CA), or BCI2000 (Schalk et al., 2004).
2010), NeuroPype (Intheon, La
. If none of the above options provide the right composition, the ultimate option
be to ask the manufacturer for a software development kit (SDK) or
would application programming interface (API) that allows a knowledgeable software developer to create their own applications. This facilitates conguring the EEG amplier, acquiring data from the amplier, and processing data immediately in the application to generate feedback online. A typical example of how such an SDK can be used might just be to create an LSL con nector.

21.2.2 How to Work with Raw Data Online

The chosen method for getting raw data might already pre-determine how you work with the data. However, there might still be options available to you.
. If the manufacturers own software package is used for accessing the raw data,
chances example, when using BrainVision Recorder with RDA, the complementary BrainVision RecView can be used to work with the data online and to select different lters for further processing.
. When using one of the openly available protocols, such as LSL, there are often
plugins example, can be easily incorporated in Python, MATLAB these languages, it is then possible to write signal processing code or rely on readily available code from the community. The specics of the individual programming languages should be considered with respect to the planned processing steps. For example, if a very high processing speed is required, C++ might be better suited than Python or MATLAB other factors playing a role in the nal decision.
. Stand-alone platforms often provide signal processing nodes and may even
include are not enough.
. Developers who are using the SDK typically also have the means to write their
own
are high that there is also a tool available for online data processing. For
available for the major programming or scripting languages. LSL, for
®
®
, C++, or C#. Using
, but of course there may be
options for running users custom code in case the provided algorithms
code following data acquisition.

21.2.3 What Factors to Consider for Online Processing

Depending on the requirements, different factors can play a role in deciding which kind of hardware and/or software to use. Here, we focus mainly on factors that inuence online processing rather than providing a recipe that could bias the reader
274 A. Kreilinger and A. Ojeda
toward an EEG amplier, accessory, or software to use. To learn more about hardware and software, refer to Chap. Periph
eral Physiology and Chap. 13: Software for Recording EEG and Peripheral
logy. Asking yourself the following questions will help you determine what is
Physio
12: Hardware for Recording EEG and
right for your study:
. Is it a mobile or stationary recording? This affects the decision whether to choose
a wireless or cable-bound recording setup. While it is possible for participants to carry around portable computers, it is more convenient to go for a wireless connection in such cases. Factors relevant to the online processing are the potential additional delay that is caused by using wireless transmission, such as Bluetooth
®
. An obvious drawback is the potential loss of the connection between transmitter and receiver. Wireless transmission also limits the capacity of data that can be sent. This can be dictated by the technology itself (e.g., Bluetooth low energy with a potent ial data rate of ~1 Mbps) or by the necessary amount of power to increase the WiFi data rate, which would drain the batteries of a mobile amplier quickly. That said, high channel counts with high sampling rates are usually only provided by stationary, cable-bound ampliers.
. How fast and how precise are the timing requirements? Before deciding on a
piece
of equipment, it is important to know what kind of latencies and jitters are to be expected when accessing the data streams online. Depending on the drivers, the use of cables versus wireless transmission, and data protocol, these parameters can have severe effects on the further signal processing pipeline and feedback loop. For ofine analyses, it usually does not matter if the signal is recorded with a large latency, as long as the relevant event markers are synchronized and come with the same latency. For online processing, this can become a big problem depending on the goals of the experiment. For example, for closed-loop systems, where the feedback must be provided within a time-critical constraint, it is important to have access to the data as fast as possible. Here, the word real­time can become relevant if a real-time operating system or environment is available. If that is not the case, the alternative must be that data can be typically accessed within a very short amount of time. Examples are the BrainVision TurboLink that sends data from an actiCHamp Plus EEG-amplier in under
1.5 ms. This can be linked to a bossdevice from sync2brain (Lieb et al.,
is running on a real-time operating system and uses an estimate of the next
that
2023)
alpha wave cycle to trigger TMS pulses accordingly. Requirements can be a bit looser for less timing-sensitive scenarios, but typical criteria include a recom­mendation for low latency and low jitter. It is good practice to test such param­eters before running measurements or at least to acquire the information beforehand.
. What is the nature of the acquired signal? In some cases, signals can only be
accessed in an altered manner, for example, with mandatory temporal and/or spatial lters. Depending on the signal of interest, this can be problematic when important signal components are already attenuated by the lters. Ideally, signals can be ac cessed as raw as possible.
®
21 Online Processing 275
. How well can contextual information and other measurements of interest be
synchronized with the brain signals online? This question is a bit dependent on
previous questions and on how the raw data is accessed in the rst place. For example, when event markers need to be stored together with the EEG, a trigger solution that connects on a hardware level might already be good enough, but as soon as other modalities or markers need to be supplied on a software level, other considerations might be necessary. For example, it is worth checking whether there are LSL connectors already available for the other modality (e.g., reading just the mouse cursor or even other biosignals such as functional near-infrared spectroscopy (fNIRS)). For more information on how to synchronize signals and events, refer to Chap.
14: Triggers.

21.3 Designing an Online Processing Experiment, an Example

We summarize the chapter by presenting considerations for a hypothetical experi­ment conceived to use online processing. In this experiment, the user will try to control a BCI based on motor imagery using EEG. The BCI shall use two classes and be able to control different actions in a computer game depending on the current context. In the steps that follow, we provide guidance on selecting appropriate hardware and software, as well as general considerations for conducting the BCI experiment. See also Fig. 21.2 for more information.
1. Choosing the hardware: in this case, the criteria include channel count, coverage
of
the relevant area of the brain, data quality, and sampling rate, and importantly, how raw data can be accessed online. In this specic case, the requirements are not very exclusive. One should just make sure to use a solution that provides good quality data, a full coverage of the whole head (~32 channels) or the possibility of a exible montage for covering the motor area required for motor imagery. Make sure you have a high enough sampling rate. This should not be an issue for motor imagery where a typical 500 Hz sampling rate is high enough to record all frequency bands of interest. The raw data access feature is also relevant for the next part.
2. Choosing
the software. Often, the selected hardware comes with different options for accessing the raw data. Depending on the further steps and how the feedback needs to be created, these details become relevant here. The software not only has to be able to read the data but also needs to analyze and classify the signals before any kind of feedback can be reported in any modality (visual, acoustic, or tactile). Nowadays, one can rely on a large community that provides an abundance of information on signal processing for all kinds of different purposes. For example, code packages can be used based on Python or MATLAB
®
, but also other software platforms provide many options for online processing with the focus lying more on the feedback part, such as Unreal Engine (Sakhani et al., 2024) o
r
276 A. Kreilinger and A. Ojeda
Fig. 21.2 Selection of possible choices when designing an experiment and deciding what kind of hardware and software to use. The choices can be affected by many different factors (e.g., project­related requirements, personal experience, or simply by having access to specic equipment). In this example, the selected setup for the experiment is driven by practical considerations such as reputation and availability in the lab, but also the fulllment of certain requirements, such as the electrode and amplier type, data quality, sampling rate, and number of channels. Raw data can be accessed via an LSL connector provided by the manufacturer, and a mix of E-Prime MATLAB EEG and Peripheral Physiology and Chap. Physiology for more information
®
is used to train, visualize, and analyze data. Refer to Chap. 12: Hardware for Recording
13: Software for Recording EEG and Peripheral
®
and
Unity (for example, via LSL3 ). Of course, it is also an option to use an all-in-one solution such as OpenViBE.
3. Once these decisions are nalized, the preparation of the experiment can begin. Ideally, the rst training sessions are simulated and analyzed. Then, participants can be brought in for the rst pilot sessions. If classiers need to be created, it must be considered that these cannot be applied to the data in the same way as ofine. Again, it might be necessary to change lter settings and make sure to be aware of the constraints when only short amounts of data can be analyzed and that, ideally, the processing can be repeated frequently. If the processing power is insufcient to do this at every sample, it may be necessary to run the process in frames where data is only analyzed in steps of multiple samples.
3
https://github.com/labstreaminglayer/LSL4Unity
21 Online Processing 277

21.4 Conclusion

In this chapter, we introduced the concept of online EEG data processing and discussed its relevance in scenarios where ofine analysis is insufcient. We outlined various methods for access ing raw EEG data during acquisition, including manufacturer-specic solutions, open-source data streaming tools, and integrated platforms that combine data access with processing, visualization, and storage capabilities. Key considerations for selecting appropriate hardware and software components were highlighted, particularly in relation to the demands of (near) real-time experimental setups. Throughout, we emphasized the importance of pre­cise terminologyclarifying distinctions between online, real-time, and near real- time processingand discussed how these terms relate to system capabilities and constraints. Furthermore, we examined the limitations imposed by online processing on analysis pipelines, such as the inability to apply bidirectional lters or to reference future data. These considerations were illustrated through the design of a BCI paradigm, demonstrating the practical steps and trade-offs involved in planning an online experiment.

References

Arvaneh, M., Ward, T. E., & Robertson, I. H. (2015). Effects of feedback latency on P300-based
brain-computer interface. In 2015 37th annual international conference of the IEEE Engineer- ing in Medicine and Biology Society (EMBC) (pp. 2315–2318).
2015.7318856
Breitwieser, C., Daly, I., Neuper, C., & Müller-Putz, G. R. (2012). Proposing a standardized
protocol 59(3), 852–859. https://doi.org/10.1109/TBME.2011.2174637
Enriquez-Geppert, S., Huster, R. J., & Herrmann, C. S. (2017). EEG-neurofeedback as a tool to
modulate
https://doi.org/10.3389/fnhum.2017.00051
Kothe, C., Shirazi, S. Y., Stenner, T., Medine, D., Boulay, C., Grivich, M. I., et al. (2025). The lab
streaming
10.1162/IMAG.a.136
Lieb, A., Zrenner, B., Zrenner, C., Kozák, G., Martus, P., Grefkes, C., & Ziemann, U. (2023).
Brain-oscillation-synchronized
s12883-023-03235-1
Renard, Y., Lotte, F., Gibert, G., Congedo, M., Maby, E., Delannoy, V., et al. (2010). OpenViBE:
An open-source software platform to design, test, and use brain–computer interfaces in real and virtual environments. Presence Teleoperators and Virtual Environments, 19(1), 35–53. https://
doi.org/10.1162/pres.19.1.35
Sakhani, S., Gattringer, V., Schmied, M., Pirker, J., & Wriessnegger, S. C. (2024). The inuence
of Multimodal Technologies and Interaction, 8(11), 104.
Schalk, G., McFarland, D. J., Hinterberger, T., Birbaumer, N., & Wolpaw, J. R. (2004). BCI2000:
A Engineering, 51(6), 1034–1043. https://doi.org/10.1109/TBME.2004.827072
Sherlin, L.
Neurofeedback and basic learning theory: Implications for research and practice. Journal of Neurotherapy, 15(4).
for raw biosignal transmission. IEEE Transactions on Biomedical Engineering,
cognition and behavior: A review tutorial. Frontiers in Human Neuroscience, 11.
layer for synchronized multimodal recording. Imaging Neuroscience. https://doi.org/
stimulation. BMC Neurology, 23(204). https://doi.org/10.1186/
realism on the sense of presence in virtual reality: Neurophysiological insights using EEG.
general-purpose brain-computer interface (BCI) system. IEEE Transactions on Biomedical
H., Arns, M., Lubar, J., Heinrich, H., Kerson, C., Strehl, U., & Sterman, M. B. (2011).
https://doi.org/10.1080/10874208.2011.623089
https://doi.org/10.1109/EMBC.
https://doi.org/10.3390/mti8110104
Chapter 22
Quantifying EEG and ERP Data Quality
Steven J. Luck
Abstract We can record brain activity (the electroencephalogram or EEG) from
electrodes the brain. However, the signals we record this way are often contaminated by noise and artifacts that are an order of magnitude larger than the EEG signals of interest. It is therefore essential to pay close attention to the quality of the data in order to obtain stable, meaningful, and statistically signicant effects. Until recently, howe ver, there was no widely accepted method for quantifying data quality for EEG signals, especially for the event-related potentials (ERPs) embedded within the EEG. In this chapter, I describe a new metric of ERP data quality, called the standardized measurement error (SME). I provide an intuitive description of how it works and then I provide examples of how it has been used to quantify data quality across several common ERP paradigms and to determine which EEG and ERP processing operations do the best job of maximizing data quality. I also describe how the SME can be extended to time-frequency analyses and how psychometric measures of reliability can be used to assess data quality in studies that focus on individual differences.
on the scalp, even though the skull and scalp separate the electrodes from
Keywords ERPs · Event-related potentials
· Analysis methods

22.1 Introduction

It seems like a miracle that we can record meaningful brain activity from electrodes placed on the scalp, with the meninges, skull, fat, and skin between the neurons and our electrodes. The brain signals of interest are often only a microvolt or two on the scalp, and these signals are embedded within noise that is typically an order of magnitude larger. For example, Fig.
participant in an oddball experiment (Fig.
single
S. J. Luck (*) Center for Mind & Brain and Department of Psychology, University of California, Davis, Davis, CA, USA e-mail:
sjluck@ucdavis.edu
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2026 T.
Warbrick (ed.), The EEG Handbook,
https://doi.org/10.1007/978-3-032-20450-9_22
22.1 shows the averaged ERP waveform from a
22.1a) along with the 20 single-trial
279
280 S. J. Luck
A Averaged ERP from a single subject
Mean = 7.66 μV
P3
aSME / = 1.28 µV
B Single-trial EEG epochs
SD = 5.73 μV
C Precision, Accuracy, & Bias
High
Precision
Low
Precision
High Accuracy
(Low Bias)
Weight
Weight
Low Accuracy
(High Bias)
D P3 amplitude scores from 10,000
repetitions of the experiment
}
distribution
= 1.3 μV
True
Weight
True
Weight
=
of this
Fig. 22.1 (a) Averaged ERPs for the oddball trials for one participant in an oddball experiment in which each participant pressed one button for frequently occurring digits and another button for rarely occurring letters (or vice versa). Time zero is stimulus onset. (b) Single-trial EEG epochs from the oddball trials that were averaged together to create the waveform in panel A. If the amplitude of the P3 wave is scored as the mean voltage between 300 and 500 ms in the averaged ERP waveform, the analytic standardized measurement error (aSME) can be computed by measur­ing the mean voltage between 300 and 500 ms in the single-trial EEG epochs and applying the equation shown between panels A and B. (c) Illustration of the concepts of precision, accuracy, and bias for measuring the weight of an object. (d) Conceptual approach for understanding the SME, in which the same participant is tested in 10,000 different replications of the oddball experiment (assuming no fatigue or learning). For each replication, the oddball trials are averaged together, and the mean voltage between 300 and 500 ms is measured from the averaged ERP waveform. The histogram shows the P3 amplitude scores obtained from each of these 10,000 replications. The SME is the standard deviation (SD) of these 10,000 scores.
EEG epochs that were averaged together to create the averaged ERP waveform for the oddballs (Fig. EEG
that is not obvious from the averaged ERP waveform, with a clear P3
22.1b). There is clearly tremendous trial-to-trial variability in the
component in the averaged ERP that is difcult to see in the single-trial EEG epochs.
When I rst started running EEG/ERP experiments about 40 years ago, my data
looked a lot like the waveforms shown in Fig. 22.1, but I had no idea whether the amount of trial-to-trial EEG variability I was seeing was normal.And I had no idea whether I had enough trials to obtain a stable averaged ERP waveform given this amount of EEG variability. I desperately wished that I had a metric of data quality that would allow me to determine whether my EEG and ERP waveforms were sufciently clean. I kept looking in the EEG/ERP literature for data quality metrics,
22 Quantifying EEG and ERP Data Quality 281
but I never found one that seemed very useful. After several decades, I gave up on looking for an existing metric of data quality, and I worked with a set of collabora­tors to develop one (Luck et al., (Lopez-C quality psychophysiological measures.
use them in your own research. A good metric of data quality can quantify how much statistical power you have lost because of the noise in your single-trial EEG epochs and how much power you could gain by increasing the number of trials. It can help you decide which trials to reject and which channels to interpolate. It can tell you which preprocessing techniques work best to increase your data quality and improve your statistical power. And it can provide you with information about whether the data from a given participant or a given dataset has too much noise to be believable.
alderon & Luc k, 2014). In the process, I learned about additional data
metrics that can be used for ERPs, time-frequency analyses, and other
The goal of this chapter is to explain these metrics of data quality so that you can
2021) and implement it in ERPLAB Toolbox
22.1.1 Dening Data Quality
Before we can discuss metrics of data quality, we need to spend a moment consid­ering what we mean by the term data quality. When we measure a simple physical quantity, such as the weight of an object, the quality of the measurement is classically dened in terms of accuracy (or bias) and precision. This is illustrated graphically in Fig. 22.1c for the measurement of weight; we assume that the true weight does not change across measurement attempts. A meas urement is accurate if the average measurement across many measurement attempts is close to the true value (e.g., the true weight in Fig. 22.1c). Bias is the converse of accuracy: a meas
urement is biased if it is systematically shifted in a specic direction away from the true value. Precision reects the spread of values across measurement attempts. A measurement method is precise if we get similar values on each measurement attempt. A measurement method can be accurate without being precise (e.g., a broad spread of values, but with an average near the true value), and it can be precise without being accurate (e.g., a narrow spread of values, all of which are systematically shifted away from the true value). Or it can be both accurate and precise, or both inaccurate and imprecise.
In this chapter, I will dene data quality in terms of precision, not accuracy or bias, because precision is more related to the concept of how noisya dataset is. Accuracy and bias are important, but they usually become an issue during the process of scoring the amplitude or latency of an ERP component. Rather than trying to quantify accuracy/bias, a common approach is to use amplitude or latency quantication algorithms that are mathematically guaranteed to be unbiased (see Chapter 9 in Luck,
d also like to distinguish between a measurement and a score. I like to
I woul dene a measurement as a quantication of a simple physical quantity, such as the raw EEG voltage at a particular moment in time. I then dene a score as a value that
2014).
282 S. J. Luck
we compute by applying an algorithm to a set of measurements, such as the peak amplitude of the voltage between 300 and 500 ms in the averaged ERP waveform or the power between 8 and 12 Hz in a Fourier transform of a single-trial EEG epoch. In this chapter, we will focus on the data quality of scores, not measurements, because the scores are what you use as the dependent variables in your statistical analyses and use to test your scien ti c hypotheses. The precision of the measureme used to compute a score contributes to the precision of the score, so the precision of a score re ects measurement precision as well as higher-order factors such as artifacts. Thus, for the purposes of this chapter, data quality is dened as the precision of a score.
nts that are

22.1.2 Chapter Overview

Now that I have dened what I mean by data quality, we can move on to discuss how data quality can be quantied. The next section will provide a detailed description of the metric of data quality that my lab developed for averaged ERPs, called the standardized measurement error or SME (Luck et al., by
examples of SME values from actual experiments, a discussion of how SME is related to statistical power, and concrete examples of how the SME can be used to improve ERP research. The SME is appropriate only when scores are obtained from averaged ERPs, but later sections of the chapter will describe how the SME could be readily extended to time-frequency analysis and other psychophysiological measures based on averages, and how metrics of reliability can be used to quantify data quality in research on individual differences.
2021). This will be followed
22.2 Quantifying Data Quality in Averaged ERPs
with the Standardized Measurement Error (SME)
22.2.1 A Simple Case: Analytic SME for Time-Window Mean
Amplit
Im going to start with a simple but common case, in which the amplitude of an ERP component is scored from an averaged ERP waveform as the mean voltage within a measurement window, as illustrated in Fig.
The data Luck (2010), with 80 standard trials and 20 oddball trials. Panel A shows the averaged the 20 EEG epochs that were averaged together to compute this averaged waveform. In this experiment, the amplitude of the P3 wave was scored as the mean voltage between 300 and 500 ms in the averaged ERP waveform, yielding a value of
7.66 μV.
ERP waveform for the oddballs in one participant, and Panel B shows
ude Scores
22.1a, b.
in the gure were taken from the oddball experiment of Kappenman and
22 Quantifying EEG and ERP Data Quality 283
When we score an amplitude from an averaged ERP waveform as the mean voltage across a time window, this is typically called the mean amplitude scoring method. However, this term can be confusing, because it involves both a mean across trials (when creating the averaged ERP waveform) and a mean across time points. As a result, I like to refer to it as the time-window mean amplitude scoring method to emphasize that it is a mean across time points.
This scoring method is unbiased (Luck et al., 2021). Thus, if we averaged
er an innite number of trials and measured the time-window mean amplitude
togeth from this averaged ERP waveform, we would obtain the true value for this partic­ipant. But how close to the true value is the score of 7.66 μV that we obtained from an average of only 20 trials? Informally, we can think of data quality as being an indicator of how much condence we have that the score obtained from a given participant is close to the true score (i.e., the score we would obtain if we had an innite number of trials).
Consequently, the data quality is inversely related to the amount of trial-to-trial varia
bility in the single-trial EEG epochs. If the time-window mean amplitude in the single-trial epochs is similar from trial to trial, then the value we get from an average of 20 trials should be pretty close to the value we would get from average of an innite number of trials. But if the time-window mean amplitude varies a great deal from trial to trial, then the value obtained from an average of 20 trials might be quite different from the true value. So, our rst step in quantifying the data quality for the time-window mean amplitude from the averaged ERP waveform is to obtain time­window mean amplitude from each single-trial epoch and quantify the variability as the standard deviation (SD) of these single-trial values.
I did this for the 20 single-trial EEG epochs in Fig. 22.1b, and I obtained an SD of
μV. This is a useful value that tells me something important about the data
5.73 quality of the EEG, but my ultimate goal is to quantify the precision of the time­window mean amplitude score I obtained from the averaged ERP waveform. I would have a perfectly precise score if the averaged ERP was computed from an innite number of trials, and it seems obvious that the precision will decline as I have fewer and fewer trials. Thus, we need to take into account the number of trials that are being averaged together (which we denote N ). Mathematically, the precision of a time-window mean amplitude value obtained from an averaged ERP waveform is directly related to the square root of N.
This brings us to how we compute our measure of data quality for averaged ERPs,
the
standardized measurement error (SME). The SME for a time-window mean amplitude score obtained from an averaged ERP waveform is simply the SD of the time-window mean amplitude values obtained from the single-trial EEG epochs divided by the square root of N. For reasons I will describe late r, we call this the
analytic SME or aSME, and it is dened as
aSME ¼ SD
p
N
22:1Þ
ð