Hi Alex,
(I am CC'ing the IJ mailing list so that others having the same issue can see this answer)
On 2013.06.02, at 15:26 , Alex Diogenes wrote:
> The run("roi color coder",...) command doesn't seem to allow me to use declared variables,
> instead it seems to think the varibles are strings (or something else) and ignores their
> stored values.
>
> Below is the code I'm working on.
>
> var min;
> var max;
> var type;
>
> Dialog.create("ROI Color");
> Dialog.addChoice("Type:", newArray("Fire", "Ice", "blue_orange_icb", "brgbcmyw", "cool",
> "[Cyan Hot]", "edges", "gem", "glasbey", "[Green Fire Blue]"));
> Dialog.addNumber("Min:", 700);
> Dialog.addNumber("Max:", 21000);
> Dialog.show();
>
> min = Dialog.getNumber();
> max = Dialog.getNumber();;
> type = Dialog.getChoice();
>
> run("roi color coder", "lut=type range=min-max");
Arguments are passed to ImageJ commands as a single argument string.
The most succinct explanation of this is the Built-in Macro Functions page:
http://imagej.nih.gov/ij/developer/macro/functions.html#runA more detailed description is also available on the Introduction to the IJM:
http://imagej.nih.gov/ij/docs/macro_reference_guide.pdf"The arguments string is a single string in which all arguments are grouped, separated by
space characters, and given either in the form of keyword=value pairs for input fields or
choice lists, or as simple keyword for checkboxes."
So, in your case you need to do something like this:
min = Dialog.getNumber();
max = Dialog.getNumber();;
type = Dialog.getChoice();
run("Roi Color Coder", "lut="+ type +" range="+ min +"-"+ max);
Alternatively, using "&", something like:
run("Roi Color Coder", "lut=&type range=&min-&max");
Note that if one of your string variables contains spaces, it is wise to surround the
concatenated string by square brackets. E.g.: Look at what happens when running this
macro:
//
newTitle = "A title with spaces";
run("Blobs (25K)");
run("Duplicate...", "title=["+ newTitle +"]");
run("Duplicate...", "title="+ newTitle);
//
Hope that helps,
-tiago
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html