Measure command

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

Measure command

simon.boyce
Is it possible to customize which columns appear in the results  
window if you're just measuring the length of a line? I have no need  
for mean, min, max or angle. I just want length. I need this for a  
project where the result is easily and clearly legible on the screen.

Thanks for any help.

Simon
Reply | Threaded
Open this post in threaded view
|

Re: Measure command

Wayne Rasband
> Is it possible to customize which columns appear in the results window
> if you're just measuring the length of a line? I have no need for
> mean, min, max or angle. I just want length. I need this for a project
> where the result is easily and clearly legible on the screen.

When measuring lines, you can remove the mean, min and max from the
results by unchecking "Mean Gray Value" and "Min & Max Gray Value" in
Analyze>Set Measurements. To only record only the length, create a
custom "Measure Line" macro

   macro "Measure Line [l]" {
     if (selectionType!=5)
         exit("Straight line selection required");
     getPixelSize(unit, pw, ph);
     getLine(x1, y1, x2, y2, width);
     dx=(x2-x1)*pw; dy=(y2-y1)*ph;
     length = sqrt(dx*dx+dy*dy);
     setResult("Length", nResults, length);
     updateResults;
   }

and add it to StartupMacros.txt. After restarting ImageJ, you will be
able to record line lengths by pressing the "l" key.

Or create a macro tool the creates a line selection and measures its
length.

  macro "Line Length Tool -C00bL1de0L1ee1" {
         getPixelSize(unit, pw, ph);
         getCursorLoc(x, y, z, flags);
         xstart = x; ystart = y;
         x2=x; y2=y;
         while (flags&16!=0) {
             getCursorLoc(x, y, z, flags);
             if (x!=x2 || y!=y2)
                 makeLine(xstart, ystart, x, y);
             dx=(x-xstart)*pw; dy=(y-ystart)*ph;
             length = sqrt(dx*dx+dy*dy);
             showStatus("Length="+length+" "+unit);
             x2=x; y2=y;
             wait(10);
         };
        setResult("Length", nResults, length);
        updateResults;
     }

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Measure command

simon.boyce
Great, many thanks. Simon
On May 31, 2006, at 12:38 PM, Wayne Rasband wrote:

>> Is it possible to customize which columns appear in the results  
>> window if you're just measuring the length of a line? I have no  
>> need for mean, min, max or angle. I just want length. I need this  
>> for a project where the result is easily and clearly legible on  
>> the screen.
>
> When measuring lines, you can remove the mean, min and max from the  
> results by unchecking "Mean Gray Value" and "Min & Max Gray Value"  
> in Analyze>Set Measurements. To only record only the length, create  
> a custom "Measure Line" macro
>
>   macro "Measure Line [l]" {
>     if (selectionType!=5)
>         exit("Straight line selection required");
>     getPixelSize(unit, pw, ph);
>     getLine(x1, y1, x2, y2, width);
>     dx=(x2-x1)*pw; dy=(y2-y1)*ph;
>     length = sqrt(dx*dx+dy*dy);
>     setResult("Length", nResults, length);
>     updateResults;
>   }
>
> and add it to StartupMacros.txt. After restarting ImageJ, you will  
> be able to record line lengths by pressing the "l" key.
>
> Or create a macro tool the creates a line selection and measures  
> its length.
>
>  macro "Line Length Tool -C00bL1de0L1ee1" {
>         getPixelSize(unit, pw, ph);
>         getCursorLoc(x, y, z, flags);
>         xstart = x; ystart = y;
>         x2=x; y2=y;
>         while (flags&16!=0) {
>             getCursorLoc(x, y, z, flags);
>             if (x!=x2 || y!=y2)
>                 makeLine(xstart, ystart, x, y);
>             dx=(x-xstart)*pw; dy=(y-ystart)*ph;
>             length = sqrt(dx*dx+dy*dy);
>             showStatus("Length="+length+" "+unit);
>             x2=x; y2=y;
>             wait(10);
>         };
>        setResult("Length", nResults, length);
>        updateResults;
>     }
>
> -wayne
>