new Roi(r)
Creates a new rectangular Roi.
Parameters:
Name | Type | Description |
---|---|---|
r |
java.awt.Rectangle | - |
Members
(static, constant) ANGLE :int
Type:
- int
(static, constant) COMPOSITE :int
Type:
- int
(static, constant) CONSTRUCTING :int
Type:
- int
(static, constant) FREELINE :int
Type:
- int
(static, constant) FREEROI :int
Type:
- int
(static, constant) HANDLE_SIZE :int
Type:
- int
(static, constant) LINE :int
Type:
- int
(static, constant) MOVING :int
Type:
- int
(static, constant) MOVING_HANDLE :int
Type:
- int
(static, constant) NORMAL :int
Type:
- int
(static, constant) NOT_PASTING :int
Type:
- int
(static, constant) onePixelWide :java.awt.BasicStroke
Type:
- java.awt.BasicStroke
(static, constant) OVAL :int
Type:
- int
(static, constant) POINT :int
Type:
- int
(static, constant) POLYGON :int
Type:
- int
(static, constant) POLYLINE :int
Type:
- int
(static, constant) previousRoi :Roi
Type:
(static, constant) RECTANGLE :int
Type:
- int
(static, constant) RESIZING :int
Type:
- int
(static, constant) TRACED_ROI :int
Type:
- int
Methods
abortPaste()
addRoiListener(listener)
Parameters:
Name | Type | Description |
---|---|---|
listener |
RoiListener | - |
clone()
Returns a copy of this roi. See Thinking is Java by Bruce Eckel (www.eckelobjects.com) for a good description of object cloning.
Returns:
java.lang.Object
contains(x, y)
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
Returns:
boolean
copyAttributes(roi2)
Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection.
Parameters:
Name | Type | Description |
---|---|---|
roi2 |
Roi | - |
draw(g)
Parameters:
Name | Type | Description |
---|---|---|
g |
java.awt.Graphics | - |
drawOverlay(g)
Parameters:
Name | Type | Description |
---|---|---|
g |
java.awt.Graphics | - |
drawPixels(ip)
Draws the selection outline on the specified ImageProcessor.
Parameters:
Name | Type | Description |
---|---|---|
ip |
ImageProcessor | - |
drawPixels()
Deprecated. replaced by drawPixels(ImageProcessor)
- Deprecated:
- . replaced by drawPixels(ImageProcessor)
enableSubPixelResolution()
endPaste()
equals(obj)
Checks whether two rectangles are equal.
Parameters:
Name | Type | Description |
---|---|---|
obj |
java.lang.Object | - |
Returns:
boolean
getAngle(x1, y1, x2, y2)
Returns the angle in degrees between the specified line and a horizontal line.
Parameters:
Name | Type | Description |
---|---|---|
x1 |
int | - |
y1 |
int | - |
x2 |
int | - |
y2 |
int | - |
Returns:
double
getAngle()
Overridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle).
Returns:
double
getBoundingRect()
Deprecated. replaced by getBounds()
- Deprecated:
- . replaced by getBounds()
Returns:
java.awt.Rectangle
getBounds()
Return this selection's bounding rectangle.
Returns:
java.awt.Rectangle
getColor()
Returns the default (global) color used for drawing ROI outlines.
Returns:
java.awt.Color
getContainedFloatPoints()
Returns the coordinates of the pixels inside this ROI as a FloatPolygon.
Returns:
FloatPolygon
getContainedPoints()
Returns the coordinates of the pixels inside this ROI as an array of Points.
Returns:
java.awt.Point[]
getContourCentroid()
Returns:
double[]
getConvexHull()
Returns:
java.awt.Polygon
getCornerDiameter()
Returns the rounded rectangle corner diameter (pixels).
Returns:
int
getCPosition()
Returns the channel position of this ROI, or zero if this ROI is not associated with a particular channel.
Returns:
int
getCurrentPasteMode()
Returns the current paste transfer mode.
Returns:
int
getDebugInfo()
Returns:
java.lang.String
getDefaultFillColor()
Returns:
java.awt.Color
getDrawOffset()
Returns true if this is a PolygonRoi that supports sub-pixel resolution and polygons are drawn on zoomed images offset down and to the right by 0.5 pixels..
Returns:
boolean
getFeretsDiameter()
Returns Feret's diameter, the greatest distance between any two points along the ROI boundary.
Returns:
double
getFeretValues()
Caculates "Feret" (maximum caliper width), "FeretAngle" and "MinFeret" (minimum caliper width), "FeretX" and "FeretY".
Returns:
double[]
getFillColor()
Returns the fill color used to display this ROI, or null if it is displayed transparently.
Returns:
java.awt.Color
getFloatAngle(x1, y1, x2, y2)
Returns the angle in degrees between the specified line and a horizontal line.
Parameters:
Name | Type | Description |
---|---|---|
x1 |
double | - |
y1 |
double | - |
x2 |
double | - |
y2 |
double | - |
Returns:
double
getFloatBounds()
Return this selection's bounding rectangle.
Returns:
java.awt.geom.Rectangle2D.Double
getFloatHeight()
Returns:
double
getFloatPolygon()
Returns:
FloatPolygon
getFloatWidth()
Returns:
double
getHashCode()
Returns a hashcode for this Roi that typically changes if it is moved, even though it is still the same object.
Returns:
int
getImage()
Returns the ImagePlus associated with this ROI, or null.
Returns:
ImagePlus
getImageID()
Returns the ID of the image associated with this ROI.
Returns:
int
getInterpolatedPolygon()
Returns, as a FloatPolygon, an interpolated version of this selection that has points spaced 1.0 pixel apart.
Returns:
FloatPolygon
getInterpolatedPolygon(interval, smooth)
Returns, as a FloatPolygon, an interpolated version of this selection with points spaced 'interval' pixels apart. If 'smooth' is true, traced and freehand selections are first smoothed using a 3 point running average.
Parameters:
Name | Type | Description |
---|---|---|
interval |
double | - |
smooth |
boolean | - |
Returns:
FloatPolygon
getLength()
Returns the perimeter length.
Returns:
double
getMask()
Always returns null for rectangular Roi's
Returns:
ImageProcessor
getName()
Returns the name of this ROI, or null.
Returns:
java.lang.String
getPasteMode()
Returns the current paste transfer mode, or NOT_PASTING (-1) if no paste operation is in progress.
Returns:
int
getPolygon()
Returns the outline of this selection as a Polygon, or null if this is a straight line selection.
Returns:
java.awt.Polygon
getPosition()
Returns the stack position (image number) of this ROI, or zero if the ROI is not associated with a particular stack image.
Returns:
int
getProperties()
Returns:
java.lang.String
getProperty(property)
Parameters:
Name | Type | Description |
---|---|---|
property |
java.lang.String | - |
Returns:
java.lang.String
getPropertyCount()
Returns:
int
getPrototypeOverlay()
Returns:
Overlay
getRotationCenter()
Returns:
FloatPolygon
getRoundRectArcSize()
Obsolete; replaced by getCornerDiameter().
Returns:
int
getState()
Returns:
int
getStatistics()
Returns:
ImageStatistics
getStroke()
Returns the Stroke used to draw this ROI, or null if no Stroke is used.
Returns:
java.awt.BasicStroke
getStrokeColor()
Returns the the color used to draw the ROI outline or null if the default color is being used.
Returns:
java.awt.Color
getStrokeWidth()
Returns the lineWidth.
Returns:
float
getTPosition()
Returns the frame position of this ROI, or zero if this ROI is not associated with a particular frame.
Returns:
int
getType()
Returns:
int
getTypeAsString()
Convenience method that converts Roi type to a human-readable form.
Returns:
java.lang.String
getXBase()
Returns:
double
getYBase()
Returns:
double
getZPosition()
Returns the slice position of this ROI, or zero if this ROI is not associated with a particular slice.
Returns:
int
isActiveOverlayRoi()
Returns 'true' if this ROI is displayed and is also in an overlay.
Returns:
boolean
isArea()
Returns 'true' if this is an area selection.
Returns:
boolean
isCursor()
Returns:
boolean
isDrawingTool()
Returns 'true' if this is an ROI primarily used from drawing (e.g., TextRoi or Arrow).
Returns:
boolean
isHandle(sx, sy)
Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.
Parameters:
Name | Type | Description |
---|---|---|
sx |
int | - |
sy |
int | - |
Returns:
int
isLine()
Returns 'true' if this is a line selection.
Returns:
boolean
isVisible()
Returns true if this ROI is currently displayed on an image.
Returns:
boolean
iterator()
Required by the Interable
interface.
Use to iterate over the contained coordinates. Usage example:
for (Point p : roi) { // process p }
Returns:
java.util.Iterator<java.awt.Point>
lineCircleIntersection(ax, ay, bx, by, cx, cy, rad, ignoreOutside)
Calculates intersections of a line segment with a circle Author N.Vischer ax, ay, bx, by: points A and B of line segment cx, cy, rad: Circle center and radius. ignoreOutside: if true, ignores intersections outside the line segment A-B
Parameters:
Name | Type | Description |
---|---|---|
ax |
double | - |
ay |
double | - |
bx |
double | - |
by |
double | - |
cx |
double | - |
cy |
double | - |
rad |
double | - |
ignoreOutside |
boolean | - |
Returns:
double[]
mouseDragged(e)
Parameters:
Name | Type | Description |
---|---|---|
e |
java.awt.event.MouseEvent | - |
mouseMoved(e)
Parameters:
Name | Type | Description |
---|---|---|
e |
java.awt.event.MouseEvent | - |
mouseReleased(e)
Parameters:
Name | Type | Description |
---|---|---|
e |
java.awt.event.MouseEvent | - |
notifyListeners(id)
Parameters:
Name | Type | Description |
---|---|---|
id |
int | - |
nudge(key)
Nudge ROI one pixel on arrow key press.
Parameters:
Name | Type | Description |
---|---|---|
key |
int | - |
nudgeCorner(key)
Nudge lower right corner of rectangular and oval ROIs by one pixel based on arrow key press.
Parameters:
Name | Type | Description |
---|---|---|
key |
int | - |
removeRoiListener(listener)
Parameters:
Name | Type | Description |
---|---|---|
listener |
RoiListener | - |
setColor(c)
Sets the default (global) color used for ROI outlines.
Parameters:
Name | Type | Description |
---|---|---|
c |
java.awt.Color | - |
setCornerDiameter(cornerDiameter)
Sets the rounded rectangle corner diameter (pixels).
Parameters:
Name | Type | Description |
---|---|---|
cornerDiameter |
int | - |
setDefaultFillColor(color)
Parameters:
Name | Type | Description |
---|---|---|
color |
java.awt.Color | - |
setDrawOffset(drawOffset)
Parameters:
Name | Type | Description |
---|---|---|
drawOffset |
boolean | - |
setFillColor(color)
Sets the fill color used to display this ROI, or set to null to display it transparently.
Parameters:
Name | Type | Description |
---|---|---|
color |
java.awt.Color | - |
setIgnoreClipRect(ignoreClipRect)
Parameters:
Name | Type | Description |
---|---|---|
ignoreClipRect |
boolean | - |
setImage(imp)
Parameters:
Name | Type | Description |
---|---|---|
imp |
ImagePlus | - |
setInstanceColor(c)
Parameters:
Name | Type | Description |
---|---|---|
c |
java.awt.Color | - |
- Deprecated:
- . replaced by setStrokeColor()
setIsCursor(isCursor)
Parameters:
Name | Type | Description |
---|---|---|
isCursor |
boolean | - |
setLineWidth(width)
Deprecated. replaced by setStrokeWidth(int)
Parameters:
Name | Type | Description |
---|---|---|
width |
int | - |
- Deprecated:
- . replaced by setStrokeWidth(int)
setLocation(x, y)
Set the location of the ROI in image coordinates.
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
y |
double | - |
setLocation(x, y)
Set the location of the ROI in image coordinates.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
setName(name)
Sets the name of this ROI.
Parameters:
Name | Type | Description |
---|---|---|
name |
java.lang.String | - |
setNonScalable(nonScalable)
Set 'nonScalable' true to have TextRois in a display list drawn at a fixed location and size.
Parameters:
Name | Type | Description |
---|---|---|
nonScalable |
boolean | - |
setPasteMode(transferMode)
Sets the Paste transfer mode.
Parameters:
Name | Type | Description |
---|---|---|
transferMode |
int | - |
setPosition(channel, slice, frame)
Sets the hyperstack position of this ROI. In an overlay, this ROI is only displayed when the hyperstack is at the specified position.
Parameters:
Name | Type | Description |
---|---|---|
channel |
int | - |
slice |
int | - |
frame |
int | - |
setPosition(n)
Sets the stack position (image number) of this ROI. In an overlay, this ROI is only displayed when the stack is at the specified position. Set to zero to have the ROI displayed on all images in the stack.
Parameters:
Name | Type | Description |
---|---|---|
n |
int | - |
setProperties(properties)
Parameters:
Name | Type | Description |
---|---|---|
properties |
java.lang.String | - |
setProperty(key, value)
Parameters:
Name | Type | Description |
---|---|---|
key |
java.lang.String | - |
value |
java.lang.String | - |
setPrototypeOverlay(overlay)
Parameters:
Name | Type | Description |
---|---|---|
overlay |
Overlay | - |
setRotationCenter(x, y)
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
y |
double | - |
setRoundRectArcSize(cornerDiameter)
Obsolete; replaced by setCornerDiameter().
Parameters:
Name | Type | Description |
---|---|---|
cornerDiameter |
int | - |
setStroke(stroke)
Sets the Stroke used to draw this ROI.
Parameters:
Name | Type | Description |
---|---|---|
stroke |
java.awt.BasicStroke | - |
setStrokeColor(c)
Sets the color used by this ROI to draw its outline. This color, if not null, overrides the global color set by the static setColor() method.
Parameters:
Name | Type | Description |
---|---|---|
c |
java.awt.Color | - |
setStrokeWidth(width)
This is a version of setStrokeWidth() that accepts a double argument.
Parameters:
Name | Type | Description |
---|---|---|
width |
double | - |
setStrokeWidth(width)
Sets the width of the line used to draw this ROI. Set the width to 0.0 and the ROI will be drawn using a a 1 pixel stroke width regardless of the magnification.
Parameters:
Name | Type | Description |
---|---|---|
width |
float | - |
startPaste(clipboard)
Parameters:
Name | Type | Description |
---|---|---|
clipboard |
ImagePlus | - |
subPixelResolution()
Returns true if this is a slection that supports sub-pixel resolution.
Returns:
boolean
temporarilyHide()
Deprecated
- Deprecated:
- d
toFloat(arr)
Converts an int array to a float array.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<int> | - |
Returns:
float[]
toInt(arr, arr2, size)
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<float> | - |
arr2 |
Array.<int> | - |
size |
int | - |
Returns:
int[]
toInt(arr)
Converts a float array to an int array using truncation.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<float> | - |
Returns:
int[]
toIntR(arr)
Converts a float array to an int array using rounding.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<float> | - |
Returns:
int[]
toString()
Returns:
java.lang.String
update(add, subtract)
If 'add' is true, adds this selection to the previous one. If 'subtract' is true, subtracts it from the previous selection. Called by the IJ.doWand() method, and the makeRectangle(), makeOval(), makePolygon() and makeSelection() macro functions.
Parameters:
Name | Type | Description |
---|---|---|
add |
boolean | - |
subtract |
boolean | - |
updateWideLine(width)
Parameters:
Name | Type | Description |
---|---|---|
width |
float | - |