BCI2000 Client/Server communications

Forum for discussion on different brain signals
Locked
martimd5
Posts: 10
Joined: 07 Oct 2010, 06:20

BCI2000 Client/Server communications

Post by martimd5 » 07 Oct 2010, 06:53

Hi everyone!

I would like to develop a BCI with Java and using BCI 2000 as acquisition system. Currently, I'm trying to understand how can we transmit acquired brain signals by BCI 2000 to a Java application (with TCP or UDP). If I well
understand, the BCI 2000 web page mention that we can do it through 'a network based interface'. However, I didn't find any relevant documentation about this subject. There is a wiki page that talk about App connector, but I don't understand how we have to configure BCI 2000 in order to use this functionality.

For example, I put as singal source 'SignalGenerator', signal processing 'DummySignalProcessing' and application 'FeedbackDemo'. After that I click on the launch button. Is it possible to communicate sine waves (generated by BCI 2000) to a Java application changing configuration parameters (i.e parameters that appears by clicking on the Config button) ? If yes, what I should do in the server side (BCI 2000) and client side (Java) ?

Thank you very much for your attention.

Best,

Martin Miguel

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

Post by mellinger » 07 Oct 2010, 08:37

Martin,

your Java application can change configuration parameters by starting BCI2000 modules directly rather than using the BCI2000Launcher application.
When starting up the BCI2000 source module, parameter values may be specified on the command line as in

Code: Select all

SignalSource --SubjectRun=2 --SubjectName=Joe
When starting up the Operator module, parameter files may be loaded via command line parameters (see http://www.bci2000.org/wiki/index.php/U ... _Scripting)

Receiving EEG data is possible via the AppConnector. Using the modules you named, EEG data will be available in the Signal(channel, sample) data transmitted over the AppConnector.
For a suggestion how to set up AppConnector parameters for your application, please see http://www.bci2000.org/wiki/index.php/T ... ng_locally.

Best regards,
Juergen

martimd5
Posts: 10
Joined: 07 Oct 2010, 06:20

BCI 2000 Client/Server communication

Post by martimd5 » 07 Oct 2010, 17:07

Dear Juergen,

Thanks to you I have a lot of new ideas for my BCI application. However, I would like to know the following things :

1. Is it possible to start BCI 2000 operator module without starting any Application module ? Because, in my Java application, brain stimulations are managed by another server process which launch JavaFx scripts.

2. Is it possible to start and suspend BCI 2000 from the command line ? Because, I would like to decide from my Java when an acquisition process must start and when it must suspend. If yes, which command line I have to invoke ?

Again, thank you very much for your knowledge about BCI2000
and your help.

Best,

Martin Miguel

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

Post by mellinger » 08 Oct 2010, 08:38

Martin,

ad 1)
It is not possible to start BCI2000 without an application module. However, you may easily create a dummy application module that only contains the two AppConnector filters. Edit: BCI2000 now ships with a DummyApplication module, you don't need to create one.

ad 2)
You cannot start/suspend BCI2000 from the command line. What you can do is to start BCI2000 immediately when it runs (via command line parameters), and to quit it when it suspends. Suspending BCI2000 can be done over the AppConnector interface, by setting the "Running" state to 0.

Best regards,
Juergen

martimd5
Posts: 10
Joined: 07 Oct 2010, 06:20

Post by martimd5 » 11 Oct 2010, 11:55

Hi, Juergen

Thank you for your last suggestion. I tried to implement it. However, I have a little problem.

From my java application, I run the following commands prompt :
> {path_to_BCI2000}\prog\SignalGenerator.exe
> {path_to_BCI2000}\prog\DummySignalProcessing.exe
> {path_to_BCI2000}\prog\FeedbackDemo.exe
> {path_to_BCI2000}\prog\Operator.exe --OnConnect "-LOAD PARAMETERFILE {path_to_parameter_file}\{parameter_file}; SETCONFIG"
--OnSetConfig "-SET STATE Running 1"
--OnSuspend "-QUIT"
After executing this commands, BCI 2000 is running. After that, I try to suspend (and quit) BCI 2000 sending the following message through a UDP
connection :
SET STATE Running 0
When BCI 2000 receive this message, it seems that it suspend the source module and the application (because the source signal windows and
the application windows are stopped). However, the operator module is
still running, because all windows are open and the suspend button is still
available. I didn't find a solution to suspend and quit BCI 2000 through
the AppConnector interface. Do you know how can I do it ?

This a picture showing the state of BCI 2000 after receiving the above message.
Image

martimd5
Posts: 10
Joined: 07 Oct 2010, 06:20

Post by martimd5 » 11 Oct 2010, 12:16

Hi, Juergen :

There is another thing that I note. Even if I send a message "TOTO" that generate the same behavior when BCI 2000 receive it.

May be the problem is the UDP connection. Do know how should I initialize the UDP connection with Java for sending packets to BCI 2000 ?

Thank you very much for your attention.

Best,

Martin Miguel

martimd5
Posts: 10
Joined: 07 Oct 2010, 06:20

Post by martimd5 » 11 Oct 2010, 16:28

Hi, Juergen

Finally, I think I'm sending a wrong message to BCI 2000 in order to set the 'Running' state variable to 0. I tried several solution :
- 'SET STATE Running 0'
- 'Running 0'
- 'Running 1 0 0 0'
- 'SET STATE Running 1 0 0 0'
- 'Running 1 0 2 1'
- 'SET STATE Running 1 0 2 1'
But all these solutions give me the same result. So, which string (or array of byte) should I send to BCI 2000 input connector (through a UDP connection)
if I want to set the 'Running' variable to 0 ?

Sorry for all my questions.

Martin Miguel

martimd5
Posts: 10
Joined: 07 Oct 2010, 06:20

Post by martimd5 » 12 Oct 2010, 06:09

Hi, Juergen

I have found my mistake. I must send the following message :
-> 'Running 0\n'
I forgot the '\n' characters at the end of the message.

Best,

Martin Miguel

Locked

Who is online

Users browsing this forum: No registered users and 2 guests