Posted by
Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/running-a-plugin-from-a-macro-WITH-options-selected-tp4999850p4999870.html
On Aug 26, 2012, at 8:35 PM, rrmarino wrote:
> Hello,
>
> I need to run the plugin differentials
> (
http://bigwww.epfl.ch/thevenaz/differentials/) with the option "Gradient
> Magnitude" from a macro
>
> When I choose Macro Record in ImageJ menu, it just records:"
> run("Differentials "); " , which opens the plugin window if I run it from a
> macro.
>
> What I actually need is to run the plugin WITH the option "Gradient
> Magnitude" with no option window at all. I tried already "
> run("Differentials ", "Gradient Magnitude"); " with no success.
>
> Is there anyway to do it?
This plugin is not compatible with the ImageJ macro language because it does not use the GenericDialog class. Fortunately, the source code is available so you can easily work around this problem. Copy the file "Differentials_.java" into the ImageJ plugins folder, open it by dragging and dropping it onto the "ImageJ" window, change the line
private static int operation = LAPLACIAN;
to
private static int operation = GRADIENT_MAGNITUDE;
remove, or comment out, these 10 lines
differentialsDialog dialog = new differentialsDialog(IJ.getInstance(),
"Differentials", true, operation);
GUI.center(dialog);
dialog.setVisible(true);
cancel = dialog.getCancel();
operation = dialog.getOperation();
dialog.dispose();
if (cancel) {
return;
}
then compile and run the plugin using Plugins>Compile and Run command.
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html