Skip to content

Source Localization (sLORETA)

An example pipeline used for source localization using the sLORETA method is named SourceEstimation sLORETA.pyp and can be found in the examples\ folder. The purpose of this pipeline is to estimate neural activity on the brain surface from EEG sensor readings. This estimate is also call the Current Source Density or CSD. Different methods can be used for this, and sLORETA is one option (another similar one would be eLORETA).

The brain activity can then be used to drive, for instance, visualizations, as shown in this pipeline, or alternatively one can estimate the activity in one or more regions of interest (ROIs), and then perform further processing of those ROI time series, for instance to drive neurofeedback or brain-computer interfaces.

The following figure shows the main pathway of the pipeline:

image alt text

The operation of this pipeline can be divided into the following stages, which will be discussed in the following: data acquisition, pre-processing, source estimation, source processing, and output.

Data Acquisition

This pipeline receives EEG data from the lab streaming layer using the LSL Input node, which is here fed by the three playback nodes at the bottom of the pipeline. To use an actual live EEG system, you can remove these three nodes, and edit the LSL input node's Query parameter into the string type='EEG' instead. See also documentation of that node for further information.

Preprocessing

What follows is the essential pre-processing of the EEG data to make it fit for use in source estimation. First, we need to remove any channels that are not EEG, since these would otherwise throw off the rest of the pipeline. This can be accomplished using the Select Range pipeline. Double-click it to check the current settings, which will open a dialog like the following.

image alt text

Here we remove the last 5 channels of the data, which in this case happen to be garbage channels, such as accelerometer, trigger, and so on.

Since we need to localize signals based on the activity in the EEG channels, we need to know the 3d locations of the channels. The Assign Channel Locations node will look up the default locations for the EEG channel labels. If your labels are in the international 10-20 system, this will work out of the box. If you have custom labels, you may need to have a custom lookup table for your headset and label system, which can be found in the NeuroPype Enterprise\resources\montages folder. If your EEG data stream is already annotated with 3d location meta-data because the LSL driver took care of it, you are lucky and this node will do nothing.

Next, we remove slow drifts and electromagnetic noise using a FIR filter. Following this filter you could also insert various artifact removal nodes. We also decimate here the signal to a lower sampling rate, to speed up processing of the source-space time series, which can be quite computationally demanding due to the large number of sources to deal with. Have a look at the documentation of the Decimate node -- it will tell you that it needs to be preceded by a FIR lowpass or bandpass filter that removes high frequencies that are no longer representable after decimation, this is called anti-aliasing, and is the other reason for the FIR filter.

The last, and one of the most important, pre-processing steps is re-referencing. This is required here because the source localization method happens to make the assumption that the EEG has been re-referenced in a certain way (specifically, common-average referenced, which means that the average of all channels has been subtracted from each channel). If the data had been re-referenced in any other way, the source localization would be off and give incorrect results. Note that you can ignore however your EEG coming out of the amplifier was originally referenced if you then re-reference the way you need it, as done here.

Source Estimation

Source estimation here is done by a single node, the sLORETA node. This node has one main option, namely the head model to use. The NeuroPype Suite ships with a standard head model based on the Colin27 brain, which is set as the model to use in this pipeline. There is also a tunable parameter that can be used to adjust the smoothness of the source reconstruction. There is also an experimental feature that allows to adapt the headmodel to channel labels and locations that are not in the 10-20 system, using the interpolate checkbox. If this applies to you, be sure to read the parameter's documentation before you use it.

Source Processing

The next few steps show some basic exemplary source-level processing -- these nodes operate on a time series that has one channel for each source location in the brain, which, in the case of this head model, happens to be the vertices of a mesh that follows the brain surface (totaling to over 4000 vertices). The source processing done here is simply calculating the moving-window variance in a particular frequency band of interest, and is shown below:

image alt text

In essence, we apply an IIR filter to select a frequency band of interest (here the 8-12 Hz 'alpha' band that is known to capture a type of brain idle activity), and then we square the signal (i.e., each value in the time series), take a moving average (also known as running mean), which gives us the variance of the signal in a sliding window (normally the variance would require subtracting the mean, but here we know that it is approximately zero, since any slow drifts of the signal have been suppressed by the frequency bandpass filter). Finally, we take the square root, which gives us the standard deviation, or root-mean-square (RMS) signal for each source location.

This is merely an example of the many things that could be calculated on the source-space representation. Some other computations would be to calculate the average activity in selected regions of interest, which results in a far lower-dimensional (and thus easier to work with) signal, and then to compute various metrics of these ROI time courses. Some applications of this are found in the ROIBandPowerEstimation, ROISpectralPowerEstimation, and ConnectivityEstimation example pipelines.

Output

Finally, we output the resulting signal. Here, we both visualize it on a 3d plot of the brain surface using the CortexActivity node, and we also send it out over LSL so that it can be picked up in another application for further use. The CortexActivity node has a crucial parameter that sets the color scale -- if you change the type of EEG system, you will very likely have to adapt this number to bring the colors into a reasonable range.

Copyright (c) Syntrogi Inc. dba Intheon. All Rights Reserved.