I am trying to pass an argument from an ImageJ plugin to an imageJ macro. Basically, I call the macro from within my ImageJ Java plugin to open a stack of images and would like to be able to pass an integer value to the plugin to be able to append it to the end of a file path.
Right now I am able to open a stack of images, perform whatever operations I need to do to the active image inside the plugin, and then close the image stack so I can open the next stack of images.
This is the basic format of what I am doing in the Java Plugin:
(general import stuff)
import ij.plugin.Macro_Runner;
Macro_Runner test_runner = new Macro_Runner();
test_runner.run("OpenFrameSequence.ijm");
// pixel analysis
test_runner.run("closeMacro.ijm");**
Here is the Macro OpenFrameSequence.ijm:
var x = 0;
x = getNumber("Bias Frame Sequence Length:", x);
run("Image Sequence...", "open=[C:\\Documents and Settings\\Developer\\Desktop\\PLPT_IMAGEJ_PICS\\BiasFrameSequence\\1.jpg] number=x sort use");
Here is the Macro closeMacro.imj
close();
The fourth line in the plugin section above is what I am having trouble with, there is another function that I can call runMacro();
which is defined here:
http://rsbweb.nih.gov/ij/developer/api/ij/plugin/Macro_Runner.html
So what I want to do is this:
int i = 1;
test_runner.runMacro("OpenFrameSequence.ijm", i);
And then, in the macro, take the value of i and use it as a variable. The runMacro() function doesn't seem to be working (i've also tried to send a String in place of the int i).
Any help would be appreciated.