reset nResults

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

reset nResults

Jörg Walter
hello,

i'm trying to write a macro for read out certain dicom data for several mr-images and save them in the result table. therefor i go with a loop to every image writing the data to the table by

setResult(names[i], nResults, "Patient ID");
setResult("Value a" +i, nResults - 1, PID);

the problem that i now have is that i don't have any clue how to reset nResults to write the data for the second, third and so on image in the first row of the new column.

best
joerg
Reply | Threaded
Open this post in threaded view
|

Re: reset nResults

dscho
Hi Jörg,

On Wed, 2 Apr 2014, Jörg Walter wrote:

> i'm trying to write a macro for read out certain dicom data for several
> mr-images and save them in the result table. therefor i go with a loop to
> every image writing the data to the table by
>
> setResult(names[i], nResults, "Patient ID");
> setResult("Value a" +i, nResults - 1, PID);
>
> the problem that i now have is that i don't have any clue how to reset
> nResults to write the data for the second, third and so on image in the
> first row of the new column.
The purpose of nResults is not to be a counter, but to return the number
of rows in the results table.

It just happens to work for you in the first run.

Why not use the variable i for that purpose? You might need to add or
subtract 1 for it to agree with nResults - 1 in the first run, but after
fixing it, you will get the correct row numbers in the subsequent runs.

Ciao,
Johannes

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

Re: reset nResults

Jörg Walter
hi johannes,

thanks for your respond. i've solved the problem in the same way by adding a variable and reset it after every loop.

best joerg