public class Roi extends Object implements Cloneable, Serializable
Iterable<Point> and can thus be used to iterate
over the contained coordinates. Usage example:
Roi roi = ...;
for (Point p : roi) {
// process p
}
| Modifier and Type | Field and Description |
|---|---|
static int |
ANGLE |
protected double |
asp_bk |
protected boolean |
aspect |
protected boolean |
center |
protected int |
clipHeight |
protected int |
clipWidth |
protected int |
clipX |
protected int |
clipY |
static int |
COMPOSITE |
protected boolean |
constrain |
static int |
CONSTRUCTING |
protected static Color |
defaultFillColor |
protected Color |
fillColor |
static int |
FREELINE |
static int |
FREEROI |
static int |
HANDLE_SIZE |
protected Color |
handleColor |
protected boolean |
ignoreClipRect |
protected Color |
instanceColor |
static int |
LINE |
protected static int |
lineWidth |
protected double |
mag |
static int |
MOVING |
static int |
MOVING_HANDLE |
protected boolean |
nonScalable |
static int |
NORMAL |
static int |
NOT_PASTING |
protected int |
oldHeight |
protected int |
oldWidth |
protected int |
oldX |
protected int |
oldY |
static BasicStroke |
onePixelWide |
static int |
OVAL |
protected boolean |
overlay |
static int |
POINT |
static int |
POLYGON |
static int |
POLYLINE |
static Roi |
previousRoi |
static int |
RECTANGLE |
static int |
RESIZING |
protected static Color |
ROIColor |
protected BasicStroke |
stroke |
protected Color |
strokeColor |
static int |
TRACED_ROI |
protected int |
type |
protected boolean |
updateFullWindow |
protected boolean |
wideLine |
protected int |
xMax |
protected int |
yMax |
| Constructor and Description |
|---|
Roi(double x,
double y,
double width,
double height)
Creates a rectangular ROI using double arguments.
|
Roi(double x,
double y,
double width,
double height,
int cornerDiameter)
Creates a rounded rectangular ROI using double arguments.
|
Roi(int x,
int y,
int width,
int height)
Creates a rectangular ROI.
|
Roi(int x,
int y,
int width,
int height,
int cornerDiameter)
Creates a new rounded rectangular ROI.
|
Roi(Rectangle r)
Creates a new rectangular Roi.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
clipRectMargin() |
boolean |
contains(int x,
int y) |
void |
copyAttributes(Roi roi2)
Copy the attributes (outline color, fill color, outline width) of 'roi2'
to the this selection.
|
void |
draw(Graphics g) |
void |
drawOverlay(Graphics g) |
void |
enableSubPixelResolution() |
double |
getAngle()
Overridden by PolygonRoi (angle between first two points), TextRoi (text
angle) and Line (line angle).
|
Rectangle |
getBoundingRect()
Deprecated.
replaced by getBounds()
|
Rectangle |
getBounds()
Return this selection's bounding rectangle.
|
static Color |
getColor()
Returns the default (global) color used for drawing ROI outlines.
|
Polygon |
getConvexHull() |
int |
getCornerDiameter()
Returns the rounded rectangle corner diameter (pixels).
|
int |
getCPosition()
Returns the channel position of this ROI, or zero if this ROI is not
associated with a particular channel.
|
String |
getDebugInfo() |
static Color |
getDefaultFillColor() |
boolean |
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..
|
Color |
getFillColor()
Returns the fill color used to display this ROI, or null if it is
displayed transparently.
|
Rectangle2D.Double |
getFloatBounds()
Return this selection's bounding rectangle.
|
double |
getFloatHeight() |
double |
getFloatWidth() |
int |
getHashCode()
Returns a hashcode for this Roi that typically changes if it is moved,
even though it is still the same object.
|
String |
getName()
Returns the name of this ROI, or null.
|
Polygon |
getPolygon()
Returns the outline of this selection as a Polygon, or null if this is a
straight line selection.
|
int |
getPosition()
Returns the stack position (image number) of this ROI, or zero if the ROI
is not associated with a particular stack image.
|
String |
getProperties() |
String |
getProperty(String property) |
int |
getPropertyCount() |
Overlay |
getPrototypeOverlay() |
int |
getRoundRectArcSize()
Obsolete; replaced by getCornerDiameter().
|
int |
getState() |
BasicStroke |
getStroke()
Returns the Stroke used to draw this ROI, or null if no Stroke is used.
|
Color |
getStrokeColor()
Returns the the color used to draw the ROI outline or null if the default
color is being used.
|
float |
getStrokeWidth()
Returns the lineWidth.
|
int |
getTPosition()
Returns the frame position of this ROI, or zero if this ROI is not
associated with a particular frame.
|
int |
getType() |
String |
getTypeAsString()
Convenience method that converts Roi type to a human-readable form.
|
double |
getXBase() |
double |
getYBase() |
int |
getZPosition()
Returns the slice position of this ROI, or zero if this ROI is not
associated with a particular slice.
|
boolean |
isArea()
Returns 'true' if this is an area selection.
|
boolean |
isCursor() |
boolean |
isDrawingTool()
Returns 'true' if this is an ROI primarily used from drawing (e.g.,
TextRoi or Arrow).
|
boolean |
isLine()
Returns 'true' if this is a line selection.
|
static void |
setColor(Color c)
Sets the default (global) color used for ROI outlines.
|
void |
setCornerDiameter(int cornerDiameter)
Sets the rounded rectangle corner diameter (pixels).
|
static void |
setDefaultFillColor(Color color) |
void |
setDrawOffset(boolean drawOffset) |
void |
setFillColor(Color color)
Sets the fill color used to display this ROI, or set to null to display it
transparently.
|
void |
setIgnoreClipRect(boolean ignoreClipRect) |
void |
setIsCursor(boolean isCursor) |
void |
setLocation(double x,
double y)
Set the location of the ROI in image coordinates.
|
void |
setLocation(int x,
int y)
Set the location of the ROI in image coordinates.
|
void |
setName(String name)
Sets the name of this ROI.
|
void |
setNonScalable(boolean nonScalable)
Set 'nonScalable' true to have TextRois in a display list drawn at a fixed
location and size.
|
void |
setPosition(int n)
Sets the stack position (image number) of this ROI.
|
void |
setPosition(int channel,
int slice,
int frame)
Sets the hyperstack position of this ROI.
|
void |
setProperty(String key,
String value) |
void |
setPrototypeOverlay(Overlay overlay) |
void |
setRotationCenter(double x,
double y) |
void |
setRoundRectArcSize(int cornerDiameter)
Obsolete; replaced by setCornerDiameter().
|
void |
setStroke(BasicStroke stroke)
Sets the Stroke used to draw this ROI.
|
void |
setStrokeColor(Color c)
Sets the color used by this ROI to draw its outline.
|
void |
setStrokeWidth(double width)
This is a version of setStrokeWidth() that accepts a double argument.
|
void |
setStrokeWidth(float width)
Sets the width of the line used to draw this ROI.
|
boolean |
subPixelResolution()
Returns true if this is a slection that supports sub-pixel resolution.
|
void |
temporarilyHide()
Deprecated
|
static float[] |
toFloat(int[] arr)
Converts an int array to a float array.
|
static int[] |
toInt(float[] arr)
Converts a float array to an int array using truncation.
|
static int[] |
toInt(float[] arr,
int[] arr2,
int size) |
static int[] |
toIntR(float[] arr)
Converts a float array to an int array using rounding.
|
String |
toString() |
public static final int CONSTRUCTING
public static final int MOVING
public static final int RESIZING
public static final int NORMAL
public static final int MOVING_HANDLE
public static final int RECTANGLE
public static final int OVAL
public static final int POLYGON
public static final int FREEROI
public static final int TRACED_ROI
public static final int LINE
public static final int POLYLINE
public static final int FREELINE
public static final int ANGLE
public static final int COMPOSITE
public static final int POINT
public static final int HANDLE_SIZE
public static final int NOT_PASTING
public static Roi previousRoi
public static final BasicStroke onePixelWide
protected static int lineWidth
protected static Color defaultFillColor
protected static Color ROIColor
protected int type
protected int xMax
protected int yMax
protected int oldX
protected int oldY
protected int oldWidth
protected int oldHeight
protected int clipX
protected int clipY
protected int clipWidth
protected int clipHeight
protected boolean constrain
protected boolean center
protected boolean aspect
protected boolean updateFullWindow
protected double mag
protected double asp_bk
protected Color handleColor
protected Color strokeColor
protected Color instanceColor
protected Color fillColor
protected BasicStroke stroke
protected boolean nonScalable
protected boolean overlay
protected boolean wideLine
protected boolean ignoreClipRect
public Roi(int x,
int y,
int width,
int height)
public Roi(double x,
double y,
double width,
double height)
public Roi(int x,
int y,
int width,
int height,
int cornerDiameter)
public Roi(double x,
double y,
double width,
double height,
int cornerDiameter)
public Roi(Rectangle r)
public void setLocation(int x,
int y)
public void setLocation(double x,
double y)
public int getType()
public int getState()
public Polygon getConvexHull()
public Rectangle getBounds()
public Rectangle2D.Double getFloatBounds()
public Rectangle getBoundingRect()
public Polygon getPolygon()
protected int clipRectMargin()
public void draw(Graphics g)
public void drawOverlay(Graphics g)
public static void setColor(Color c)
getColor(),
setStrokeColor(Color)public static Color getColor()
setColor(Color),
getStrokeColor()public boolean contains(int x,
int y)
public void setStrokeColor(Color c)
getStrokeColor(),
setStrokeWidth(float)public Color getStrokeColor()
setStrokeColor(Color)public void setFillColor(Color color)
getFillColor(),
setStrokeColor(java.awt.Color)public Color getFillColor()
setFillColor(java.awt.Color),
getStrokeColor()public static void setDefaultFillColor(Color color)
public static Color getDefaultFillColor()
public void copyAttributes(Roi roi2)
public void setNonScalable(boolean nonScalable)
public void setStrokeWidth(float width)
setStrokeColor(Color)public void setStrokeWidth(double width)
public float getStrokeWidth()
public void setStroke(BasicStroke stroke)
public BasicStroke getStroke()
public String getName()
public void setName(String name)
public void setCornerDiameter(int cornerDiameter)
public int getCornerDiameter()
public void setRoundRectArcSize(int cornerDiameter)
public int getRoundRectArcSize()
public void setPosition(int n)
Overlaypublic int getPosition()
Overlaypublic void setPosition(int channel,
int slice,
int frame)
Overlaypublic final int getCPosition()
public final int getZPosition()
public final int getTPosition()
public void setPrototypeOverlay(Overlay overlay)
public Overlay getPrototypeOverlay()
public boolean isArea()
public boolean isLine()
public boolean isDrawingTool()
public String getTypeAsString()
public boolean subPixelResolution()
public boolean getDrawOffset()
public void setDrawOffset(boolean drawOffset)
public void setIgnoreClipRect(boolean ignoreClipRect)
public static int[] toInt(float[] arr)
public static int[] toInt(float[] arr,
int[] arr2,
int size)
public static int[] toIntR(float[] arr)
public static float[] toFloat(int[] arr)
public String getProperties()
public int getPropertyCount()
public void temporarilyHide()
public double getXBase()
public double getYBase()
public double getFloatWidth()
public double getFloatHeight()
public double getAngle()
public void enableSubPixelResolution()
public void setIsCursor(boolean isCursor)
public boolean isCursor()
public String getDebugInfo()
public void setRotationCenter(double x,
double y)
public int getHashCode()
Copyright © 2023. All rights reserved.