ij.gui
Class PolygonRoi

java.lang.Object
  extended by ij.gui.Roi
      extended by ij.gui.PolygonRoi
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
FreehandRoi

public class PolygonRoi
extends Roi

This class represents a polygon region of interest or polyline of interest.


Field Summary
protected  java.awt.Graphics g
           
protected  int maxPoints
           
protected  int nPoints
           
protected  int[] xp
           
protected  int[] xp2
           
protected  int[] yp
           
protected  int[] yp2
           
 
Fields inherited from class ij.gui.Roi
clipboard, clipHeight, clipWidth, clipX, clipY, constrain, CONSTRUCTING, FREELINE, FREEROI, HANDLE_SIZE, ic, imp, LINE, MOVING, NORMAL, oldHeight, oldWidth, oldX, oldY, OVAL, pasteMode, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, TRACED_ROI, type, updateFullWindow, xMax, yMax
 
Constructor Summary
PolygonRoi(int[] xPoints, int[] yPoints, int nPoints, ImagePlus imp, int type)
          Creates a new polygon or polyline ROI from x and y coordinate arrays.
PolygonRoi(int ox, int oy, ImagePlus imp)
          Creates a new user-generated polygon or polyline ROI.
 
Method Summary
 boolean contains(int x, int y)
           
 void draw(java.awt.Graphics g)
           
 void drawPixels()
           
 double getAngle()
          Returns the angle in degrees between the first two segments of this polyline.
 double getLength()
          Returns the perimeter (for ROIs) or length (for lines).
 int[] getMask()
           
 int getNCoordinates()
          Returns the number of XY coordinates.
 int[] getXCoordinates()
          Returns this ROI's X-coordinates, which are relative to origin of the bounding box.
 int[] getYCoordinates()
          Returns this ROI's Y-coordinates, which are relative to origin of the bounding box.
protected  void grow(int x, int y)
           
protected  void handleMouseUp(int sx, int sy)
           
protected  void updatePolygon()
           
 
Methods inherited from class ij.gui.Roi
abortPaste, clone, endPaste, getAngle, getBoundingRect, getColor, getState, getType, handleMouseDown, handleMouseDrag, nudge, nudgeCorner, setColor, setImage, setLocation, setPasteMode, showStatus, toString, updateClipRect
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maxPoints

protected int maxPoints

xp

protected int[] xp

yp

protected int[] yp

xp2

protected int[] xp2

yp2

protected int[] yp2

nPoints

protected int nPoints

g

protected java.awt.Graphics g
Constructor Detail

PolygonRoi

public PolygonRoi(int ox,
                  int oy,
                  ImagePlus imp)
Creates a new user-generated polygon or polyline ROI.


PolygonRoi

public PolygonRoi(int[] xPoints,
                  int[] yPoints,
                  int nPoints,
                  ImagePlus imp,
                  int type)
Creates a new polygon or polyline ROI from x and y coordinate arrays. Type must be Roi.POLYGON, Roi.FREEROI, Roi.TRACED_ROI or Roi.POLYLINE.

Method Detail

draw

public void draw(java.awt.Graphics g)
Overrides:
draw in class Roi

drawPixels

public void drawPixels()
Overrides:
drawPixels in class Roi

grow

protected void grow(int x,
                    int y)
Overrides:
grow in class Roi

updatePolygon

protected void updatePolygon()

handleMouseUp

protected void handleMouseUp(int sx,
                             int sy)
Overrides:
handleMouseUp in class Roi

contains

public boolean contains(int x,
                        int y)
Overrides:
contains in class Roi

getMask

public int[] getMask()
Overrides:
getMask in class Roi

getLength

public double getLength()
Returns the perimeter (for ROIs) or length (for lines).

Overrides:
getLength in class Roi

getAngle

public double getAngle()
Returns the angle in degrees between the first two segments of this polyline.


getNCoordinates

public int getNCoordinates()
Returns the number of XY coordinates.


getXCoordinates

public int[] getXCoordinates()
Returns this ROI's X-coordinates, which are relative to origin of the bounding box.


getYCoordinates

public int[] getYCoordinates()
Returns this ROI's Y-coordinates, which are relative to origin of the bounding box.