Posted by
Michael Schmid on
Jul 09, 2007; 1:55pm
URL: http://imagej.273.s1.nabble.com/stack-threshold-tp3698921p3698927.html
Hi Charlotte,
if the macro calls the plugin, you could simply use the
GenericDialog in the plugin, and pass the values as parameters
(run the plugin manually and use Macro>Record to see how to do
this).
In case your macro does not call the plugin, you can save the
data as global variables (use the "var" macro statement) and
make a wrapper macro for the plugin that calls the plugin with
these variables passed to the GenericDialog.
Otherwise, you have to store the values somewhere else, e.g.
with macro function setMetadata into the ImagePlus, and use
String metadata = (String)imp.getProperty("Info");
for non-stack images or
String metadata = imp.getStack().getSliceLabel(imp.getCurrentSlice
());
for stacks.
Of course, you can also write the data into a file with a
fixed name and read the file in the plugin.
A disadvantage of these ways is that you will have to decode
strings to get numbers in your plugin.
Michael
________________________________________________________________
On 9 Jul 2007, at 14:32, Holmes, Charlotte wrote:
> Hi
>
> I was wondering if there was an easy way for a plugin to get
> information
> from a macro?
>
> I have an old macro I use to put a grid on an image. I have now
> developed a plugin to help analyse the image with the grid on it
> however
> to go forward I really need the locations of the grid points.
> I could to this within the plugin but it would be a lot of work when I
> have the macro there with the information in it.
>
> Thanks
> Lottie