public class ROI2DArea extends ROI2D
Modifier and Type | Class and Description |
---|---|
class |
ROI2DArea.ROI2DAreaPainter |
ROI2D.ROI2DPainter
ROI.ROIIdComparator, ROI.ROINameComparator, ROI.ROIPainter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID_BOOLMASK_DATA |
static java.lang.String |
ID_BOUNDS_H |
static java.lang.String |
ID_BOUNDS_W |
static java.lang.String |
ID_BOUNDS_X |
static java.lang.String |
ID_BOUNDS_Y |
DEFAULT_COLOR, DEFAULT_NORMAL_COLOR, DEFAULT_OPACITY, DEFAULT_STROKE, ID_CLASSNAME, ID_COLOR, ID_ID, ID_NAME, ID_OPACITY, ID_READONLY, ID_ROI, ID_SELECTED, ID_SHOWNAME, ID_STROKE, idComparator, nameComparator, PROPERTY_COLOR, PROPERTY_CREATING, PROPERTY_ICON, PROPERTY_NAME, PROPERTY_OPACITY, PROPERTY_READONLY, PROPERTY_SHOWNAME, PROPERTY_STROKE
Constructor and Description |
---|
ROI2DArea()
Create a ROI2D Area type from the specified
BooleanMask2D . |
ROI2DArea(BooleanMask2D mask)
Create a ROI2D Area type from the specified
BooleanMask2D . |
ROI2DArea(java.awt.geom.Point2D position)
Create a ROI2D Area type with a single point.
|
ROI2DArea(java.awt.geom.Point2D position,
boolean cm)
Deprecated.
Use
ROI2DArea(Point5D) instead |
ROI2DArea(Point5D position)
Generic constructor for interactive mode.
|
ROI2DArea(ROI2DArea area)
Create a copy of the specified 2D Area ROI
|
Modifier and Type | Method and Description |
---|---|
void |
addBrush(java.awt.geom.Point2D pos)
Add brush point at specified position.
|
void |
addPoint(int x,
int y)
Add a point to the mask
|
void |
addPoint(java.awt.Point pos)
Add a point to the mask
|
boolean |
addPointAt(java.awt.geom.Point2D pos,
boolean ctrl)
Deprecated.
Use
addBrush(Point2D) instead. |
void |
addRect(int x,
int y,
int w,
int h)
Add a rectangle to the mask
|
void |
addRect(java.awt.Rectangle r)
Add a rectangle to the mask
|
void |
addShape(java.awt.Shape s)
Add a shape to the mask
|
boolean |
canAddPoint()
Deprecated.
useless method.
|
boolean |
canRemovePoint()
Deprecated.
useless method.
|
boolean |
canSetPosition()
Returns
true if this ROI accepts position change through the
ROI.setPosition5D(Point5D) method. |
boolean |
canTranslate()
Returns
true if the ROI support translate operation. |
void |
clear()
Clear the mask
|
java.awt.geom.Rectangle2D |
computeBounds2D()
Calculate and returns the 2D bounding box of the
ROI . |
double |
computeNumberOfPoints()
Generic implementation for ROI2D using the BooleanMask object so the result is just an
approximation.
|
boolean |
contains(double x,
double y)
Tests if the specified coordinates are inside the
ROI . |
boolean |
contains(double x,
double y,
double w,
double h)
Tests if the
ROI entirely contains the specified rectangular area. |
boolean[] |
getBooleanMask(int x,
int y,
int w,
int h,
boolean inclusive)
Get the boolean bitmap mask for the specified rectangular area of the roi.
|
java.awt.geom.Rectangle2D |
getBounds2D()
Returns a high precision and more accurate bounding box of the
ROI than the
getBounds method. |
boolean |
getBoundsNeedUpdate()
Return true if bounds need to be updated by calling optimizeBounds() method.
|
java.awt.image.BufferedImage |
getImageMask()
Returns the internal image mask.
|
java.awt.Color |
getMaskColor()
Deprecated.
Use
ROI.getDisplayColor() instead. |
ROI2DArea.ROI2DAreaPainter |
getPainter() |
boolean |
hasSelectedPoint()
Returns true if the ROI has a (control) point which is currently focused/selected
|
boolean |
intersects(double x,
double y,
double w,
double h)
Tests if the interior of the
ROI intersects the interior of a specified
rectangular area. |
boolean |
isEmpty()
Returns true if the ROI is empty (the mask does not contains any point).
|
boolean |
isOverEdge(IcyCanvas canvas,
double x,
double y)
Returns true if specified point coordinates overlap the ROI edge.
|
boolean |
loadFromXML(org.w3c.dom.Node node)
LOAD
|
void |
optimizeBounds()
Optimize the bounds size to the minimum surface which still include all mask
You should call it after consecutive remove operations. |
void |
optimizeBounds(boolean removeIfEmpty)
Deprecated.
Use
optimizeBounds() instead. |
void |
removeBrush(java.awt.geom.Point2D pos)
Remove brush point from the mask at specified position.
|
void |
removePoint(int x,
int y)
Remove a point to the mask.
|
void |
removePoint(java.awt.Point pos)
Remove a point from the mask.
|
boolean |
removePointAt(IcyCanvas canvas,
java.awt.geom.Point2D pos)
Deprecated.
Use
removeBrush(Point2D) instead. |
void |
removeRect(int x,
int y,
int w,
int h)
Remove a rectangle from the mask.
|
void |
removeRect(java.awt.Rectangle r)
Remove a rectangle from the mask.
|
void |
removeShape(java.awt.Shape s)
Remove a shape to the mask.
|
boolean |
saveToXML(org.w3c.dom.Node node)
SAVE
|
void |
setAsBooleanMask(BooleanMask2D mask)
Set the mask from a BooleanMask2D object
|
void |
setAsBooleanMask(int x,
int y,
int w,
int h,
boolean[] booleanMask) |
void |
setAsBooleanMask(java.awt.Rectangle r,
boolean[] booleanMask)
Set the mask from a boolean array.
|
void |
setPoint(int x,
int y,
boolean value)
Set the value of the specified point.
|
void |
setPosition2D(java.awt.geom.Point2D newPosition)
Set the
ROI 2D position. |
void |
translate(double dx,
double dy)
Translate the ROI position by the specified delta X/Y.
|
void |
updateMask(int x,
int y,
boolean remove)
Deprecated.
Use
setPoint(int, int, boolean) instead. |
void |
updateMask(java.awt.Shape shape,
boolean remove)
Update mask from specified shape
|
canSetBounds, computeBounds5D, computeNumberOfContourPoints, contains, contains, contains, contains, contains, getArea, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask2D, getBooleanMask2D, getBounds, getC, getDimension, getPerimeter, getPosition, getPosition2D, getROI2DList, getROI2DList, getROI2DList, getT, getZ, intersects, intersects, intersects, isActiveFor, isActiveFor, isOver, isOver, isOverEdge, isOverEdge, isOverEdge, merge, setBounds2D, setBounds5D, setC, setPosition, setPosition5D, setT, setZ, substract, subtract
addListener, attachTo, beginUpdate, canvasToImageDeltaX, canvasToImageDeltaY, canvasToImageLogDeltaX, canvasToImageLogDeltaX, canvasToImageLogDeltaX, canvasToImageLogDeltaX, canvasToImageLogDeltaY, canvasToImageLogDeltaY, canvasToImageLogDeltaY, canvasToImageLogDeltaY, contains, contains, copyFrom, create, create, create, create, createFromXML, delete, delete, detachFrom, detachFromAll, detachFromAll, endUpdate, focusChanged, getAdjustedStroke, getAdjustedStroke, getBooleanMask2D, getBounds5D, getClassName, getColor, getCopy, getDisplayColor, getExclusiveUnion, getFirstSequence, getFocusedColor, getIcon, getId, getIntersection, getName, getNumberOfContourPoints, getNumberOfPoints, getOpacity, getOverlay, getPosition5D, getPropertyValue, getROICount, getROIList, getROIList, getROIList, getROIsFromXML, getSelectedColor, getSequences, getShowName, getSimpleClassName, getStroke, getSubtraction, getUnion, getVolume, internalFocus, internalSelect, internalUnfocus, internalUnselect, intersects, isAttached, isCreating, isEditable, isFocused, isReadOnly, isSelected, isUpdating, loadFromXML, loadROIsFromXML, merge, nameChanged, onChanged, painterChanged, propertyChanged, remove, remove, removeListener, roiChanged, roiChanged, saveROIsToXML, selectionChanged, setColor, setCreating, setEditable, setFocused, setIcon, setMousePos, setName, setOpacity, setPropertyValue, setReadOnly, setROIsFromXML, setSelected, setSelected, setSelectedColor, setShowName, setStroke
public static final java.lang.String ID_BOUNDS_X
public static final java.lang.String ID_BOUNDS_Y
public static final java.lang.String ID_BOUNDS_W
public static final java.lang.String ID_BOUNDS_H
public static final java.lang.String ID_BOOLMASK_DATA
public ROI2DArea()
BooleanMask2D
.@Deprecated public ROI2DArea(java.awt.geom.Point2D position, boolean cm)
ROI2DArea(Point5D)
insteadpublic ROI2DArea(java.awt.geom.Point2D position)
public ROI2DArea(BooleanMask2D mask)
BooleanMask2D
.@Deprecated public void optimizeBounds(boolean removeIfEmpty)
optimizeBounds()
instead.public boolean isEmpty()
public void optimizeBounds()
@Deprecated public java.awt.Color getMaskColor()
ROI.getDisplayColor()
instead.public java.awt.image.BufferedImage getImageMask()
public void setPoint(int x, int y, boolean value)
@Deprecated public void updateMask(int x, int y, boolean remove)
setPoint(int, int, boolean)
instead.public void updateMask(java.awt.Shape shape, boolean remove)
public ROI2DArea.ROI2DAreaPainter getPainter()
getPainter
in class ROI
public boolean hasSelectedPoint()
ROI
hasSelectedPoint
in class ROI
@Deprecated public boolean canAddPoint()
@Deprecated public boolean canRemovePoint()
@Deprecated public boolean addPointAt(java.awt.geom.Point2D pos, boolean ctrl)
addBrush(Point2D)
instead.@Deprecated public boolean removePointAt(IcyCanvas canvas, java.awt.geom.Point2D pos)
removeBrush(Point2D)
instead.public void addBrush(java.awt.geom.Point2D pos)
public void removeBrush(java.awt.geom.Point2D pos)
public void addPoint(java.awt.Point pos)
public void addPoint(int x, int y)
public void removePoint(java.awt.Point pos)
public void removePoint(int x, int y)
public void addRect(java.awt.Rectangle r)
public void addRect(int x, int y, int w, int h)
public void removeRect(java.awt.Rectangle r)
public void removeRect(int x, int y, int w, int h)
public void addShape(java.awt.Shape s)
public void removeShape(java.awt.Shape s)
public boolean getBoundsNeedUpdate()
public void clear()
public boolean isOverEdge(IcyCanvas canvas, double x, double y)
ROI2D
ROI2D.contains(double, double)
to test for content overlap instead.isOverEdge
in class ROI2D
public boolean contains(double x, double y)
ROI2D
ROI
.public boolean contains(double x, double y, double w, double h)
ROI2D
ROI
entirely contains the specified rectangular area. All
coordinates that lie inside the rectangular area must lie within the ROI
for the
entire rectangular area to be considered contained within the ROI
.
The ROI.contains()
method allows a ROI
implementation to conservatively
return false
when:
intersect
method returns true
and
ROI
entirely contains the
rectangular area are prohibitively expensive.
ROIs
this method might return false
even though the
ROI
contains the rectangular area.contains
in class ROI2D
x
- the X coordinate of the upper-left corner of the specified rectangular areay
- the Y coordinate of the upper-left corner of the specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangular areatrue
if the interior of the ROI
entirely contains the
specified rectangular area; false
otherwise or, if the ROI
contains the rectangular area and the intersects
method returns
true
and the containment calculations would be too expensive to perform.public java.awt.geom.Rectangle2D computeBounds2D()
ROI2D
ROI
.ROI2D.getBounds2D()
which should try to cache the result as the
bounding box calculation can take some computation time for complex ROI.computeBounds2D
in class ROI2D
public java.awt.geom.Rectangle2D getBounds2D()
ROI2D
ROI
than the
getBounds
method. Note that there is no guarantee that the returned
Rectangle2D
is the smallest bounding box that encloses the ROI
, only
that the ROI
lies entirely within the indicated Rectangle2D
. The
bounding box returned by this method is usually tighter than that returned by the
getBounds
method and never fails due to overflow problems since the return value
can be an instance of the Rectangle2D
that uses double precision values to store
the dimensions.getBounds2D
in class ROI2D
Rectangle2D
that is a high-precision bounding box of the
ROI
.public boolean intersects(double x, double y, double w, double h)
ROI2D
ROI
intersects the interior of a specified
rectangular area. The rectangular area is considered to intersect the ROI
if any
point is contained in both the interior of the ROI
and the specified rectangular
area.
The ROI.intersects()
method allows a ROI
implementation to conservatively
return true
when:
ROI
intersect,
but
ROIs
this method might return true
even though the
rectangular area does not intersect the ROI
.intersects
in class ROI2D
x
- the X coordinate of the upper-left corner of the specified rectangular areay
- the Y coordinate of the upper-left corner of the specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangular areatrue
if the interior of the ROI
and the interior of the
rectangular area intersect, or are both highly likely to intersect and intersection
calculations would be too expensive to perform; false
otherwise.public boolean[] getBooleanMask(int x, int y, int w, int h, boolean inclusive)
ROI2D
getBooleanMask
in class ROI2D
x
- the X coordinate of the upper-left corner of the specified rectangular areay
- the Y coordinate of the upper-left corner of the specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangular areainclusive
- If true then all partially contained (intersected) pixels are included in the mask.public double computeNumberOfPoints()
ROI2D
computeNumberOfPoints
in class ROI2D
public boolean canTranslate()
ROI2D
true
if the ROI support translate operation.canTranslate
in class ROI2D
ROI2D.translate(double, double)
public void translate(double dx, double dy)
ROI2D
ROI2D.canTranslate()
first.translate
in class ROI2D
dx
- translation value to apply on X dimensiondy
- translation value to apply on Y dimensionROI2D.canTranslate()
,
ROI2D.setPosition2D(Point2D)
public boolean canSetPosition()
ROI
true
if this ROI accepts position change through the
ROI.setPosition5D(Point5D)
method.canSetPosition
in class ROI2D
public void setPosition2D(java.awt.geom.Point2D newPosition)
ROI2D
ROI
2D position.ROI2D.canSetPosition()
first to test if the operation is supported.setPosition2D
in class ROI2D
newPosition
- new ROI 2D positionpublic void setAsBooleanMask(BooleanMask2D mask)
public void setAsBooleanMask(java.awt.Rectangle r, boolean[] booleanMask)
r
- booleanMask
- public void setAsBooleanMask(int x, int y, int w, int h, boolean[] booleanMask)
public boolean loadFromXML(org.w3c.dom.Node node)
XMLPersistent
loadFromXML
in interface XMLPersistent
loadFromXML
in class ROI2D
public boolean saveToXML(org.w3c.dom.Node node)
XMLPersistent
saveToXML
in interface XMLPersistent
saveToXML
in class ROI2D