Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ij.gui
Class PolygonRoi

    java.lang.Object
      ij.gui.Roi
          ij.gui.PolygonRoi

All Implemented Interfaces:
  java.lang.Cloneable, java.io.Serializable

Direct Known Subclasses:
  FreehandRoi, PointRoi

public class PolygonRoi
extends Roi

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

See Also:
  Serialized Form

Field Summary
`protected int` | `maxPoints`
`protected int` | `nPoints`
`protected int` | `splinePoints`
`protected int[]` | `xp`
`protected int[]` | `xp2`
`protected int[]` | `xScreenSpline`
`protected int[]` | `xSpline`
`protected int[]` | `yp`
`protected int[]` | `yp2`
`protected int[]` | `yScreenSpline`
`protected int[]` | `ySpline`

Fields inherited from class ij.gui.Roi
`ANGLE, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, imp, instanceColor, LINE, mag, MOVING, MOVING_HANDLE, name, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, OVAL, pasteMode, POINT, 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)` Obsolete
`PolygonRoi(int[] xPoints, int[] yPoints, int nPoints, int type)` Creates a new polygon or polyline ROI from x and y coordinate arrays.
`PolygonRoi(int sx, int sy, ImagePlus imp)` Starts the process of creating a new user-generated polygon or polyline ROI.
`PolygonRoi(java.awt.Polygon p, int type)` Creates a new polygon or polyline ROI from a Polygon.

Method Summary
`protected void` | `addOffset()`
`java.lang.Object` | `clone()` Returns a copy of this PolygonRoi.
`boolean` | `contains(int x, int y)`
`void` | `draw(java.awt.Graphics g)`
`void` | `drawPixels(ImageProcessor ip)` Draws the selection outline on the specified ImageProcessor.
`void` | `fitSpline(int evaluationPoints)`
`double` | `getAngle()` Returns the angle in degrees between the first two segments of this polyline.
`double` | `getFeretsDiameter()` Returns Feret's diameter, the greatest distance between any two points along the ROI boundary.
`double` | `getLength()` Returns the perimeter (for ROIs) or length (for lines).
`ImageProcessor` | `getMask()` Override Roi.nudge() to support splines.
`int` | `getNCoordinates()` Returns the number of XY coordinates.
`java.awt.Polygon` | `getPolygon()` Returns this PolygonRoi as a Polygon.
`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 sx, int sy)`
`protected void` | `handleMouseUp(int sx, int sy)`
`int` | `isHandle(int sx, int sy)` Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.
`protected void` | `mouseDownInHandle(int handle, int sx, int sy)`
`protected void` | `moveHandle(int sx, int sy)`
`protected void` | `updatePolygon()`

Methods inherited from class ij.gui.Roi
`abortPaste, drawPixels, endPaste, equals, getAngle, getBoundingRect, getBounds, getColor, getCurrentPasteMode, getName, getPasteMode, getState, getType, getTypeAsString, handleMouseDown, handleMouseDrag, isArea, isLine, isVisible, nudge, nudgeCorner, setColor, setImage, setInstanceColor, setLocation, setName, setPasteMode, showStatus, startPaste, toString, update, updateClipRect`

Methods inherited from class java.lang.Object
`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

### xSpline

    protected int[] xSpline

### ySpline

    protected int[] ySpline

### xScreenSpline

    protected int[] xScreenSpline

### yScreenSpline

    protected int[] yScreenSpline

### splinePoints

    protected int splinePoints

Constructor Detail

### PolygonRoi

    public PolygonRoi(int[] xPoints,
                      int[] yPoints,
                      int nPoints,
                      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, Roi.POLYLINE, Roi.FREELINE or Roi.ANGLE.

### PolygonRoi

    public PolygonRoi(java.awt.Polygon p,
                      int type)

  Creates a new polygon or polyline ROI from a Polygon. Type must be Roi.POLYGON, Roi.FREEROI, Roi.TRACED_ROI, Roi.POLYLINE, Roi.FREELINE or Roi.ANGLE.

### PolygonRoi

    public PolygonRoi(int[] xPoints,
                      int[] yPoints,
                      int nPoints,
                      ImagePlus imp,
                      int type)

  Obsolete

### PolygonRoi

    public PolygonRoi(int sx,
                      int sy,
                      ImagePlus imp)

  Starts the process of creating a new user-generated polygon or polyline ROI.

Method Detail

### draw

    public void draw(java.awt.Graphics g)

  Overrides:
    `draw` in class `Roi`

### drawPixels

    public void drawPixels(ImageProcessor ip)

  Description copied from class: `Roi`
  Draws the selection outline on the specified ImageProcessor.

  Overrides:
    `drawPixels` in class `Roi`
  See Also:
    `ImageProcessor.setColor(java.awt.Color)`, `ImageProcessor.setLineWidth(int)`

### grow

    protected void grow(int sx,
                        int sy)

  Overrides:
    `grow` in class `Roi`

### updatePolygon

    protected void updatePolygon()

### moveHandle

    protected void moveHandle(int sx,
                              int sy)

  Overrides:
    `moveHandle` in class `Roi`

### mouseDownInHandle

    protected void mouseDownInHandle(int handle,
                                     int sx,
                                     int sy)

  Overrides:
    `mouseDownInHandle` in class `Roi`

### fitSpline

    public void fitSpline(int evaluationPoints)

### handleMouseUp

    protected void handleMouseUp(int sx,
                                 int sy)

  Overrides:
    `handleMouseUp` in class `Roi`

### addOffset

    protected void addOffset()

### contains

    public boolean contains(int x,
                            int y)

  Overrides:
    `contains` in class `Roi`

### isHandle

    public int isHandle(int sx,
                        int sy)

  Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.

  Overrides:
    `isHandle` in class `Roi`

### getMask

    public ImageProcessor getMask()

  Override Roi.nudge() to support splines.

  Overrides:
    `getMask` in class `Roi`

### getLength

    public double getLength()

  Returns the perimeter (for ROIs) or length (for lines).

  Overrides:
    `getLength` in class `Roi`

### getFeretsDiameter

    public double getFeretsDiameter()

  Returns Feret's diameter, the greatest distance between any two points along the ROI boundary.

  Overrides:
    `getFeretsDiameter` 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.

### getPolygon

    public java.awt.Polygon getPolygon()

  Returns this PolygonRoi as a Polygon.

  Overrides:
    `getPolygon` in class `Roi`
  See Also:
    `ImageProcessor.setRoi(java.awt.Rectangle)`, `ImageProcessor.drawPolygon(java.awt.Polygon)`, `ImageProcessor.fillPolygon(java.awt.Polygon)`

### clone

    public java.lang.Object clone()

  Returns a copy of this PolygonRoi.

  Overrides:
    `clone` in class `Roi`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD