Table.getColumn fails with the Label column

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

Table.getColumn fails with the Label column

Stein Rørvik
I want to extract the Label and Area column from a results table and display these in a separate table.
I try to do it with the Table.* functions but it does not work.

Running the demo macro below, an exception is thrown:
                java.lang.IllegalArgumentException: "Label" column not found
                at ij.measure.ResultsTable.getColumnAsVariables(ResultsTable.java:617)

Perhaps this is because the Labels column consists of strings, and this situation is not handled correctly?
Perhaps we need a new Table.getStringColumn(columnName) command to differentiate string columns from number columns?

There are already separate commands for reading numeric and string values from cells:

                numValue = Table.get(columnName, rowIndex)
                strValue = Table.getString(columnName, rowIndex)

so perhaps there should be also

                numArray = Table.getColumn(columnName)
                strArray = Table.getStringColumn(columnName)


Stein


Demo macro:
----------

run("Blobs (25K)");
setAutoThreshold("Default");
run("Set Measurements...", "area mean standard stack display redirect=None decimal=4");
run("Analyze Particles...", "size=500-Infinity display clear include in_situ");

areas = Table.getColumn("Area");
print("Area is now copied");

labels = Table.getColumn("Label");         //fails silently, aborts macro
print("Label is now copied");                     //never printed

Table.showArrays("Results Extracted", areas, labels);
Table.update;

----------

I am using daily build ImageJ 1.52k with Java 1.6 on Windows 7/64-bit.

Stein


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Table.getColumn fails with the Label column

Wayne Rasband-2
> On Jan 11, 2019, at 5:55 AM, Stein Rørvik <[hidden email]> wrote:
>
> I want to extract the Label and Area column from a results table and display these in a separate table.
> I try to do it with the Table.* functions but it does not work.

This bug is fixed in the latest daily build (1.52k19).

-wayne

> Running the demo macro below, an exception is thrown:
>                java.lang.IllegalArgumentException: "Label" column not found
>                at ij.measure.ResultsTable.getColumnAsVariables(ResultsTable.java:617)
>
> Perhaps this is because the Labels column consists of strings, and this situation is not handled correctly?
> Perhaps we need a new Table.getStringColumn(columnName) command to differentiate string columns from number columns?
>
> There are already separate commands for reading numeric and string values from cells:
>
>                numValue = Table.get(columnName, rowIndex)
>                strValue = Table.getString(columnName, rowIndex)
>
> so perhaps there should be also
>
>                numArray = Table.getColumn(columnName)
>                strArray = Table.getStringColumn(columnName)
>
>
> Stein
>
>
> Demo macro:
> ----------
>
> run("Blobs (25K)");
> setAutoThreshold("Default");
> run("Set Measurements...", "area mean standard stack display redirect=None decimal=4");
> run("Analyze Particles...", "size=500-Infinity display clear include in_situ");
>
> areas = Table.getColumn("Area");
> print("Area is now copied");
>
> labels = Table.getColumn("Label");         //fails silently, aborts macro
> print("Label is now copied");                     //never printed
>
> Table.showArrays("Results Extracted", areas, labels);
> Table.update;
>
> ----------
>
> I am using daily build ImageJ 1.52k with Java 1.6 on Windows 7/64-bit.
>
> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html