Re: More ResultsTable Problems

Posted by David Webster on
URL: http://imagej.273.s1.nabble.com/More-ResultsTable-Problems-tp3690519p3690521.html

Wayne,

Hmm! It seems like either 1.43j or 1.43k8 has a bug. When I read the API for

"addValue(String column_name, double value)" it sort of implies that the
value goes to the column with the matching name column_name , if it exists.
Otherwise, column_name would be added to the table. It doesn't say anything
 about column number.

David

On Sat, Nov 7, 2009 at 9:22 AM, Wayne Rasband <[hidden email]> wrote:

> You can work around this problem by not calling ResultsTable.setHeading(),
> for example
>
>   ResultsTable rt  = new ResultsTable();
>
>   rt.incrementCounter();
>   rt.addValue("A", 0);
>   rt.addValue("B", 2);
>   rt.addValue("C", 3);
>   rt.show("TestResults Table");
>
> or by calling setHeading(), but starting with column 0 instead of column1
>
>   ResultsTable rt  = new ResultsTable();
>   rt.setHeading(0, "A");
>   rt.setHeading(1, "B");
>   rt.setHeading(2, "C");
>
>   rt.incrementCounter();
>   rt.addValue("A", 0);
>   rt.addValue("B", 2);
>   rt.addValue("C", 3);
>   rt.show("TestResults Table");
>
> -wayne
>
>
> On Nov 7, 2009, at 2:16 AM, David William Webster wrote:
>
> Wayne/All,
>>
>> There is a problem with ResultsTable for daily build 1.43k8.
>> If you run filter show below, you get these tow differing results.
>>
>> 1.43j
>>        A       B       C
>> 1       0       2       3
>>
>> 1.43k8
>>        A       A       B       C
>> 1       0       0       2       3
>>
>> import ij.plugin.*;
>> import ij.measure.ResultsTable;
>> public class TestResultsTable implements PlugIn
>> {
>>        public void run(String arg)
>>        {
>>                ResultsTable rt  = new ResultsTable();
>>                rt.reset();
>>                rt.setHeading(1, "A");
>>                rt.setHeading(2, "B");
>>                rt.setHeading(3, "C");
>>                rt.incrementCounter();
>>                rt.addValue("A", 0);
>>                rt.addValue("B", 2);
>>                rt.addValue("C", 3);
>>                rt.show("TestResults Table");
>>
>>        }
>> }
>>
>> David Webster
>>
>