Login  Register

Re: Using results from plugins in scripts

Posted by ctrueden on Oct 31, 2013; 6:41pm
URL: http://imagej.273.s1.nabble.com/Using-results-from-plugins-in-scripts-tp5005391p5005410.html

Hi Marcello,

> What I want is access to one (or all) of these result images in my
> calling script.  Is there a way (in Jython) to 'drill down' into the
> plugin in order to get the ImagePlus objects for these results?

Let's look at the source code for Colour_Deconvolution:
https://github.com/fiji/fiji/blob/master/src-plugins/Colour_Deconvolution/src/main/java/Colour_Deconvolution.java

You can see that all work is done in the run(String) method and three
ImagePlus objects are created and shown at the end. There is no recourse.
The plugin would need to be refactored to split the work into helper
methods which return the ImagePlus objects without showing them. Then you
could call that Java API from Jython to use it as a library.

I encourage you to make these changes and then file a pull request on
GitHub so that we can improve the plugin in the core Fiji distribution. See:
https://help.github.com/articles/using-pull-requests

Regards,
Curtis


On Wed, Oct 30, 2013 at 5:17 PM, Marcello DiStasio <[hidden email]>wrote:

> Hello ImageJ list, and apologies if this isn't the appropriate venue for
> this question, but I have been unable to come up with an obvious answer
> elsewhere.
>
> I want to use a plugin (one that is a standard plugin bundled with Fiji as
> a *.jar in the ./Fiji.app/plugins directory -- specifically
> 'Colour_Deconvolution') as part of an image processing pipeline that I am
> writing using Jython.  I am able to run the command as recorded by the
> Macro Recorder using the IJ.run method:
>
> IJ.run(imp, "Colour Deconvolution", "vectors=H&E")
>
> The problem is that this method returns nothing to the calling script.  The
> method runs the command in Fiji, and 3 result images are generated and
> shown.  What I want is access to one (or all) of these result images in my
> calling script.  Is there a way (in Jython) to 'drill down' into the plugin
> in order to get the ImagePlus objects for these results?
>
> Thanks!
> -Marcello
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html