How to integrate OpenViBE with java or matlab

Come here to discuss about OpenViBE in general!
alextui
Posts: 2
Joined: Tue Oct 18, 2011 9:08 pm
Location: Philadelphila, PA
Contact:

How to integrate OpenViBE with java or matlab

Post by alextui »

hi:

This is wayne from Philadelphia PA.I am a PHD student from Temple U.openvibe is very interesting project.

As i know, a lot of school implemented various algorithm in java and matlab , for openvibe, is there a interface for people to integrate with or invoke those existing algorithm?

thanks

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: How to integrate OpenViBE with java or matlab

Post by lbonnet »

Hi alex, welcome on board!

Code: Select all

As i know, a lot of school implemented various algorithm in java and matlab , for openvibe, is there a interface for people to integrate with or invoke those existing algorithm? 
We developed a Matlab Filter box, that takes on its input signal and stimulation tags from openvibe, and passes it to the Matlab engine. You have to write your own Matlab function to process the data. Then the box gets the result and makes it available for further process within openvibe.

Please note that this box is still marked as unstable, because it may be modified in near future and has not been fully tested. It also has some limitations (performance limited, not available on 64 bits systems).

Regarding Java, the INRIA dev team doesn't have any development in this direction so far, and I am not aware of community development aiming at integrating a java interface in openvibe.

What are your interest with BCI ? Depending on your needs maybe we can help you with finding the best solution, and tell you how openvibe can be used in your case.

Best regards,

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

alextui
Posts: 2
Joined: Tue Oct 18, 2011 9:08 pm
Location: Philadelphila, PA
Contact:

Re: How to integrate OpenViBE with java or matlab

Post by alextui »

Thanks for the info.

my adviser did some research on BCI and Ergonomics, but i didn't make my final decision on any topic yet.

Any interesting/popular topics you highly recommended?

thanks

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: How to integrate OpenViBE with java or matlab

Post by toncho11 »

You can have some of the work done by OpenVibe and then stream the result to Java or .NET. This can be done by exporting the result from OpenVibe through VRPN box. Then you need a VRPN reader in your Java/.NET application.

I am doing this with my Adastra project: http://code.google.com/p/adastra/

pierre_cu
Posts: 5
Joined: Wed Jan 25, 2012 12:48 pm

Re: How to integrate OpenViBE with java or matlab

Post by pierre_cu »

Hello,
sorry to jump in the middle of this conversation but this topic looks really similar to my concerns. I am a teacher in architecture in Paris and trying to set up an experimental workshop with students. We try to link 3D 'parametric' models with external data to modify them and this time i am willing to set up a connection with openvibe and works done with a software called 'Processing' written in a java-like language. I didn't look yet in the personal project Adastra you just mentioned above but do you think such a VRPN reader could be done easily? I have some experience already with UDP protocol for similar projects but VRPN is really new to me.

Thank you
Kind Regards
Pierre

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: How to integrate OpenViBE with java or matlab

Post by toncho11 »

If you check the VRPN downloadable archive: ftp://ftp.cs.unc.edu/pub/packages/GRIP/ ... _07_29.zip

you will find a Java folder: \vrpn\java_vrpn which might be a Java VRPN client which can act as bridge/connector between OpenVibe and Java.

Using the above JAVA VRPN client you might be able to read data while OpenVibe is running and process it in Java. You need to compile and experiment.

workflow: OpenVibe -> your scenario -> VRPN server component (part of OpenVibe) -> Java VRPN client (above) -> Java -> :)

In my Adastra project I have personally tested a .NET connector and it works nicely: http://wwwx.cs.unc.edu/~chrisv/vrpnnet and you could reuse my source.

p.s. There are also Android and Python connectors in the archive.

pierre_cu
Posts: 5
Joined: Wed Jan 25, 2012 12:48 pm

Re: How to integrate OpenViBE with java or matlab

Post by pierre_cu »

thank you for the quick reply, I will try it and get back to you asap.
Kind Regards
Pierre

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: How to integrate OpenViBE with java or matlab

Post by toncho11 »

Hi again,

I have successfully compiled VRPN itself and the Java wrapper. One needs a bunch of tools for each step.

Everything you need is here: https://adastra.googlecode.com/svn/trunk/src_java

Our goal will be to read 11 channel EEG signal, process it in OpenVibe and forward it to Java.

OpenVibe:
Start the designer and start the provided OpenVibe scenario in the source above.

Eclipse:
Open the Eclipse project file ".project" in test.
Go to "configure build path". Remove everything that is wrong.
Add the provided by me vrpn.jar. Then you need to expand vrpn.jar in libraries tab and set "native library location" to the provided by me java_vrpn.dll.

