Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.astro.louisville.edu/software/astroimagej/imagej/api/ij/gui/ShapeRoi.html
Дата изменения: Thu Dec 2 23:03:11 2010 Дата индексирования: Mon Oct 1 21:41:57 2012 Кодировка: Поисковые слова: п п п п п п п п п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п р п |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ij.gui.Roi ij.gui.ShapeRoi
public class ShapeRoi
A subclass of ij.gui.Roi
(2D Regions Of Interest) implemented in terms of java.awt.Shape.
A ShapeRoi is constructed from a ij.gui.Roi
object, or as a result of logical operators
(i.e., union, intersection, exclusive or, and subtraction) provided by this class. These operators use the package
java.awt.geom
as a backend.
This code is in the public domain.
Field Summary |
---|
Fields inherited from class ij.gui.Roi |
---|
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, imp, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, name, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, type, updateFullWindow, wideLine, xMax, yMax |
Constructor Summary | |
---|---|
ShapeRoi(float[] shapeArray)
Constructs a ShapeRoi from an array of variable length path segments. |
|
ShapeRoi(int x,
int y,
java.awt.Shape s)
Constructs a ShapeRoi from a Shape. |
|
ShapeRoi(Roi r)
Constructs a ShapeRoi from an Roi. |
|
ShapeRoi(java.awt.Shape s)
Constructs a ShapeRoi from a Shape. |
Method Summary | |
---|---|
static void |
addCircle(java.lang.String sx,
java.lang.String sy,
java.lang.String swidth)
|
ShapeRoi |
and(ShapeRoi sr)
Unary intersection operator. |
java.lang.Object |
clone()
Returns a deep copy of this. |
boolean |
contains(int x,
int y)
Checks whether the specified coordinates are inside a on this ROI's shape boundaries. |
void |
draw(java.awt.Graphics g)
Non-destructively draws the shape of this object on the associated ImagePlus. |
void |
drawPixels(ImageProcessor ip)
Draws the shape of this object onto the specified ImageProcessor. |
void |
drawRoiBrush(java.awt.Graphics g)
|
java.awt.Polygon |
getConvexHull()
Always returns null. |
double[] |
getFeretValues()
Caculates "Feret" (maximum caliper width) and "MinFeret" (minimum caliper width). |
double |
getLength()
Returns the length of this shape (perimeter, if shape is closed). |
ImageProcessor |
getMask()
Returns this ROI's mask pixels as a ByteProcessor with pixels "in" the mask set to white (255) and pixels "outside" the mask set to black (0). |
Roi[] |
getRois()
Converts a Shape into Roi object(s). |
java.awt.Shape |
getShape()
Returns a reference to the Shape object encapsulated by this ShapeRoi. |
float[] |
getShapeAsArray()
Retrieves the end points and control points of the path as a float array. |
int |
isHandle(int sx,
int sy)
Always returns -1 since ShapeRois do not have handles. |
ShapeRoi |
not(ShapeRoi sr)
Unary subtraction operator. |
ShapeRoi |
or(ShapeRoi sr)
Unary union operator. |
Roi |
shapeToRoi()
Attempts to convert this ShapeRoi into a non-composite Roi. |
static void |
subtractCircle(java.lang.String sx,
java.lang.String sy,
java.lang.String swidth)
|
ShapeRoi |
xor(ShapeRoi sr)
Unary exclusive or operator. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ShapeRoi(Roi r)
public ShapeRoi(java.awt.Shape s)
public ShapeRoi(int x, int y, java.awt.Shape s)
public ShapeRoi(float[] shapeArray)
Method Detail |
---|
public java.lang.Object clone()
clone
in class Roi
public ShapeRoi or(ShapeRoi sr)
this
and sr
public ShapeRoi and(ShapeRoi sr)
this
and sr
public ShapeRoi xor(ShapeRoi sr)
this
and sr
public ShapeRoi not(ShapeRoi sr)
this
subtracted from sr
public Roi[] getRois()
Shape type | Roi class | Roi type |
---|---|---|
java.awt.geom.Rectangle2D.Double | ij.gui.Roi | Roi.RECTANGLE |
java.awt.geom.Ellipse2D.Double | ij.gui.OvalRoi | Roi.OVAL |
java.awt.geom.Line2D.Double | ij.gui.Line | Roi.LINE |
java.awt.Polygon | ij.gui.PolygonRoi | Roi.POLYGON |
java.awt.geom.GeneralPath
is converted following these rules:
Segment types | Number of segments |
Closed path | Value of forceAngle |
Value of forceTrace | Roi type |
---|---|---|---|---|---|
lines only: | 0 | ShapeRoi.NO_TYPE | |||
1 | ShapeRoi.NO_TYPE | ||||
2 | Y | ShapeRoi.NO_TYPE | |||
N | Roi.LINE | ||||
3 | Y | N | Roi.POLYGON | ||
N | Y | Roi.ANGLE | |||
N | N | Roi.POLYLINE | |||
4 | Y | Roi.RECTANGLE | |||
N | Roi.POLYLINE | ||||
<= MAXPOLY | Y | Roi.POLYGON | |||
N | Roi.POLYLINE | ||||
> MAXPOLY | Y | Y | Roi.TRACED_ROI | ||
N | Roi.FREEROI | ||||
N | Roi.FREELINE | ||||
anything else: | <= 2 | ShapeRoi.NO_TYPE | |||
> 2 | ShapeRoi.SHAPE_ROI |
public Roi shapeToRoi()
public boolean contains(int x, int y)
contains
in class Roi
public double[] getFeretValues()
getFeretValues
in class Roi
public double getLength()
getLength
in class Roi
public float[] getShapeAsArray()
public void draw(java.awt.Graphics g)
draw
in class Roi
public void drawRoiBrush(java.awt.Graphics g)
public void drawPixels(ImageProcessor ip)
drawPixels
in class Roi
ImageProcessor.setColor(java.awt.Color)
,
ImageProcessor.setLineWidth(int)
public ImageProcessor getMask()
getMask
in class Roi
public java.awt.Shape getShape()
public static void addCircle(java.lang.String sx, java.lang.String sy, java.lang.String swidth)
public static void subtractCircle(java.lang.String sx, java.lang.String sy, java.lang.String swidth)
public int isHandle(int sx, int sy)
isHandle
in class Roi
public java.awt.Polygon getConvexHull()
getConvexHull
in class Roi
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |