Page 1 of 1

Write omero script in Java

PostPosted: Sun Jan 17, 2016 3:04 pm
by yossioulu
Hi,
Is it possible to write an Omero script in Java only without using python?
It seems that it is all there but how to I show the UI of the script input like what exist in Python.

I'm trying to avoid the need to call java from python. (py4j needs a separate agent to be running. I don't like it since it creates another point of failure if this server does not run for some reason, or if you run it twice, and I did not manage to utilize the other python to Java components)

Thanks
Joe

Re: Write omero script in Java

PostPosted: Mon Jan 18, 2016 10:53 am
by jmoore
Hi Joe,

yossioulu wrote:Is it possible to write an Omero script in Java only without using python?
It seems that it is all there but how to I show the UI of the script input like what exist in Python.


Currently, Java isn't one of the 3 script file types configured by default: Python, Jython, and Matlab. (See blitz-servantDefinitions.xml)

The primary problem with using Java is that it's a compiled language, so there would be some question of how you'd store the code to be executed in OMERO. Each of the scripts is currently downloaded on demand.

I'm trying to avoid the need to call java from python. (py4j needs a separate agent to be running. I don't like it since it creates another point of failure if this server does not run for some reason, or if you run it twice, and I did not manage to utilize the other python to Java components)


Understood, but I think there are a few options:

  • Use Python to execute a Java application installed elsewhere. If you know that `java -jar /opt/my-code/foo.jar` is what you need, there's no reason that that can't be invoked by a small Python wrapper.
  • Use Jython (or similar scripting language) to invoke your Java code.
  • Try using the imagej-omero wrapper.
  • Register another script file type to match your needs.

Perhaps you could tell us a bit more about the Java code you want to invoke?

Cheers,
~Josh.