> On Feb 13, 2020, at 2:46 AM, Michael Elbaum <
[hidden email]> wrote:
>
> Hi all,
>
>
> continuing the thread of passing parameters in a headless macro, I'm trying to import and use a previously-saved Results table.
There is currently no way to work with a Results table in a headless macro. The macro will attempt to display the table, which will throw an exception. The work around is use a scripting language, as in the following JavaScript example, which opens a table (without displaying it), prints a summary of the table and lists all the “Area” values.
rt = ResultsTable.open(filePath);
print(rt);
for (i=0; i<rt.size(); i++)
print(i+" "+rt.getValue("Area",i));
-wayne
> this syntax works as expected when called from command-line (java -jar ij.jar -macro ...) but not headless (./ImageJ-linux64 --ij2 --headless -macro ...):
>
>
> resultpath = filepath + File.nameWithoutExtension + "_CS_gnuraw.tsv" (for example)
> print(resultpath); (looks fine)
> run("Results... ", "open=[resultpath]");
>
>
> The error is:
>
> Macro Error: No results found in line 19
> so it seems that it isn't able to open the Results file.
>
>
> Getting it to work from command line was also tricky because it tended to open the import dialog rather then the file itself. I've chosen .tsv for tables in Edit > Option > Input/Output, following an earlier post.
>
>
> happy for any suggestions. the imagej website seems to be down now so the macro examples are inaccessible.
>
>
> tia,
>
> Michael
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html