run("New... ", "name="+name+" type=Table");

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

run("New... ", "name="+name+" type=Table");

Simon Roussel
Dear All,
In a macro, one can construct a "table text file", with column headings and
then print texts (Unless the Result table which accepts text only in the
first column with a "Label" heading), usin things like:
   run("New... ", "name="+f+" type=Table");
   print(f,"\\Headings:<tab-delimited list>");
   print(f, "something \t etc");

From the "news" below, I expected to be able to save and later reopen my
table, with columns, headings and text:

1.38r, 11 May 2007
    * Added the File>Import>Results command, which opens an ImageJ Results
table, or any tab or comma-delimited text file. This command is based on
Jerome Mutterer's Import_Results_Table macro.

But, if I do File>Import>Results, texts are replaced by "NaN", and if I do
File>Import>Text File, I do not get "columns" with headings, but only a
simple text file, with the headings in the first line.

Did I missed something ? Is there a way to reopen my text table containing
texts with columns and headings ?

Thanks
Simon
Reply | Threaded
Open this post in threaded view
|

Re: run("New... ", "name="+name+" type=Table");

Gabriel Landini
On Thursday 05 June 2008, Simon Roussel wrote:
> But, if I do File>Import>Results, texts are replaced by "NaN", and if I do
> File>Import>Text File, I do not get "columns" with headings, but only a
> simple text file, with the headings in the first line.
>
> Did I missed something ? Is there a way to reopen my text table containing
> texts with columns and headings ?

That happens because (as far as I know and please correct if I am wrong) the
Results Table where your results are being imported to is almost exclusively
numeric -- it only supports a single column with text (called "Label").

You can print things in a Results Table "window" (as you showed with the print
command)  but that does not go "into" the table itself.

To put things into the table you need to use setResult(column, row, value) or
setResult("Label", row, string)

You can have only 1 Results Table at a time where you can access the data with
getResult(column, row).

If you stick to only 1 string column called Label, you may be able to load it
back and this time it will go into the table.

Think it this way: the Results Table is a set of arrays, and their contents
are shown in a Results *window* (which you can see). You can also print more
things in that window with the print( ) command, but these values do not go
into the arrays. You need to use the setResult function for that.
You can still see and save things that you print( )ed but they cannot be
retrieved with the getResult function.

The other option is to open it as text, but if they are tab delimited, tabs
will not show up (but will if it is dropped into IJ, which is a bit odd).

I hope it helps

G.
Reply | Threaded
Open this post in threaded view
|

Re: run("New... ", "name="+name+" type=Table");

Wayne Rasband
In reply to this post by Simon Roussel
The File>Import>Results command in the 1.41e daily build can open tab
and comma delimited tables containing non-numeric data. Non-numeric
tables are opened in a separate window since the Results table, except
for the "Label" column, is limited to numeric data. The
File>Import>Results command is implemented by the macro at

     http://rsb.info.nih.gov/ij/source/macros/ImportResultsTable.txt

-wayne

On Jun 5, 2008, at 12:14 PM, Simon Roussel wrote:

> Dear All,
> In a macro, one can construct a "table text file", with column
> headings and
> then print texts (Unless the Result table which accepts text only in
> the
> first column with a "Label" heading), usin things like:
>    run("New... ", "name="+f+" type=Table");
>    print(f,"\\Headings:<tab-delimited list>");
>    print(f, "something \t etc");
>
> From the "news" below, I expected to be able to save and later reopen
> my
> table, with columns, headings and text:
>
> 1.38r, 11 May 2007
>     * Added the File>Import>Results command, which opens an ImageJ
> Results
> table, or any tab or comma-delimited text file. This command is based
> on
> Jerome Mutterer's Import_Results_Table macro.
>
> But, if I do File>Import>Results, texts are replaced by "NaN", and if
> I do
> File>Import>Text File, I do not get "columns" with headings, but only a
> simple text file, with the headings in the first line.
>
> Did I missed something ? Is there a way to reopen my text table
> containing
> texts with columns and headings ?
>
> Thanks
> Simon
>