Login  Register

Re: get selection perimeter in macro

Posted by Justin McGrath on Feb 26, 2008; 2:57am
URL: http://imagej.273.s1.nabble.com/get-selection-perimeter-in-macro-tp3697084p3697085.html

The easiest way that I cant think of is this:
run("Measure");
x = getResult("Perim.",nResults-1);

You need to have Perimeter selected in Analyze->Set Measurements.  If you
want to set it in your macro, you can use:
run("Set Measurements...", "  perimeter");

Justin

On Mon, Feb 25, 2008 at 11:33 AM, Michael Doube <[hidden email]>
wrote:

> Hi All
>
> I'd like to return the perimeter of a wand selection as a variable in my
> macro.  So far, all I can get is
>
> getSelectionCoordinates(xCoordinates, yCoordinates);
> perimeter = lengthOf(xCoordinates);
>
> which is not correct as edge pixels should be counted as sqrt(2).
>
> How can I get a similar result to:
> *getTracedPerimeter()
>
> in a macro?
>
> Mike*
>