Neuroscan + Matlab

This forum deals with BCI2000 configuration issues.
Locked
richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Neuroscan + Matlab

Post by richard1 » 12 Sep 2010, 22:54

Hi,

I am using BCI2000 and I want to be able to use the Neuroscan Signal Generator together with the FieldTrip Matlab processor. I don't really need an application (I have been using CursorTask just to get things to run) since all I want to do is:

1. View and process the raw signal in Matlab
2. Trigger events that can be seen in realtime in Matlab

I am triggering events via the normal neuroscan method - via the parallel port at the back of the unit. These come up as events in Neuroscan's Acquire software - their trigger code (8 bit) and the time that the trigger arrived. So I know the triggers are being received by Neuroscan.

So far, I have managed to get the Neuroscan acquisition happening, and I can view the signal in realtime in Matlab. So that's great.

However, I have no idea how to collect the triggers. I have used the FieldTrip read_event function to look at the NeuroscanEvent1 State, but this doesn't seem to change when a trigger comes in. I can't see anything else that changes in this buffer either.

Can anyone help?

Thanks

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

Post by r.oostenveld » 13 Sep 2010, 06:50

Hi Richard,

States in BCI2000 are represented as a bit-pattern at every sample, i.e. the state vector (containing the value of multiple states) is sampled just like the data.

In FieldTrip events are represents as changes in the value of (usuallY) a trigger channel. I.e. if you think of a continuously sampled state vector, then the fieldtrip events are only the flanks corresponding with the changes in that state vector.

I suggest the following

1) write some data to a bci2000 *.dat file, and (offline) read that in with ft_read_header, ft_read_data and ft_read_event. That will make clear how data and associated meta-data are represented by FT.

2) start BCI200 with the FieldTripBuffer filter in the pipeline and send regular triggers to your amp. Then start Matlab and use the following code:

while (1)
evt = ft_read_event('buffer://localhost:1972');
disp(length(evt))
pause(0.1)
end

You should see the number of events increase with the triggers that you feed into your amp.

Since BCI2000 uses the state vector for a number of things (a.o. for timestamping), the configuration of the FieldTripBuffer filter allows you to specify which states are sent to the FT buffer. Have a look at http://www.bci2000.org/wiki/index.php/C ... TripBuffer and specifically FTStatesToBuffer.

best,
Robert

richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Post by richard1 » 13 Sep 2010, 18:34

Thank you, I will give that a try. What application should I be running, or doesn't it matter?

richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Post by richard1 » 13 Sep 2010, 19:28

Have just tried it, no change to the counter unfortunately.

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

NeurscanEvent1

Post by gschalk » 14 Sep 2010, 07:05

Hi,

Can you check whether the state NeuroscanEvent1 even contains what you are looking for? E.g., using BCI2000Viewer or by loading the datafile into Matlab using load_bcidat.

Gerv

richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Post by richard1 » 14 Sep 2010, 17:41

Hi Gerv,

I will take a look. I noticed that you are the author of the Neuroscan module. The data that I am looking for is the trigger data, typically sent by the Neuroscan Stim2 program that presents auditory/visual stimuli to the subject. When these are presented, a unique code can be sent from Stim2 to Acquire. They appear as blue numbers on the bottom of the EEG trace in Acquire. When the subject responds, other triggers appear as red numbers along the bottom of the EEG trace (eg 1,2,3,4 depending on what button was pressed). These red and blue stimulus/response trigger codes and their timing is the data that I want to retrieve. Ultimately, i want to be able to get matlab to wait for these triggers and then display the EEG at that time.

However, it seems that the NeuroscanEvent1 state does not include this information...

Hope this makes sense!

Many thanks

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

Neuroscan ....

Post by gschalk » 14 Sep 2010, 19:05

Hi,

Let us know if the event marker makes it into the BCI2000 data file. It is possible that it will sometimes appear, but not always. Previous versions of BCI2000 (when we wrote the Neuroscan module) did not allow to change events more often than each sample block (i.e., 40 samples for Neuroscan at 1kHz).

If this is the case, then let us know so that we can get this worked out.

Gerv

richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Post by richard1 » 14 Sep 2010, 20:04

Hi Gerv,

I have the latest version of BCI2000 (if that makes any difference). I have had a look at the recording and there are events in the NeuroscanEvent1 state, however they are so sporadic that it is difficult to see if they are what I am looking for! I am sending triggers every 800ms and over a 30 second recording there might be anywhere from 0 to 3 or so events that come up.

If they are being captured, it is not happening consistently!

Thanks
Richard

richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Post by richard1 » 24 Sep 2010, 02:24

Hi, just wondering if this might be feasible to work around... or should I look for an alternative solution?

Many thanks
Richard

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

Post by mellinger » 24 Sep 2010, 09:25

Hi Richard,

I modified the Neuroscan Acquire client source module, such that it should not lose information from the event channel any more. If you are compiling BCI2000 from source, please update to the latest version, and recompile. Otherwise, I can send you the modified executable per e-mail.

Best regards,
Juergen

richard1
Posts: 7
Joined: 12 Sep 2010, 22:43

Post by richard1 » 24 Sep 2010, 09:28

Many thanks Juergen, I will try it out asap

Locked

Who is online

Users browsing this forum: No registered users and 0 guests