[FieldTrip] Using Fieldtrip with LabStreamingLayer for online BCI Processing

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Jun 5 08:51:53 CEST 2019


Hi Eli,

The high level FieldTrip functions spend a lot of time bookkeeping the data. If you know what you’re doing, and speed is what you’re after, I’d recommend tapping into the functionality one level down. For instance, for time domain signal processing you could directly tap into the functions that are located in the ‘preproc’ folder. These have a well defined API, so using them is quite straightforward.

Best wishes,
Jan-Mathijs


On 4 Jun 2019, at 16:47, Eli Kinney- Lang <eli.kinneylang at ucalgary.ca<mailto:eli.kinneylang at ucalgary.ca>> wrote:

Hi all,

  I have been using Fieldtrip for the past few years for my offline EEG analysis, with good success. Recently, I have switched to helping build and design some online brain-computer interface systems and was looking toward Fieldtrip to handle the signal processing aspect in real-time. However, I am having some trouble with getting the online EEG processing to work as I'd like. I was wondering if any of you could provide some guidance on getting started (and potentially optimization areas) for the online EEG analysis from Fieldtrip, based on our setup below.

Details:
We are using the LabStreamingLayer (LSL) synchronization system to read in raw EEG data from a g.tec USB amplifier. I know that Fieldtrip has its own online buffer, but for various reasons we'd prefer to use the LSL system to link together our EEG recording, Matlab processing, stimulus input/output.
Data from the amplifier is brought in to Matlab through LSL, providing raw Chan X Sample data. We are establishing the header for Fieldtrip ourselves, inputting the required points to use the ft_datatype_raw format. We have to use the raw datatype as the header information output is not in Fieldtrip's standard format.  This allows us to run ft_preprocessing after defining a cfg of our choice.

However, just doing this processes takes around 1.5-1.8 seconds for Matlab to processes each EEG data chunk. We haven't even yet included any of the ft_analysis schemes for feature extraction, and are concerned the processing time might be too delayed through this route for real-time BCI. Does anyone have any experience with online BCI processing through Fieldtrip, or recommendations on expediting this process?

Thank you in advance for your help!

-Eli
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190605/7044ddca/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list