Distance measurement displayed in image

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

Distance measurement displayed in image

Stefan Kapser
Dear ImageJ-users,
it is easy to perform measurements in ImageJ, but the values are always
displayed in a separate window. Next to the drawn line in the image only
the measurement number is displayed.
Is there a way to display the length of the measured straight line directly
next to this straight line within the image?
Thanks a lot for your help!
Stefan

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

Re: Distance measurement displayed in image

Rasband, Wayne (NIH/NIMH) [E]
On May 28, 2014, at 10:43 AM, Stefan Kapser wrote:

> Dear ImageJ-users,
> it is easy to perform measurements in ImageJ, but the values are always
> displayed in a separate window. Next to the drawn line in the image only
> the measurement number is displayed.
> Is there a way to display the length of the measured straight line directly
> next to this straight line within the image?
> Thanks a lot for your help!
> Stefan

The following is a macro that creates a custom Measure command that labels line selections with the measured length and area selections with the measured area. Installing it creates a Plugins>Macros>Measure and Label [m] command that has a "m" keyboard shortcut. Add it to the ImageJ/macros/StartupMacros.txt file to have it installed when ImageJ starts up.

-wayne

  macro "Measure and Label [m]" {
     run("Measure");
     label = "" + getResult("Length", nResults-1);
     if (label=="NaN" || label=="0")
         label = "" + getResult("Area", nResults-1);
     Roi.setName(label);
     Overlay.addSelection;
  }

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