[FieldTrip] OpenVibe XDF

Arnaud Delorme arnodelorme at gmail.com
Tue Mar 16 19:55:10 CET 2021


Dear Julian,

To align event streams within MATLAB, you may use the EEGLAB XDF import plugin https://github.com/xdf-modules/xdf-EEGLAB
I am not sure EEGLAB is required or not. I would recommend using the version on the EEGLAB plugin manager because the Github code does not contain the binary XDF library, and the Matlab replacement code is extremely slow. Then use the eeglab2fieldtrip function to convert your data and events so they may be used with Fieldtrip.
The other option is to use the Mobilab EEGLAB plugin. There is a short video for how to use two XDF import plugins https://youtu.be/tDDkrmv3ZKE?t=200s

Cheers,

Arno

> On Mar 16, 2021, at 8:01 AM, Julian Keil <julian.keil at gmail.com> wrote:
> 
> Dear all,
> 
> I have a problem with the timestamps of EEG data acquired in openvibe.
> 
> In short, the experiment consists of a stimulation via PsychoPy, an EEG connected to openvibe and a collection of the PsychoPy markers and the openvibe EEG data in the labstreaminglayer LSL recorder.
> 
> When reading the XDF-data from this, I get two data streams, one with the continuous EEG and one with the discontinuous markers. However, these two data streams are not aligned in time, as you can see in the stream information (see „first_timestamp“):
> 
> name: 'openvibeSignal'
>                type: 'signal'
>       channel_count: '32'
>       nominal_srate: '1000'
>      channel_format: 'float32'
>           source_id: '(0x4e97a72c, 0x01f9e774)'
>             version: '1.1000000000000001'
>          created_at: '235805.639196'
>                 uid: 'ec4655c1-9974-4253-875c-943ce39d8a94'
>          session_id: 'default'
>            hostname: 'DESKTOP-Q8JPPQS'
>           v4address: [1×1 struct]
>         v4data_port: '16572'
>      v4service_port: '16572'
>           v6address: [1×1 struct]
>         v6data_port: '16572'
>      v6service_port: '16572'
>                desc: [1×1 struct]
>       clock_offsets: [1×1 struct]
>     first_timestamp: '13.47199995373376'
>      last_timestamp: '2406.046991737028'
>        sample_count: '2392575'
>     effective_srate: 1.0000e+03
> 
> name: 'trigger_stream'
>                type: 'Markers'
>       channel_count: '1'
>       nominal_srate: '0'
>      channel_format: 'string'
>           source_id: 'trigger_stream1'
>             version: '1.1000000000000001'
>          created_at: '234884.27523130001'
>                 uid: 'c433e664-bf05-4e03-a5ac-2373c4484121'
>          session_id: 'default'
>            hostname: 'LAPTOP-U8UG7I7S'
>           v4address: [1×1 struct]
>         v4data_port: '16572'
>      v4service_port: '16572'
>           v6address: [1×1 struct]
>         v6data_port: '16572'
>      v6service_port: '16572'
>                desc: [1×1 struct]
>       clock_offsets: [1×1 struct]
>     first_timestamp: '236044.9602928'
>      last_timestamp: '237813.1065359'
>        sample_count: ‚635'
> 
> Apparently, openvibe uses a different clock than LSL, but I could not find any reliable information on how to align the different clocks. 
> 
> This is the code I used to read in the data - I used the xdf2fieldtrip-function as ft_preprocessing takes ages to read the raw XDF data.
> 
> cfg = [];
> cfg.dataset = 'sub-PEEL18_ses-S001_task-Default_run-001_eeg.xdf';
> xdfdata = xdf2fieldtrip(cfg.dataset);
> xdfdata.time{1} = xdfdata.time{1} + str2num(xdfdata.hdr.orig.clock_offsets(1).offset{1}.time);
>  
> cfg=[]; 
> cfg.dataset='sub-PEEL18_ses-S001_task-Default_run-001_eeg.xdf'; 
> cfg.trialdef.eventtype = 'Markers';
> cfg.trialdef.prestim=1; 
> cfg.trialdef.poststim=1; 
>  
> cfg=ft_definetrial(cfg); 
>  
> trldat = ft_redefinetrial(cfg,xdfdata);
> 
> As you can see, so far, I tried shifting the EEG timestamps by the clock_offset (which gets both streams in the same ballpark), but I’m not sure whether this is correct.
> 
> So, in summary: Has anyone ever tried to get openvibe data into FieldTrip and can anyone tell me how to align these two data streams?
> 
> Thanks a lot,
> 
> Julian
> 
> _______________________________________________
> 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