How to change value in Results table instead of insert

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

How to change value in Results table instead of insert

Peter van Loon
Hi,

I tried to change an existing value in the Results Table by the macro function: setResult("Column", row, value). This works, the value of the given row and column is changed the it behaves like an insert. All rows from the given row number and all rows below 'move' to the next row. The last row disappears.

I checked this by setting the values manually by a simple macro:

macro " Set Results table [s]" {
rowIndex = getNumber("rowIndex", 0)
setResult("Comment", rowIndex,"rowIndex: "+rowIndex+" nResults:"+nResults);
}


First I filled the table with 6 values from rowindex 0..6.
Results Table:
1 rowIndex: 0 nResults:0
2 rowIndex: 1 nResults:1
3 rowIndex: 2 nResults:2
4 rowIndex: 3 nResults:3
5 rowIndex: 4 nResults:4
6 rowIndex: 5 nResults:5
7 rowIndex: 6 nResults:6


Then I added again rowindex 2.
Results Table:
1 rowIndex: 0 nResults:0
2 rowIndex: 1 nResults:1
3 rowIndex: 2 nResults:7
4 rowIndex: 2 nResults:2
5 rowIndex: 3 nResults:3
6 rowIndex: 4 nResults:4
7 rowIndex: 5 nResults:5


The last row disappeared, rowindexes 2..5 moved to the next row, rowindex 2 was filled with the new string.

Is there a way to change values of Results table and not insert a value?
I was thinking of filling and updating an array and at last fill the Results table rows one by one from this array but I think there must be a better way.

Regards,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: How to change value in Results table instead of insert

Rasband, Wayne (NIH/NIMH) [E]
On Apr 10, 2014, at 6:01 PM, Peter van Loon wrote:

> Hi,
>
> I tried to change an existing value in the Results Table by the macro
> function: setResult("Column", row, value). This works, the value of the
> given row and column is changed the it behaves like an insert. All rows from
> the given row number and all rows below 'move' to the next row. The last row
> disappears.

This bug was fixed in ImageJ 1.48t. Here is the relevant description from the release notes (http://imagej.nih.gov/ij/notes.html):

   Thanks to Ted Toal, fixed a bug in the setResult() macro
   function that caused it to not work as expected when
   changing a string value in the Results table.

You can use the Help>Update ImageJ command to upgrade to the latest version of ImageJ (1.48u).

-wayne

> I checked this by setting the values manually by a simple macro:
>
> /macro " Set Results table [s]" {
> rowIndex = getNumber("rowIndex", 0)
> setResult("Comment", rowIndex,"rowIndex: "+rowIndex+" nResults:"+nResults);
> }/
>
> First I filled the table with 6 values from rowindex 0..6.
> *Results Table:
> 1 rowIndex: 0 nResults:0
> 2 rowIndex: 1 nResults:1
> 3 rowIndex: 2 nResults:2
> 4 rowIndex: 3 nResults:3
> 5 rowIndex: 4 nResults:4
> 6 rowIndex: 5 nResults:5
> 7 rowIndex: 6 nResults:6*
>
> Then I added again rowindex 2.
> *Results Table:
> 1 rowIndex: 0 nResults:0
> 2 rowIndex: 1 nResults:1
> 3 rowIndex: 2 nResults:7
> 4 rowIndex: 2 nResults:2
> 5 rowIndex: 3 nResults:3
> 6 rowIndex: 4 nResults:4
> 7 rowIndex: 5 nResults:5*
>
> The last row disappeared, rowindexes 2..5 moved to the next row, rowindex 2
> was filled with the new string.
>
> Is there a way to change values of Results table and not insert a value?
> I was thinking of filling and updating an array and at last fill the Results
> table rows one by one from this array but I think there must be a better
> way.
>
> Regards,
> Peter
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/How-to-change-value-in-Results-table-instead-of-insert-tp5007271.html
> Sent from the ImageJ mailing list archive at Nabble.com.

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

Re: How to change value in Results table instead of insert

Gabriel Landini
Something else about the Results table...
There is a delete row command:
IJ.deleteRows(index1, index2)

Is there a chance to add:
 a "deleteColumn" command?
 a "renameColumn" command?

Cheers

Gabriel

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