Page 1 of 1

Accessing Java from OmeroScript

PostPosted: Wed May 09, 2012 1:54 am
by pjk
Hi,

I have a Java program that currently performs image recognition algorithms. I want to integrate this java program into omero so that we can use the image repository and the nice userinterface of omero.insight. The java program should work close to the server because of bandwidth issues.

My idea was to create a script (Python) that will run on the server and from the script call my java program. I have looked for a Python wrapper for Java but have not found anything. I'm beginning to think that there is something wrong with my approach.

Thanks for your help

Re: Accessing Java from OmeroScript

PostPosted: Wed May 09, 2012 7:59 am
by jmoore
What are the possibilities for interacting with your Java program? Command-line options? Stdin/stdout?

~Josh

Re: Accessing Java from OmeroScript

PostPosted: Wed May 09, 2012 10:29 am
by pjk
Hi Josh,

The java program has currently its own GUI but we want to replace that with omero.insight.
We have the source code for the program.
Interacting would be via Classes/methods

Re: Accessing Java from OmeroScript

PostPosted: Thu May 10, 2012 7:33 am
by jmoore
In that case, the most straight-forward way right now to have this launched server-side is to write a small Java wrapper which can handle command line arguments. Something like:

Code: Select all
java your.Klass --ImageID=5 --SessionUUID=5959a-59394-a994-a99494


and then we can help you write the necessary Python script. (An example which launches Matlab instead of Java is available under examples/ScriptingService/NativeWrapperExample.py).

You can print something to stdout from your.Klass which can be interpreted by the Python script as feedback for the user. ("Image 5 analyzed", or whatever)

Moving forward, we'd rather have this bits of Java code wrapped as ImageJ2 plugins which OMERO will be able to launch natively. If you're interested into looking into that now rather than later, let us know. (The decision depends on when you need this in production. One works now; one needs development)

Cheers,
~Josh

Re: Accessing Java from OmeroScript

PostPosted: Sat May 12, 2012 3:28 am
by pjk
Hi Josh,

Thanks for your response. It's exactly what I was looking for.
I feel confident that with the examples you provided I will now be able to work it out.

Thanks again.

Peter