Posted by
Michael Schmid on
Jun 15, 2016; 8:07am
URL: http://imagej.273.s1.nabble.com/launch-functions-in-java-tp5016624p5016652.html
Hi Philippe,
as I said, I have no experience with macro extensions. There is a bit of
documentation at
https://imagej.nih.gov/ij/macros/MacroExtensions.txtOne obvious way of accessing macro extensions in a plugin would be
calling a short macro by
IJ.runMacro(String macro)
Concerning public methods: For calling a plugin from other plugins, I
think this should be obvious. A macro can call only static methods:
https://imagej.nih.gov/ij/developer/macro/functions.html#callThis method can also return a String.
An example for calling a static function is my Versatile_Wand:
http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:versatile_wand:startIt can be called via
call("Versatile_Wand_Tool.doWand", x, y, tolerance, colorSensitivity,
gradientTolerance, "options");
and the plugin has a method
public static void doWand(String xStartS, String yStartS,
String toleranceS, String colorS, String gradientS, String options)
In this method, the strings are converted (parsed) to numbers where
appropriate, and then a new instance of the plugin is created and gets
the arguments to do the work.
Michael
________________________________________________________________
On 2016-06-13 14:50, Philippe CARL wrote:
> Hi Michael,
> How are you doing?
> I had finally figured out the first version (i.e. with the
> imp.show()
added after each IJ.openImage) but the alternative version is what I was
actually looking for (to be faster since the pictures are not shown).
> Nevertheless, I didn't expect the needed code to be so complicated,
thus thanks a lot for sharing it!!!
> I can modify the plugin I working on, thus all options are open and
> Iwould prefer to choose the most adapted and efficient one.
> Also would you have an example to link me with where there is a
"public method of the plugin that gets called"?
> The issue is that the plugin has already " ij.macro.MacroExtension"
features and when I try to launch it through a "IJ.run" I get the "Macro
must be running to install macro extensions" error which corresponds to
the case (interp==null) of the "registerExtensions" method within the "
ij.macro.Functions.java" class.
> Which obviously means that I'm doing something wrong here and I'm
> kindof stuck...
> I thank you very much in advance for your help. > Kindest regards,
> Philippe
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html