adding to Results table zeros out the line above

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

adding to Results table zeros out the line above

jmarks
Hello All,
Using IJ v1.48v,  I am trying to write custom fields to the Results table, using setResult, using nResults as the current line number.

run("Set Measurements...", "redirect=None decimal=6");
setResult("Membrane area", nResults, MembraneArea );
setResult("FRET area", nResults-1, areaFRET);    // nResults is now increased by 1, so must write to previous line to stay on the same line  as the entry above.
setResult("mean FRET", nResults-1, meanFRET );
setResult("Std Dev", nResults-1, stddevFRET );
setResult("FRET Area percent", nResults-1, FRETperAreaPercent );
normFRET = FRETperAreaPercent  * meanFRET ;
setResult("Normalized FRET", nResults-1, normFRET );
updateResults() ;

Everything works fine on the first pass. For each subsequent loop, the new line gets written to the next line of Results window correctly. The problem is that the results on the line above have all been changed to zeros.

What am I doing wrong?

thanks for any suggestions!

Jeremy D. Marks, PhD, MD, FRCPC
Associate Professor
Departments of Pediatrics and Neurology, and the College
University of Chicago
900 East 57th Street, Room 4130
Chicago, IL 60637



Jeremy D. Marks, PhD, MD, FRCPC
Associate Professor
Departments of Pediatrics and Neurology, and the College
University of Chicago
900 East 57th Street, Room 4130
Chicago, IL 60637


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

Re: adding to Results table zeros out the line above

Rasband, Wayne (NIH/NIMH) [E]
On Jun 26, 2014, at 5:24 PM, Jeremy Marks wrote:

> Hello All,
> Using IJ v1.48v,  I am trying to write custom fields to the Results table, using setResult, using nResults as the current line number.

The value returned by nResults() can change so it is better to assign the value it returns to a variable. The following example does this and it works as expected.

-wayne

  macro "Measure Area and Mean [m]" {
     List.setMeasurements;
     area = List.getValue("Area");
     mean = List.getValue("Mean");
     row = nResults;
     setResult("Area", row, area);
     setResult("Mean", row, mean);
     updateResults;
  }


>
> run("Set Measurements...", "redirect=None decimal=6");
> setResult("Membrane area", nResults, MembraneArea );
> setResult("FRET area", nResults-1, areaFRET);    // nResults is now increased by 1, so must write to previous line to stay on the same line  as the entry above.
> setResult("mean FRET", nResults-1, meanFRET );
> setResult("Std Dev", nResults-1, stddevFRET );
> setResult("FRET Area percent", nResults-1, FRETperAreaPercent );
> normFRET = FRETperAreaPercent  * meanFRET ;
> setResult("Normalized FRET", nResults-1, normFRET );
> updateResults() ;
>
> Everything works fine on the first pass. For each subsequent loop, the new line gets written to the next line of Results window correctly. The problem is that the results on the line above have all been changed to zeros.
>
> What am I doing wrong?
>
> thanks for any suggestions!
>
> Jeremy D. Marks, PhD, MD, FRCPC
> Associate Professor
> Departments of Pediatrics and Neurology, and the College
> University of Chicago
> 900 East 57th Street, Room 4130
> Chicago, IL 60637
>
>
>
> Jeremy D. Marks, PhD, MD, FRCPC
> Associate Professor
> Departments of Pediatrics and Neurology, and the College
> University of Chicago
> 900 East 57th Street, Room 4130
> Chicago, IL 60637
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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