Then everything will compile. Your main class is "AnalogTest". This class is set to connect to "openvibe-vrpn@localhost" and it will print channel 10 (last channel of 11 channel EEG signal).

First start OpenVibe and then execute your Java application.

I hope this helps.

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: How to integrate OpenViBE with java or matlab

Post by toncho11 »

I am curios if this Java-VRPN stuff is going to help you.

Please keep us posted.

pierre_cu
Posts: 5
Joined: Wed Jan 25, 2012 12:48 pm

Re: How to integrate OpenViBE with java or matlab

Post by pierre_cu »

Hello toncho 11 and thank you for your help. I have tried the wrapper you have done and it seems to run well on eclipse. However I think I am still having a connection problem with openvibe.
here is the log: vrpn_udp_request_lob_packet: send() failed: No error. I need to get a bit more into it but I am sure it will work. I will keep you posted.
Cheers
Pierre

pierre_cu
Posts: 5
Joined: Wed Jan 25, 2012 12:48 pm

Re: How to integrate OpenViBE with java or matlab

Post by pierre_cu »

Hello again,
Now it is working like a charm from what you provided. I will then try to establish a UDP connection from your java code because processing only have libraries for TCP/UDP connections for now.
Being a complete newbie with VRPN, could you please point me to the right class in java to establish a vrpn connection just like TCP/UDP?

Thank you very much
Kind Regards
Pierre

pierre_cu
Posts: 5
Joined: Wed Jan 25, 2012 12:48 pm

Re: How to integrate OpenViBE with java or matlab

Post by pierre_cu »

Hello,
taking back the conversation left some time ago. I also took back the tests made with the code provided from the adastra project and was unsuccessful so far to connect to Openvibe again.
I have checked the native library and used the last version of adastra source code (2.5.1.) but I still have those errors:

Code: Select all

Error initializing java_vrpn.
 -- Unable to find native library.
Error initializing remote device openvibe-vrpn@localhost.
 -- Unable to find the right functions.  This may be a version problem.
vrpn.AnalogRemote.init(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z
Do you have any idea what is causing this problem?
All the best

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: How to integrate OpenViBE with java or matlab

Post by toncho11 »

Hi, Pierre

I think that there is an easy solution to your problem.

From the following:

"Every native library requires a particular version of JNI. This is denoted by the private jniVersion field. This field is set by the VM when it loads the library, and used by the VM to pass the correct version of JNI to the native methods."

I can conclude that you are using a newer version of Java, probably 1.7. What I have provided was done with Java 1.6. I inspected my files and it says:

Created-By: 1.6.0_29-b11 (Sun Microsystems Inc.)

My files contain native code, so that is why they require the same version of Java 1.6 to run.
For the 1.7 I must create new files, which is quite time consuming when you do not deal with Java on a regular basis.

Cheers,
Anton

shelldream
Posts: 35
Joined: Thu Sep 20, 2012 9:40 am

Re: How to integrate OpenViBE with java or matlab

Post by shelldream »

lbonnet wrote:Hi alex, welcome on board!

Code: Select all

As i know, a lot of school implemented various algorithm in java and matlab , for openvibe, is there a interface for people to integrate with or invoke those existing algorithm? 
We developed a Matlab Filter box, that takes on its input signal and stimulation tags from openvibe, and passes it to the Matlab engine. You have to write your own Matlab function to process the data. Then the box gets the result and makes it available for further process within openvibe.

Please note that this box is still marked as unstable, because it may be modified in near future and has not been fully tested. It also has some limitations (performance limited, not available on 64 bits systems).

Regarding Java, the INRIA dev team doesn't have any development in this direction so far, and I am not aware of community development aiming at integrating a java interface in openvibe.

What are your interest with BCI ? Depending on your needs maybe we can help you with finding the best solution, and tell you how openvibe can be used in your case.

Best regards,

Laurent-
Hi,
Today I tried to run the senario of tuto1_signal_filter.xml which includes the box of Matlab script.But there was an error that the scenario failed to call the Matlab engine. The version of my Matlab is R2011b,and my system is Windows XP(32bits). I wonder if there is an order to install the Matlab and the OpenViBE (for example,I have to first install the OV,then the Matlab)? Or something which I ignored made this error?
Best,
Shelldream

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: How to integrate OpenViBE with java or matlab

Post by jlegeny »

Hello Shelldream,

the matlab filter box needs to know the location of your Matlab installation, this has to be done by the user. Have you indicated the paths to your matlab installation in the box configuration?

Cheers
Jozef

Post Reply