We're Hiring!

Accessing Java from OmeroScript

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Accessing Java from OmeroScript

Postby pjk » Wed May 09, 2012 1:54 am

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
pjk
 
Posts: 16
Joined: Wed May 09, 2012 1:35 am

Re: Accessing Java from OmeroScript

Postby jmoore » Wed May 09, 2012 7:59 am

What are the possibilities for interacting with your Java program? Command-line options? Stdin/stdout?

~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Accessing Java from OmeroScript

Postby pjk » Wed May 09, 2012 10:29 am

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
pjk
 
Posts: 16
Joined: Wed May 09, 2012 1:35 am

Re: Accessing Java from OmeroScript

Postby jmoore » Thu May 10, 2012 7:33 am

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
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Accessing Java from OmeroScript

Postby pjk » Sat May 12, 2012 3:28 am

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
pjk
 
Posts: 16
Joined: Wed May 09, 2012 1:35 am


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest