Fieldtrip and reception of events

Forum for discussion on different user applications
Locked
dlesenfants
Posts: 4
Joined: 12 Apr 2011, 10:10

Fieldtrip and reception of events

Post by dlesenfants » 30 May 2011, 08:28

Hi,

I'm new user of BCI2000 and I need help for using fieldtrip and BCI2000 together.
We use a separated screen where is presented visual stimuli. We present instruction with sounds directly with BCI2000. For example : "1.wav" say "focus on the visual stimulus 1"

FocusOn wav : "During the test, we'll instruct you to focus on .... "
Stimuli : "1.wav" and "2.wav".
Copy mode
Random
Sequence : 10 10 (I need 10 '1' and 10 '2' presented randomly).

I work in realtime analysis. I have no problem to recept my EEG signal in matlab with fieldtrip buffer but I want also know if an event occurs during the traited epoch (what I can't right now...) and when (in which sample).

Can someone know how to realize this ?

Protocol :

Part 1 : Instruction (in the wav FocusOn)
Part 2 : Training part : "1" "2" "2" .... The subject need to focus the stimuli during 6seconds. So, it look like : presentation of stimulus "x" - wait at least 6seconds - presentation of stimulus "x" - wait at least 6seconds- ...
Part 3 : end of training

After this, I need to point moments with a touch of my keyboard. So when I push a touch, I can visualize it on my final dat file. How can I do it ?

Thank you for your help !

DL

r.oostenveld
Posts: 10
Joined: 20 Aug 2007, 08:59

Re: Fieldtrip and reception of events

Post by r.oostenveld » 31 May 2011, 11:39

Dear dlesenfants

With BCI2000 and the stimulus presentation app running, you should be able to do something like this in MATLAB

Code: Select all

while (true)
event = ft_read_event('buffer://localhost:1972');
disp(event(end))
end
and constantly see the latest event. With this use, it will most likely skip displaying some events, because many events will come be piped from BCI2000 into the buffer. However, I suggest you do this as a first validity check.

Subsequently I suggest you use the filtering options of FT_READ_EVENT to read only those events that you are interested in. See the FT_FILTER_EVENT function help for details. Something like

Code: Select all

prevnumber = -inf; 
while (true)
event = ft_read_event('buffer://localhost:1972', 'type', XXX, 'minnumber', prevnumber+1);
for i=1:length(event)
disp(event(i))
end % for
prevnumber = event(end).number;
end % while
should show you all interesting events in the right order (note that you have to specify the XXX).

Please also have a look at http://fieldtrip.fcdonders.nl/getting_started/realtime for more examples.

dlesenfants
Posts: 4
Joined: 12 Apr 2011, 10:10

Re: Fieldtrip and reception of events

Post by dlesenfants » 31 May 2011, 19:52

Hi,

thank you for your respond. It run like I want.

Have you a solution for the second punt ? (I want to indicate when I ask a question on the .dat file in pushing a keyboard button. I have the idea to use the KeyLogFilter but I don't know where I can find it and if I can use it in parallele of the StimulusPresentation.exe. Do you think it is a good idea ?)

Thank you again !

Damien

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Re: Fieldtrip and reception of events

Post by mellinger » 03 Jun 2011, 10:32

Hi,

I'm not sure what your second point is about. If it's just recording a keystroke in the .dat file, this can be done as described here:
http://www.bci2000.org/wiki/index.php/U ... ging_Input

If the stimulus presentation should react to the keystroke, you will need to modify the source code of the stimulus presentation module (src/core/Application/StimulusPresentation/StimulusPresentationTask.cpp) such that it listens to the KeyDown or KeyUp state.

Regards,
Juergen

Locked

Who is online

Users browsing this forum: No registered users and 0 guests