Login  Register

Measure + label with result macro

Posted by OMANSEN, Till Frederik on Oct 17, 2017; 9:50am
URL: http://imagej.273.s1.nabble.com/Measure-label-with-result-macro-tp5019553.html

Hello!
 
I’m looking for a macro with which I can
 
a)      measure an angle, or distance (line tool) or area (oval or polygon selection tool)
b)      display the result of that measurement (i.e. angle, or area or length)
c)       adds this selection to the overlay in yellow.
 
So far especially b proved to be difficult most macros I found just lable with A,B,C or numbers not with the result.
 
So I found this one but it does not work..
 
 macro "Measure and Label [m]" {
     run("Measure");
     label = "" + getResult("Length", nResults-1);
     if (label=="NaN" || label=="0")
         label = "" + getResult("Area", nResults-1);
label = "" + getResult("Angle", nResults-1);
     Roi.setName(label);
     Overlay.addSelection;
  }
 
 
 
Maybe someone can help to debug?
 
Thanks, Till



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