Re: Measure command
Posted by Wayne Rasband on May 31, 2006; 5:38pm
URL: http://imagej.273.s1.nabble.com/Measure-command-tp3702627p3702628.html
> 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