Open tischi opened 5 years ago
@tischi, it's great to see others interested in wrapping imagej2 tools for Galaxy!
The current Galaxy tools were written almost 5 years ago, but they are still maintained. We recently updated the tools to use the latest imagej2 lifeline version, and the tools are installed on the Galaxy / Europe instance.
However, the tool wrappers have not been altered much since they were initially written, so there are likely improved ways of writing them since many changes to the underlying imagej2 code have occurred over the past 5 years.
If you have experience writing Galaxy wrappers for command-line tools, you should have no problem developing wrappers for additional imagej2 tools. If you find better ways to handle the Jython and other components, we can certainly take a look at improving the current wrappers with your advice.
@gregvonkuster, thank you for the fast reply :-)
The new way of writing plugins for ImageJ2 is via Java classes called Command
and has a syntax like below:
@Plugin(type = Command.class, headless = true, menuPath = "Blur2d")
public class Blur2dCommand implements Command {
@Parameter( label = "Input image" )
public File inputImageFile;
@Parameter( label = "Blur radius [pixels]" )
public double radius;
@Parameter( label = "Output image", type = ItemIO.OUTPUT )
public File blurredOutputImageFile;
public void run()
}
One good thing is that one can automatically determine all input and output parameters of a Command
using Java code and thus automatically generate the corresponding Galaxy .xml
file using code like this (WIP):
https://github.com/tischi/fiji-galaxy-blur2d/blob/master/src/main/java/de/embl/cba/galaxy/GalaxyXmlCreator.java#L11
The other new thing is that all Command
s can be invoked headless from the command line, e.g., like this:
/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx --headless --run "Blur2d" "inputImageFile='/Users/tischer/Documents/fiji-galaxy-blur2d/src/test/resources/image2d.tif', outputImageFile='/Users/tischer/Documents/fiji-galaxy-blur2d/src/test/resources/image2d_blurred.tif',radius='4.0'"
This command line call can be also automatically generated, using the logic in the GalaxyXmlCreator.java
.
This would mean that one can for each Command fully automatically create the tool.xml which would simply trigger a command line call to a Fiji installation without the need for the Jython wrapper scripts.
What do you think?
This sounds great! The current tools also invoke commands headless from the command line - https://github.com/bgruening/galaxytools/blob/master/tools/image_processing/imagej2/imagej2_base_utils.py#L35. It's fantastic that you have been able to eliminate all Jython calls as this will greatly simplify Fiji tools for Galaxy.
When we recently updated the Fiji requirement here https://github.com/bioconda/bioconda-recipes/tree/master/recipes/fiji/20170530, I was hoping to eliminate the complexities for calling bUnwarpJ from the command line - https://github.com/bioconda/bioconda-recipes/blob/master/recipes/fiji/20170530/bunwarpj.sh, but didn't find a way. Do you have a clean solution for this as well?
Hi @gregvonkuster & @bgruening,
We are interested in running IJ2 code in Galaxy. Our idea was to write code that auto-generates the galaxy xml files for Imagej2
Command
s, which is the new way of writing ImageJ plugins. See for example here:But we also saw your way of doing things: https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2
We were wondering:
@sunyi000