[FieldTrip] Getting started with realtime EEG data
"Jörn M. Horschig"
jm.horschig at donders.ru.nl
Tue Jul 23 09:41:56 CEST 2013
I was just reading up on this conversation and since you mentioned that
you do not have any signal processing experience, I thought it'd be nice
to point to http://www.dspguide.com/ (free online book)
Good luck with oscillating in your sleep :)
On 3/6/2013 9:08 AM, Eelke Spaak wrote:
> Hi Eric,
> Yes, FieldTrip's raw data format is the same regardless of acquisition
> device, so I expect no problems switching from one device to another.
> Note, though, that I have not worked with the realtime buffer, but I
> think it ought to work the same as with offline data processing.
> Certain analysis pipelines (e.g. source reconstruction) require
> accurate information about the electrode positions. The ease at which
> you could obtain these might differ between different devices.
> However, based on the info you've given so far I guess this will not
> be a problem for you.
> On 6 March 2013 05:24, Eric Mill <konklone at gmail.com> wrote:
>> Sorry, that was a very long response on my part - but the one actual
>> question I have in there is, how easy is it to switch from one EEG device to
>> another? Should I expect to have to rework my code entirely, or will the
>> core data format and signal processing work be the same? Is standardizing
>> the data stream one of the things using an intermediary like Field Trip
>> -- Eric
>> On Sun, Mar 3, 2013 at 5:26 PM, Eric Mill <konklone at gmail.com> wrote:
>>> This is extremely helpful, and just what I was looking for, thank you
>>> (both Robert and Stefan). I have a few followup questions you've inspired.
>>> How "swappable" is the hardware? Do all EEG's fundamentally produce the
>>> same data from the same brain activity? And/or, does FieldTrip always expose
>>> data in its buffer in the same format?
>>> For example, I would be fine investing the $750 for an Emotiv 14-channel
>>> EEG, or even the $1200 for a KT88-1016, but not until after I've done some
>>> development with a cheaper device first. However, I would not want to have
>>> to rewrite all my code, or much of it, if I switch devices.
>>> I do have a requirement that I can have the same code work with either
>>> live or replayed data. From how you describe its buffer approach, it sounds
>>> like that's a core value of FieldTrip, and will make that requirement much
>>> easier to satisfy.
>>> Also, I do have one peculiar requirement, which is that the hardware be
>>> suitable for wearing during ordinary sleeping at home. This is more a
>>> requirement for the final (potentially more expensive) device, than the
>>> development device. The promotional photo for the Emotiv EEG, for example,
>>> looks like it might not be so great for that.
>>> I think I will be using WebSockets, but there will be an intermediate
>>> server. So, I will have a computer (perhaps a Raspberry Pi) receive data
>>> from the EEG, and then immediately stream it up an open TCP connection to a
>>> web server. This server will then stream it down to the individual browsers
>>> like Three.js or Processing.js.
>>> but I believe the server software could be made to be general purpose, and
>>> reusable in the work of others like yourselves. That would be a satisfying
>>> The idea here is that the resulting website will show fully live and real
>>> time EEG data, specifically while I am sleeping. Since I only sleep for ~1/3
>>> of any given day, the ability to replay things will be helpful in giving the
>>> site utility during the other 2/3.
>>> I've never done any signal processing before, not even so much as a fast
>>> Fourier transform. But I'm willing to learn! I'll be consulting the tutorial
>>> you've kindly written, but if you have any suggestions of learning material
>>> I should look at when figuring out how to (for example) detect when a
>>> subject has entered levels of sleep given streams of EEG data, it would be a
>>> lot of help to me.
>>> Unfortunately, the paper you linked to
>>> is behind a paywall and is $35, but if you recommend it highly enough, I'll
>>> check it out.
>>> Again, thank you for being so welcome to a newbie, and for the
>>> recommendations and links.
>>> -- Eric
>>> On Sun, Mar 3, 2013 at 4:58 AM, Robert Oostenveld
>>> <r.oostenveld at donders.ru.nl> wrote:
>>>> Hi Eric,
>>>> I think that NeuroSky renamed and discontinued some of their products
>>>> since we made the initial implementation of the ThinkCap. I am still able
>>>> to find documentation here
>>>> and http://developer.neurosky.com/docs/doku.php?id=thinkcap. I cannot tell
>>>> whether the complete sets now sold by NeuroSky still use the same software
>>>> interface, but NeuroSky is rather open with their development tools.
>>>> Alternatives you may consider are the Emotiv Epoc or the DIY OpenEEG. The
>>>> Epoc has more channels and a head mount for the electrodes. For the Epoc you
>>>> have to look into teh different SDK options, the cheapest version only gives
>>>> access to processed data, not to the raw data. For both the Epoc and openeeg
>>>> a implementation of a stand-allone executable is available in
>>>> http://fieldtrip.fcdonders.nl/development/realtime/implementation. LIke for
>>>> the ThinkCap, this copies the data to a "fieldtrip buffer", where another
>>>> (c/c++/java/python/matlab) application can easily read it from and do the
>>>> signal processing, not having to worry about the buffering and data
>>>> representation any more.
>>>> I know it falls outside your budget, but have a look at
>>>> These KT88-1016 systems are available from ebay.
>>>> Let me add a bit from the developers perspective and software design. The
>>>> rationale for the fieldtrip buffer is that it allows us to develop analysis
>>>> pipelines using EEG data files on disk (using ft_read_data). Once the
>>>> offline analysis pipeline performs as desired, we just switch from reading
>>>> to disk to reading from the buffer (also ft_read_data). We happen to do this
>>>> using MATLAB for the rapid application development, but the same strategy
>>>> (develop for file, run in real-time) can be used with another programming
>>>> I think that for signal processing you'll better off if you develop the
>>>> code using some good quality data from a file on disk. You can always enact
>>>> a real-time data stream by replaying data from that EEG file, or using the
>>>> sine2ft GUIs (see realtime/bin). Otherwise you'll be doing all development,
>>>> constantly having to wear the headset. That is fine for artefact detection
>>>> (you can blink while you code), but not if the tasks get more complicated,
>>>> e.g. relaxing to increase your occipital alpha/10Hz won't work well if you
>>>> also have in realtime have to monitor whether your applications picks up the
>>>> Some time ago we (i.e. Boris Reuderink and me) looked into the
>>>> possibilities of a web-standards implementation. Web Sockets would be
>>>> buffer" TCP server. The Web Sockets still seemed a bit risky w.r.t. it
>>>> working on all platforms. A server-side implementation offers more choice,
>>>> python/java/php reading the data from a FT buffer or from the device, and
>>>> then pass it on in html format to the connected web ) but would not scale as
>>>> easily with multiple client connections if data processing needs to be done
>>>> on the server. We then considered the best option to be to implement a
>>>> RESTless server implementation. The server would one the one hand contains
>>>> the FT buffer (where it receives the data over low-level TCP) and on the
>>>> other hand have a web server with the RESTless interface. I.e. the requests
>>>> that are represented here
>>>> http://fieldtrip.fcdonders.nl/development/realtime/buffer_protocol would
>>>> each translate to a http call like "http://ftbuffer.donders.nl/get/hdr" and
>>>> "http://ftbuffer.donders.nl/get/dat?begsample=xx&endsample=xx". You can ask
>>>> Boris (CC) offline whether he has given it further thought.
>>>> best regards,
>>>> On 2 Mar 2013, at 3:12, Eric Mill wrote:
>>>>> Hi all,
>>>>> My apologies if this is off-topic here, since you all seem like very
>>>>> busy experts!
>>>>> I'm trying to figure out what I need to get started with capturing
>>>>> real-time EEG data using consumer-priced headsets (<$200). I don't actually
>>>>> have any interest in using MATLAB, though - I just want to capture the raw
>>>>> data, in real time.
>>>>> I see that FieldTrip has a realtime acquisition module for NeuroSky's
>>>>> "ThinkCap", though I can't find a current product by NeuroSky called that.
>>>>> Is there something else of theirs I could buy that would work with
>>>>> Or, should I be looking elsewhere entirely? What should someone who
>>>>> wants real-time EEG data do?
>>>>> My plan is to stream this data and visualize it on the web in real
>>>>> time. My background is in web development, not cognitive science, but I'm
>>>>> willing to learn what I have to make something interesting. I'd also love to
>>>>> have the project result in libraries useful for other people in the field.
>>>>> Thanks for any advice you can give on what EEG to buy, and/or where to
>>>>> learn the core concepts I'll need to use the data.
>>>>> -- Eric
>>>>> fieldtrip mailing list
>>>>> fieldtrip at donders.ru.nl
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
Jörn M. Horschig
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team
P.O. Box 9101
NL-6500 HB Nijmegen
E-Mail: jm.horschig at donders.ru.nl
Trigon, room 2.30
NL-6525 EN Nijmegen
More information about the fieldtrip