Frage

**Sorry, I am very new to both python and java so I might not recognize that this has been answered and only needs adjusted for my situation.

Essentially I have a script manager that operates in a python environment and I need to pass data off to the bonej plugin for analysis, which should then return an array that will then be used by another python script for further analysis.

I have been directed to jython as a way to do this, but I can't figure out how to import imageJ as if it were a module.

I know that I can simply open imagej from a command line and direct it to analyze an image, but this is not what I need because it simply returns an average in a segment of bone.

Basically I need to tell imagej that it should analyze this segment of bone, return the array, then this next segment of bone. An additional python script interpolates the arrays onto a predefined background grid.

If anyone has some insight on how to achieve this back and fort from jython I would appreciate it.

War es hilfreich?

Lösung

You can indeed use Jython to call ImageJ. See the Jython scripting page on the Fiji wiki for an overview and lots of example code. One easy way to get started from within ImageJ is to use the Script Editor. You can then invoke your Jython scripts from the command line using the ImageJ launcher [instructions]. Or you can run them via the jython executable by adding the needed Java libraries to the classpath.

But beware: this does not provide total integration between Python libraries and Java ones. The problem is that many Python libraries are backed by C code, making them accessible only from CPython, and not from Jython. For example, the very popular SciPy and NumPy libraries cannot be called directly from Jython code.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top