Best Method for using ImageJ Plugins in python?

Hi Everyone,

I wanted to ask the community what the best method is for accessing ImageJ plugins in python. I know that you can write scripts/macros through jython, but it would be better for our workflow to use a different package. Does anyone have experience using ImageJ plugins with the PyImageJ package? Specifically, I am trying to utilize the MIST stitching plugin (https://github.com/usnistgov/MIST) and I am wondering what may be the most accessible way to access such a plugin in custom python scripts. Thanks for your help!

Edit: I have found that using the run_plugin feature with PyImageJ works great! If there are any other cool solutions that people have found I would love to hear them.

Hi,

Yes, This is a good first trial -

in your python script -

import imagej
import scyjava
import jgo

scyjava.config.add_option(’-Xmx6g’)
ij = imagej.init(‘C:\Programs\ImageJ2\Fiji.app’, headless=False) # Look up the documentation for this command online…
ij.py.run_plugin(“plugin name”)

Search either imagej.init() or ij.py.run_plugin() and you will find examples…
obviously, the .init() command should be modified to where your imagej2 resides or an official version that the script will download.
you will also need JRE 8 and pip install pyimagej…

1 Like