public abstract class ROI2DShape extends ROI2D implements java.awt.Shape
Modifier and Type | Class and Description |
---|---|
class |
ROI2DShape.ROI2DShapePainter |
ROI2D.ROI2DPainter
ROI.ROIGroupId, ROI.ROIIdComparator, ROI.ROINameComparator, ROI.ROIPainter
DEFAULT_COLOR, DEFAULT_NORMAL_COLOR, DEFAULT_OPACITY, DEFAULT_STROKE, defaultColor, defaultOpacity, defaultShowName, defaultStroke, ID_CLASSNAME, ID_COLOR, ID_GROUPID, ID_ID, ID_NAME, ID_OPACITY, ID_PROPERTIES, ID_READONLY, ID_ROI, ID_SELECTED, ID_SHOWNAME, ID_STROKE, idComparator, nameComparator, PROPERTY_COLOR, PROPERTY_CREATING, PROPERTY_GROUPID, PROPERTY_ICON, PROPERTY_NAME, PROPERTY_OPACITY, PROPERTY_READONLY, PROPERTY_SHOWNAME, PROPERTY_STROKE, ROI_CHANGED_ALL, ROI_CHANGED_POSITION
Constructor and Description |
---|
ROI2DShape(java.awt.Shape shape) |
Modifier and Type | Method and Description |
---|---|
Anchor2D |
addNewPoint(java.awt.geom.Point2D pos,
boolean insert)
Add a new point to this shape ROI.
|
Anchor2D |
addNewPoint(java.awt.geom.Point2D pos,
boolean insert,
boolean select)
Add a new point to this shape ROI.
|
void |
addPoint(Anchor2D pt,
int index)
Internal use only, use
addNewPoint(Point2D, boolean) instead. |
boolean |
addPoint(java.awt.geom.Point2D pos,
boolean insert)
Deprecated.
Use
addNewPoint(Point2D, boolean) instead. |
boolean |
addPointAt(java.awt.geom.Point2D pos,
boolean insert)
Deprecated.
Use
addNewPoint(Point2D, boolean) instead. |
boolean |
canAddPoint()
Return true if this ROI support adding new point
|
boolean |
canRemovePoint()
Return true if this ROI support removing point
|
boolean |
canTranslate()
Returns
true if the ROI support translate operation. |
java.awt.geom.Rectangle2D |
computeBounds2D()
Calculate and returns the 2D bounding box of the
ROI . |
double |
computeNumberOfContourPoints()
Compute and returns the number of point (pixel) composing the ROI contour.
|
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 |
contains(java.awt.geom.Point2D p)
Tests if a specified
Point2D is inside the ROI. |
boolean |
contains(java.awt.geom.Rectangle2D r)
Tests if the interior of the
ROI entirely contains the specified Rectangle2D . |
void |
controlPointOverlayChanged(OverlayEvent event)
Called when anchor overlay changed
|
void |
controlPointPositionChanged(Anchor2D source)
Called when anchor position changed
|
boolean[] |
getBooleanMask(int x,
int y,
int width,
int height,
boolean inclusive)
Get the boolean bitmap mask for the specified rectangular area of the roi.
|
java.util.List<Anchor2D> |
getControlPoints()
Return the list of control points for this ROI.
|
java.lang.String |
getDefaultName() |
ROI |
getExclusiveUnion(ROI roi)
Compute exclusive union with specified
ROI and return result in a new ROI . |
ROI |
getIntersection(ROI roi)
Compute intersection with specified
ROI and return result in a new ROI . |
double |
getLength(Sequence sequence)
Computes and returns the length/perimeter of the ROI in um given the pixel size informations from the specified
Sequence.
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at) |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness) |
java.util.ArrayList<java.awt.geom.Point2D> |
getPoints()
Return the list of positions of control points for this ROI.
|
java.awt.Shape |
getShape() |
ROI |
getSubtraction(ROI roi)
Subtract the specified
ROI and return result in a new ROI . |
ROI |
getUnion(ROI roi)
Compute union with specified
ROI and return result in a new ROI . |
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 |
intersects(java.awt.geom.Rectangle2D r)
Tests if the interior of the
ROI intersects the interior of a specified Rectangle2D . |
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 |
onChanged(CollapsibleEvent object)
roi changed
|
void |
painterChanged(PainterEvent event)
Called when anchor painter changed, provided only for backward compatibility.
|
boolean |
removePoint(Anchor2D pt)
This method give you lower level access on point remove operation but can be unsafe.
|
boolean |
removePointAt(IcyCanvas canvas,
java.awt.geom.Point2D imagePoint)
Deprecated.
Use
removeSelectedPoint(IcyCanvas) instead. |
boolean |
removeSelectedPoint(IcyCanvas canvas)
Remove the current selected point.
|
void |
translate(double dx,
double dy)
Translate the ROI position by the specified delta X/Y.
|
void |
unselectAllPoints()
Remove focus/selected state on all (control) points.
|
canSetBounds, canSetPosition, computeBounds5D, computeNumberOfPoints, computePerimeter, contains, contains, contains, getArea, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getAsBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask, getBooleanMask2D, getBooleanMask2D, getBounds, getBounds2D, getC, getDimension, getPerimeter, getPerimeter, getPosition, getPosition2D, getROI2DList, getROI2DList, getROI2DList, getSubROI, getT, getZ, intersects, intersects, isActiveFor, isActiveFor, isOver, isOver, isOverEdge, isOverEdge, isOverEdge, merge, saveToXML, setBounds2D, setBounds5D, setC, setPosition, setPosition2D, setPosition5D, setT, setZ, substract, subtract
add, 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, exclusiveAdd, focusChanged, getAdjustedStroke, getAdjustedStroke, getBooleanMask2D, getBounds5D, getClassName, getColor, getCopy, getDefaultColor, getDefaultOpacity, getDefaultShowName, getDefaultStroke, getDisplayColor, getFirstSequence, getFocusedColor, getGroupId, getIcon, getId, getName, getNameSuffix, getNumberOfContourPoints, getNumberOfPoints, getOpacity, getOverlay, getPainter, getPosition5D, getProperties, getProperty, getPropertyValue, getROICount, getROIList, getROIList, getROIList, getROIsFromXML, getSelectedColor, getSequences, getShowName, getSimpleClassName, getStroke, getVolume, internalFocus, internalSelect, internalUnfocus, internalUnselect, intersect, intersects, isAttached, isCreating, isDefaultName, isEditable, isEmpty, isFocused, isReadOnly, isSelected, isUpdating, loadFromXML, loadROIsFromXML, merge, mergeWith, nameChanged, painterChanged, propertyChanged, remove, remove, removeListener, roiChanged, roiChanged, roiChanged, saveROIsToXML, selectionChanged, setColor, setCreating, setDefaultColor, setDefaultOpacity, setDefaultShowName, setDefaultStroke, setEditable, setFocused, setGroupId, setIcon, setMousePos, setName, setOpacity, setProperty, setPropertyValue, setReadOnly, setROIsFromXML, setSelected, setSelected, setSelectedColor, setShowName, setStroke, subtract
public ROI2DShape(java.awt.Shape shape)
public java.lang.String getDefaultName()
getDefaultName
in class ROI2D
public java.awt.Shape getShape()
public boolean canAddPoint()
public boolean canRemovePoint()
public void addPoint(Anchor2D pt, int index)
addNewPoint(Point2D, boolean)
instead.@Deprecated public boolean addPoint(java.awt.geom.Point2D pos, boolean insert)
addNewPoint(Point2D, boolean)
instead.@Deprecated public boolean addPointAt(java.awt.geom.Point2D pos, boolean insert)
addNewPoint(Point2D, boolean)
instead.public Anchor2D addNewPoint(java.awt.geom.Point2D pos, boolean insert, boolean select)
pos
- position of the new pointinsert
- if set to true
the new point will be inserted between the 2 closest points (in pixels
distance) else the new point is inserted at the end of the point listselect
- select the new created pointnull
otherwise (if the ROI does
not support this operation for instance)public Anchor2D addNewPoint(java.awt.geom.Point2D pos, boolean insert)
pos
- position of the new pointinsert
- if set to true
the new point will be inserted between the 2 closest
points (in pixels distance) else the new point is inserted at the end of the point
listnull
otherwise (if the ROI does
not support this operation for instance)public boolean removePoint(Anchor2D pt)
removeSelectedPoint(IcyCanvas)
when possible.@Deprecated public boolean removePointAt(IcyCanvas canvas, java.awt.geom.Point2D imagePoint)
removeSelectedPoint(IcyCanvas)
instead.public boolean removeSelectedPoint(IcyCanvas canvas)
public boolean hasSelectedPoint()
ROI
hasSelectedPoint
in class ROI
public void unselectAllPoints()
ROI
unselectAllPoints
in class ROI
public double computeNumberOfContourPoints()
ROI
computeNumberOfContourPoints
in class ROI2D
public double getLength(Sequence sequence) throws java.lang.UnsupportedOperationException
ROI
getLength
in class ROI
java.lang.UnsupportedOperationException
ROI.getNumberOfContourPoints()
public boolean isOverEdge(IcyCanvas canvas, double x, double y)
isOverEdge
in class ROI2D
public java.util.List<Anchor2D> getControlPoints()
public java.util.ArrayList<java.awt.geom.Point2D> getPoints()
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
public boolean[] getBooleanMask(int x, int y, int width, int height, 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 areawidth
- the width of the specified rectangular areaheight
- the height of the specified rectangular areainclusive
- If true then all partially contained (intersected) pixels are included in the mask.public boolean contains(java.awt.geom.Point2D p)
ROI2D
Point2D
is inside the ROI.public boolean contains(java.awt.geom.Rectangle2D r)
ROI2D
ROI
entirely contains the specified Rectangle2D
. The
ROI.contains()
method allows a implementation to
conservatively return false
when:
intersect
method returns true
and
ROI
entirely contains the
Rectangle2D
are prohibitively expensive.
false
even though the ROI
contains the
Rectangle2D
.contains
in interface java.awt.Shape
contains
in class ROI2D
r
- The specified Rectangle2D
true
if the interior of the ROI
entirely contains the Rectangle2D
;
false
otherwise or, if the ROI
contains the Rectangle2D
and the
intersects
method returns true
and the containment calculations would be too
expensive to perform.ROI2D.contains(double, double, double, double)
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 interface java.awt.Shape
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 boolean intersects(java.awt.geom.Rectangle2D r)
ROI2D
ROI
intersects the interior of a specified Rectangle2D
.
The ROI.intersects()
method allows a ROI
implementation to conservatively return true
when:
Rectangle2D
and the ROI
intersect, but
ROIs
this method might return true
even though the Rectangle2D
does not intersect the ROI
.intersects
in interface java.awt.Shape
intersects
in class ROI2D
r
- the specified Rectangle2D
true
if the interior of the ROI
and the interior of the
specified Rectangle2D
intersect, or are both highly likely to intersect
and intersection calculations would be too expensive to perform; false
otherwise.ROI2D.intersects(double, double, double, double)
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 interface java.awt.Shape
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 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 ROI getUnion(ROI roi) throws java.lang.UnsupportedOperationException
ROI
ROI
and return result in a new ROI
.ROIUtil.getUnion(ROI, ROI)
internally but it maybe overridden.public ROI getIntersection(ROI roi) throws java.lang.UnsupportedOperationException
ROI
ROI
and return result in a new ROI
.ROIUtil.getIntersection(ROI, ROI)
internally but it maybe overridden.getIntersection
in class ROI
java.lang.UnsupportedOperationException
public ROI getExclusiveUnion(ROI roi) throws java.lang.UnsupportedOperationException
ROI
ROI
and return result in a new ROI
.ROIUtil.getExclusiveUnion(ROI, ROI)
internally but it maybe overridden.getExclusiveUnion
in class ROI
java.lang.UnsupportedOperationException
public ROI getSubtraction(ROI roi) throws java.lang.UnsupportedOperationException
ROI
ROI
and return result in a new ROI
.ROIUtil.getSubtraction(ROI, ROI)
internally but it maybe overridden.getSubtraction
in class ROI
java.lang.UnsupportedOperationException
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 void controlPointPositionChanged(Anchor2D source)
public void controlPointOverlayChanged(OverlayEvent event)
public void painterChanged(PainterEvent event)
public void onChanged(CollapsibleEvent object)
onChanged
in interface ChangeListener
onChanged
in class ROI
public boolean loadFromXML(org.w3c.dom.Node node)
XMLPersistent
loadFromXML
in interface XMLPersistent
loadFromXML
in class ROI2D