<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Eli,
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 4 Jun 2019, at 16:47, Eli Kinney- Lang <<a href="mailto:eli.kinneylang@ucalgary.ca" class="">eli.kinneylang@ucalgary.ca</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Hi all,</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">  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.<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Details:<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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.</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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.</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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<span class="Apple-converted-space"> </span><span class="">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?<span class="Apple-converted-space"> </span><br class="">
</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class=""><br class="">
</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="">Thank you in advance for your help!<span class="Apple-converted-space"> </span><br class="">
</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class=""><br class="">
</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="">-Eli</span><br class="">
</div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>