online application using the output letters in P300 speller

Forum for software developers to discuss BCI2000 software development
Locked
ashley
Posts: 2
Joined: 29 Jan 2009, 10:27

online application using the output letters in P300 speller

Post by ashley » 02 Feb 2009, 20:33

Hi,

We are trying to write an online application, which use the output letters selected by the user in the P300 speller as the input to a Matlab program online. There are 3 problems we are running to.

First, How can we use the the letters selected by the user as a (synchronous) online input to the Matlab Program. Can we just select the <save> command in Textwindow feature to write the text in the text window in a file. Meanwhile, we use the matlab program to open the file and get the input. Has there been anyone do that before or have some other successful option?

Second, when we set the parameter follow the P300 BCI Tutorial, we choose 8 channels. But the channel display is not those we choose but the first 8 channels. How we set them?

Third, how to use the simulation mode to test our Matlab Program without real EEG signal.

Last, About the classifier filter parameter, We follow the tutorial. But we do not understand it well. Is there any general Classifier parameter example available?

Thank you so much.

Smile,

Ashley

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

Post by mellinger » 03 Feb 2009, 12:24

Ashley,

thank you for your questions.

ad 1)
The P3Speller application module allows you to send selected characters into a UDP port specified in the "DestinationAddress" parameter on the "Application" tab (http://www.bci2000.org/wiki/index.php/U ... ionAddress).

When you have the Instrument Control Toolbox available in Matlab, you may then create a UDP socket and read from it. E.g., when you set

Code: Select all

DestinationAddress= 127.0.0.1:20320
the following Matlab code will print selected characters to the Matlab command line:

Code: Select all

u = udp('localhost',20319,'LocalPort',20320,'Terminator','CR/LF','Timeout',10);
fopen(u); 
s = fgetl(u);
while (s~=-1) 
  fprintf('%s', s); 
  s = fgetl(u);
end 
fclose(u); 
delete(u); 
This code is available as well under

Code: Select all

src/contrib/AppConnectorApplications/readudp.m
ad 2)
In the raw source display, all acquired channels are displayed. In order to view the channels chosen in the TransmitCh parameter, activate the "VisualizeTransmissionFilter" parameter on the "Visualize" configuration tab.

ad 3)
Start BCI2000 using the P3Speller_SignalGenerator batch file, and load the example parameter file at

Code: Select all

parms/examples/P3Speller_CopySpelling.prm
.
Then, set the "DestinationAddress" parameter to the desired IP/port combination.
In this configuration, the SignalGenerator source module will generate simulated P300 responses such that the suggested text will be spelled. Also, clicking a matrix entry with the mouse will select the associated letter once all stimuli have been presented.

ad 4)
A general description of the linear classifier filter is available at the LinearClassifier documentation page in the wiki:
http://www.bci2000.org/wiki/index.php/U ... Classifier
On that page, there is an example for ERP classification provided as well.
If the wiki page does not answer your questions, please ask them here.

Regards,
Juergen
Last edited by mellinger on 11 Feb 2009, 09:34, edited 2 times in total.

ashley
Posts: 2
Joined: 29 Jan 2009, 10:27

still have problems with the UDP and classifier filter

Post by ashley » 07 Feb 2009, 12:56

Thank you so much. It helps us a lot.

However, we still have some problems.

when we try to get the selected letter in Matlab Program using the code you provided. Unfortunately, the letters did not appear. 'Warning: A timeout occurred before the Terminator was reached. ' show up. We do not know what is wrong.

Another thing is, we follow the P300 tutorial to set the 'classifier filter', we train the model 5 to 6 times. It still does not work. the speller result does not even close. We can not figure out what is wrong. Any suggestions ?\

Smile,

Ash

bmiguy
Posts: 2
Joined: 09 Feb 2009, 17:59

same problem

Post by bmiguy » 09 Feb 2009, 18:01

I am also having the same difficulty, has the UDP code above been tested? IS there an easier way to check if BCI2000 is properly transmitting these udp packets? I have tried hyperterminal, but it wont connect when I enter
the host ip and port number.

Also, I have tried to save the letters to a file, but P300 doesnt seem to be doing so. I have specified a path in the TextWindowFilePath setting, and when that didnt work i created a blank text file and set that as the path, but to no avail.
Any suggestions?
dan

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

Post by mellinger » 11 Feb 2009, 09:31

Hi,
I edited the Matlab code above such that it works for me now.

Regards,
Juergen
Last edited by mellinger on 11 Feb 2009, 16:59, edited 2 times in total.

bmiguy
Posts: 2
Joined: 09 Feb 2009, 17:59

Post by bmiguy » 11 Feb 2009, 13:25

it works now, thanks!

Locked

Who is online

Users browsing this forum: No registered users and 0 guests