Login  Register

Re: Getting Coordinates of Line Selection

Posted by Michael Schmid on Jul 23, 2007; 11:12am
URL: http://imagej.273.s1.nabble.com/Trying-to-understand-algorithms-tp3698773p3698777.html

On Wed, 18 Jul 2007, Ryohei Thomas Nakano wrote:

> I'm writing plugin using Straight Line selection.
> I want to get coordinate data or just an angle data is OK.
> (x1, y1)  and (x2, y2), or the angel.
> when rectangular selection was used, it greatly work,
> but i have no idea when straight line selection.
> I would be grateful for just a little help.

Hi,

in a macro you could also use
   if (selectionType() == 5) { //straight line selections only
     getSelectionCoordinates(xArray, yArray);
     startX = xArray[0];
     startY = yArray[0];
     endX = xArray[1];
     endY = yArray[1];
     //whatever you want to do here
   }

Michael