Login  Register

Setting A Result by Label

Posted by Wilson R S (AT) on Feb 21, 2011; 11:44am
URL: http://imagej.273.s1.nabble.com/Setting-A-Result-by-Label-tp3685599.html

Hi Listers,

I am using a number of different macro to create custom measurements. However I wish to set these measurement in the same row if they are from the same image. I am using the macro code below:

break=false;
i=0;
n=0;
while (i<nResults && break!=true)
{
                label=getResult("Label",i);
                if (label == title)
                {
                                n=i;
                                break=true;
                }else{
                                n=nResults;
                                i++;
                }
}

setResult("Label", n, title);
setResult("Measurement", n, Measurement);

Where title is the title/label of the of the current image, and Measurement is some calculated number.
The macro (should) check all row of the results table and if the current label exists set the measurement to the corresponding row, if the label does not exits  a new row should be created for the result.

In essence I do not want any label to appear twice in a single results table.

I hope I have been clear, any help would be much appreciated, or if someone knows of an easier/different way of doing this.

Thanks in advance.

Rhod