public abstract class ROI extends java.lang.Object implements ChangeListener, XMLPersistent
Modifier and Type | Class and Description |
---|---|
static class |
ROI.ROIGroupId
Group if for ROI (used to do group type operation)
|
static class |
ROI.ROIIdComparator |
static class |
ROI.ROINameComparator |
class |
ROI.ROIPainter
Abstract basic class for ROI overlay
|
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
DEFAULT_COLOR |
static java.awt.Color |
DEFAULT_NORMAL_COLOR
Deprecated.
Use
DEFAULT_COLOR instead. |
static float |
DEFAULT_OPACITY |
static double |
DEFAULT_STROKE |
static java.awt.Color |
defaultColor |
static java.lang.Float |
defaultOpacity |
static java.lang.Boolean |
defaultShowName |
static java.lang.Double |
defaultStroke |
static java.lang.String |
ID_CLASSNAME |
static java.lang.String |
ID_COLOR |
static java.lang.String |
ID_GROUPID |
static java.lang.String |
ID_ID |
static java.lang.String |
ID_NAME |
static java.lang.String |
ID_OPACITY |
static java.lang.String |
ID_PROPERTIES |
static java.lang.String |
ID_READONLY |
static java.lang.String |
ID_ROI |
static java.lang.String |
ID_SELECTED |
static java.lang.String |
ID_SHOWNAME |
static java.lang.String |
ID_STROKE |
static ROI.ROIIdComparator |
idComparator |
static ROI.ROINameComparator |
nameComparator |
static java.lang.String |
PROPERTY_COLOR |
static java.lang.String |
PROPERTY_CREATING |
static java.lang.String |
PROPERTY_GROUPID |
static java.lang.String |
PROPERTY_ICON |
static java.lang.String |
PROPERTY_NAME |
static java.lang.String |
PROPERTY_OPACITY |
static java.lang.String |
PROPERTY_READONLY |
static java.lang.String |
PROPERTY_SHOWNAME |
static java.lang.String |
PROPERTY_STROKE |
static java.lang.String |
ROI_CHANGED_ALL |
static java.lang.String |
ROI_CHANGED_POSITION |
Constructor and Description |
---|
ROI() |
Modifier and Type | Method and Description |
---|---|
ROI |
add(ROI roi,
boolean allowCreate)
Adds content of specified
ROI into this ROI . |
void |
addListener(ROIListener listener)
Add a listener
|
void |
attachTo(Sequence sequence)
Deprecated.
use
Sequence.addROI(ROI) instead |
void |
beginUpdate() |
abstract boolean |
canSetBounds()
Returns
true if this ROI accepts bounds change through the setBounds5D(Rectangle5D) method. |
abstract boolean |
canSetPosition()
Returns
true if this ROI accepts position change through the setPosition5D(Point5D) method. |
static double |
canvasToImageDeltaX(IcyCanvas canvas,
int value)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageDeltaY(IcyCanvas canvas,
int value)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaX(IcyCanvas canvas,
double value)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaX(IcyCanvas canvas,
double value,
double logFactor)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaX(IcyCanvas canvas,
int value)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaX(IcyCanvas canvas,
int value,
double logFactor)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaY(IcyCanvas canvas,
double value)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaY(IcyCanvas canvas,
double value,
double logFactor)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaY(IcyCanvas canvas,
int value)
Deprecated.
Use
IcyCanvas methods instead |
static double |
canvasToImageLogDeltaY(IcyCanvas canvas,
int value,
double logFactor)
Deprecated.
Use
IcyCanvas methods instead |
abstract Rectangle5D |
computeBounds5D()
Calculate and returns the bounding box of the
ROI . |
abstract double |
computeNumberOfContourPoints()
Compute and returns the number of point (pixel) composing the ROI contour.
|
abstract double |
computeNumberOfPoints()
Compute and returns the number of point (pixel) contained in the ROI.
|
abstract boolean |
contains(double x,
double y,
double z,
double t,
double c)
Tests if a specified 5D point is inside the ROI.
|
abstract boolean |
contains(double x,
double y,
double z,
double t,
double c,
double sizeX,
double sizeY,
double sizeZ,
double sizeT,
double sizeC)
Tests if the
ROI entirely contains the specified 5D rectangular area. |
boolean |
contains(Point5D p)
Tests if a specified
Point5D is inside the ROI. |
boolean |
contains(Rectangle5D r)
Tests if the
ROI entirely contains the specified Rectangle5D . |
boolean |
contains(ROI roi)
Tests if the
ROI entirely contains the specified ROI . |
boolean |
copyFrom(ROI roi)
Copy all properties from the given ROI.
|
static ROI |
create(java.lang.String className)
Create a ROI from its class name or
PluginROI class name. |
static ROI |
create(java.lang.String className,
java.awt.geom.Point2D imagePoint)
Deprecated.
Use
create(String, Point5D) instead |
static ROI |
create(java.lang.String className,
Point5D imagePoint)
Create a ROI from its class name or
PluginROI class name (interactive mode). |
static ROI |
create(java.lang.String className,
Sequence seq,
java.awt.geom.Point2D imagePoint,
boolean creation)
Deprecated.
Use
create(String, Point5D) instead. |
static ROI |
createFromXML(org.w3c.dom.Node node)
Create a ROI from a xml definition
|
void |
delete()
Deprecated.
Use
remove() instead. |
void |
delete(boolean canUndo)
Deprecated.
Use
remove(boolean) instead. |
void |
detachFrom(Sequence sequence)
Deprecated.
use
Sequence.removeROI(ROI) instead |
void |
detachFromAll()
Deprecated.
Use
remove() instead. |
void |
detachFromAll(boolean canUndo)
Deprecated.
Use
remove(boolean) instead. |
void |
endUpdate() |
ROI |
exclusiveAdd(ROI roi,
boolean allowCreate)
Sets the content of this
ROI to be the union of its current content and the
content of the specified ROI , minus their intersection. |
void |
focusChanged()
Called when ROI focus state changed.
|
double |
getAdjustedStroke(IcyCanvas canvas)
Get adjusted stroke for the current canvas transformation
|
static double |
getAdjustedStroke(IcyCanvas canvas,
double stroke) |
BooleanMask2D |
getBooleanMask2D(int z,
int t,
int c,
boolean inclusive)
Returns the
BooleanMask2D object representing the XY plan content at specified Z, T,
C position. |
boolean[] |
getBooleanMask2D(int x,
int y,
int width,
int height,
int z,
int t,
int c,
boolean inclusive)
Returns the boolean array mask for the specified rectangular region at specified C, Z, T
position.
|
boolean[] |
getBooleanMask2D(java.awt.Rectangle rect,
int z,
int t,
int c,
boolean inclusive)
Get the boolean bitmap mask for the specified rectangular area of the roi and for the
specified Z,T position.
|
Rectangle5D |
getBounds5D()
Returns the bounding box of the
ROI . |
java.lang.String |
getClassName() |
java.awt.Color |
getColor()
Return the ROI painter base color.
|
ROI |
getCopy()
Returns a copy of the ROI or
null if the operation failed. |
static java.awt.Color |
getDefaultColor() |
java.lang.String |
getDefaultName() |
static float |
getDefaultOpacity() |
static boolean |
getDefaultShowName() |
static double |
getDefaultStroke() |
abstract int |
getDimension()
Returns the number of dimension of the ROI:
2 for ROI2D 3 for ROI3D 4 for ROI4D 5 for ROI5D |
java.awt.Color |
getDisplayColor()
Returns the color used to display the ROI depending its current state.
|
ROI |
getExclusiveUnion(ROI roi)
Compute exclusive union with specified
ROI and return result in a new ROI . |
Sequence |
getFirstSequence()
Return first sequence where ROI is attached
|
java.awt.Color |
getFocusedColor()
Return the ROI painter focused color.
|
ROI.ROIGroupId |
getGroupId() |
java.awt.Image |
getIcon() |
int |
getId()
ROI unique id
|
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.lang.String |
getName() |
static java.lang.String |
getNameSuffix(int z,
int t,
int c)
Returns the name suffix when we want to obtain only a sub part of the ROI (always in Z,T,C
order).
|
double |
getNumberOfContourPoints()
Returns the number of point (pixel) composing the ROI contour.
|
double |
getNumberOfPoints()
Returns the number of point (pixel) contained in the ROI.
|
float |
getOpacity()
Returns the ROI painter opacity factor (0 = transparent while 1 means opaque).
|
ROI.ROIPainter |
getOverlay()
|
ROI.ROIPainter |
getPainter()
Deprecated.
Use
getOverlay() instead. |
double |
getPerimeter()
Deprecated.
Use
getLength(Sequence) or getNumberOfContourPoints() instead. |
Point5D |
getPosition5D()
Returns the ROI position which normally correspond to the minimum point of the ROI
bounds.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Retrieve all custom ROI properties (map of (Key,Value)).
|
java.lang.String |
getProperty(java.lang.String name)
Retrieve a ROI property value.
|
java.lang.Object |
getPropertyValue(java.lang.String propertyName)
Deprecated.
use
getProperty(String) instead. |
static int |
getROICount(org.w3c.dom.Node node)
Return the number of ROI defined in the specified XML node.
|
static java.util.ArrayList<ROI> |
getROIList(java.util.ArrayList<? extends ROI> rois,
java.lang.Class<? extends ROI> clazz)
Deprecated.
Use
getROIList(List, Class) instead. |
static java.util.List<ROI> |
getROIList(java.util.List<? extends ROI> rois,
java.lang.Class<? extends ROI> clazz)
Return ROI of specified type from the ROI list
|
static java.util.List<ROI> |
getROIList(ROI[] rois,
java.lang.Class<? extends ROI> clazz)
Deprecated.
Use
getROIList(List, Class) instead. |
static java.util.List<ROI> |
getROIsFromXML(org.w3c.dom.Node node)
Deprecated.
Use
loadROIsFromXML(Node) instead. |
java.awt.Color |
getSelectedColor()
Deprecated.
|
java.util.ArrayList<Sequence> |
getSequences()
Return sequences where ROI is attached
|
boolean |
getShowName()
Return
true if ROI should display its name at draw time. |
java.lang.String |
getSimpleClassName() |
double |
getStroke()
Return the ROI painter stroke.
|
ROI |
getSubROI(int z,
int t,
int c)
Returns a sub part of the ROI.
|
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 . |
double |
getVolume()
Deprecated.
Only for ROI3D object, use
getNumberOfPoints() instead for other type of
ROI. |
abstract boolean |
hasSelectedPoint()
Returns true if the ROI has a (control) point which is currently focused/selected
|
void |
internalFocus() |
void |
internalSelect()
Deprecated.
Use
setSelected(boolean) instead. |
void |
internalUnfocus() |
void |
internalUnselect()
Deprecated.
Use
setSelected(boolean) instead. |
ROI |
intersect(ROI roi,
boolean allowCreate)
Sets the content of this
ROI to the intersection of
its current content and the content of the specified ROI . |
abstract boolean |
intersects(double x,
double y,
double z,
double t,
double c,
double sizeX,
double sizeY,
double sizeZ,
double sizeT,
double sizeC)
Tests if the interior of the
ROI intersects the interior of a specified
rectangular area. |
boolean |
intersects(Rectangle5D r)
Tests if the interior of the
ROI intersects the interior of a specified
rectangular area. |
boolean |
intersects(ROI roi)
Tests if the current
ROI intersects the specified ROI . |
abstract boolean |
isActiveFor(IcyCanvas canvas)
Return true if the ROI is active for the specified canvas.
|
boolean |
isAttached(Sequence sequence)
Return true is this ROI is attached to at least one sequence
|
boolean |
isCreating() |
boolean |
isDefaultName()
Returns
true if the ROI has its default name |
boolean |
isEditable()
Deprecated.
Use
isReadOnly() instead. |
boolean |
isEmpty()
Returns
true if the ROI is empty (does not contains anything). |
boolean |
isFocused() |
boolean |
isReadOnly()
Return true if ROI is in read only state (cannot be modified from GUI).
|
boolean |
isSelected() |
boolean |
isUpdating() |
boolean |
loadFromXML(org.w3c.dom.Node node)
LOAD
|
boolean |
loadFromXML(org.w3c.dom.Node node,
boolean preserveId) |
static java.util.List<ROI> |
loadROIsFromXML(org.w3c.dom.Node node)
Return a list of ROI from a XML node.
|
ROI |
merge(ROI roi,
ShapeUtil.BooleanOperator op)
Compute the boolean operation with specified
ROI and return result in a new ROI . |
ROI |
mergeWith(ROI roi,
ShapeUtil.BooleanOperator op,
boolean allowCreate)
Same as
#merge(ROI, BooleanOperator) except it modifies the current ROI to reflect the
result of the boolean operation with specified ROI . |
void |
nameChanged()
Deprecated.
Use
propertyChanged(String) instead. |
void |
onChanged(CollapsibleEvent object)
fire changed event
|
void |
painterChanged()
Deprecated.
|
void |
propertyChanged(java.lang.String propertyName)
Called when ROI property has changed
|
void |
remove()
Remove this ROI (detach from all sequence)
|
void |
remove(boolean canUndo)
Remove this ROI (detach from all sequence)
|
void |
removeListener(ROIListener listener)
Remove a listener
|
void |
roiChanged()
Deprecated.
Use
roiChanged(boolean) instead. |
void |
roiChanged(boolean contentChanged)
Called when ROI has changed its content and/or position.
|
void |
roiChanged(ROIEvent.ROIPointEventType pointEventType,
java.lang.Object point)
Deprecated.
Use
roiChanged(boolean) instead |
static void |
saveROIsToXML(org.w3c.dom.Node node,
java.util.List<ROI> rois)
Set a list of ROI to a XML node.
|
boolean |
saveToXML(org.w3c.dom.Node node)
SAVE
|
void |
selectionChanged()
Called when ROI selected state changed.
|
abstract void |
setBounds5D(Rectangle5D bounds)
Set the
ROI bounds. |
void |
setColor(java.awt.Color value)
Set the ROI painter base color.
|
void |
setCreating(boolean value)
Set the internal creation mode state.
|
static void |
setDefaultColor(java.awt.Color value) |
static void |
setDefaultOpacity(float value) |
static void |
setDefaultShowName(boolean value) |
static void |
setDefaultStroke(double value) |
void |
setEditable(boolean value)
Deprecated.
Use
setReadOnly(boolean) instead. |
void |
setFocused(boolean value) |
void |
setGroupId(ROI.ROIGroupId value) |
void |
setIcon(java.awt.Image value) |
void |
setMousePos(java.awt.geom.Point2D pos)
Deprecated.
Use
getOverlay().setMousePos(..) instead. |
void |
setName(java.lang.String value) |
void |
setOpacity(float value)
Sets the ROI painter content opacity factor (0 = transparent while 1 means opaque).
|
abstract void |
setPosition5D(Point5D position)
Set the
ROI position. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Generic way to set ROI property value.
|
void |
setPropertyValue(java.lang.String propertyName,
java.lang.Object value)
Deprecated.
|
void |
setReadOnly(boolean value)
Set the read only state of ROI.
|
static void |
setROIsFromXML(org.w3c.dom.Node node,
java.util.List<ROI> rois)
Deprecated.
Use
saveROIsToXML(Node, List) instead |
void |
setSelected(boolean value)
Set the selected state of this ROI.
|
void |
setSelected(boolean value,
boolean exclusive)
Deprecated.
Use
setSelected(boolean) or Sequence.setSelectedROI(ROI) depending you want
exclusive selection or not. |
void |
setSelectedColor(java.awt.Color value)
Deprecated.
selected color is automatically calculated.
|
void |
setShowName(boolean value)
Set the show name property of ROI.
|
void |
setStroke(double value)
Set ROI painter stroke.
|
ROI |
subtract(ROI roi,
boolean allowCreate)
Subtract the specified
ROI content from current ROI . |
void |
unselectAllPoints()
Remove focus/selected state on all (control) points.
|
public static final java.lang.String ID_ROI
public static final java.lang.String ID_CLASSNAME
public static final java.lang.String ID_ID
public static final java.lang.String ID_NAME
public static final java.lang.String ID_GROUPID
public static final java.lang.String ID_COLOR
public static final java.lang.String ID_STROKE
public static final java.lang.String ID_OPACITY
public static final java.lang.String ID_SELECTED
public static final java.lang.String ID_READONLY
public static final java.lang.String ID_SHOWNAME
public static final java.lang.String ID_PROPERTIES
public static final ROI.ROIIdComparator idComparator
public static final ROI.ROINameComparator nameComparator
public static final double DEFAULT_STROKE
public static final java.awt.Color DEFAULT_COLOR
public static final float DEFAULT_OPACITY
public static java.awt.Color defaultColor
public static java.lang.Float defaultOpacity
public static java.lang.Double defaultStroke
public static java.lang.Boolean defaultShowName
@Deprecated public static final java.awt.Color DEFAULT_NORMAL_COLOR
DEFAULT_COLOR
instead.public static final java.lang.String PROPERTY_NAME
public static final java.lang.String PROPERTY_GROUPID
public static final java.lang.String PROPERTY_ICON
public static final java.lang.String PROPERTY_CREATING
public static final java.lang.String PROPERTY_READONLY
public static final java.lang.String PROPERTY_SHOWNAME
public static final java.lang.String PROPERTY_COLOR
public static final java.lang.String PROPERTY_STROKE
public static final java.lang.String PROPERTY_OPACITY
public static final java.lang.String ROI_CHANGED_POSITION
public static final java.lang.String ROI_CHANGED_ALL
public ROI()
public static ROI create(java.lang.String className)
PluginROI
class name.className
- roi class name or PluginROI
class name.public static ROI create(java.lang.String className, Point5D imagePoint)
PluginROI
class name (interactive mode).className
- roi class name or PluginROI
class name.imagePoint
- initial point position in image coordinates (interactive mode).@Deprecated public static ROI create(java.lang.String className, java.awt.geom.Point2D imagePoint)
create(String, Point5D)
instead@Deprecated public static ROI create(java.lang.String className, Sequence seq, java.awt.geom.Point2D imagePoint, boolean creation)
create(String, Point5D)
instead.public static ROI createFromXML(org.w3c.dom.Node node)
node
- xml node defining the roipublic static double getAdjustedStroke(IcyCanvas canvas, double stroke)
public static java.util.List<ROI> getROIList(java.util.List<? extends ROI> rois, java.lang.Class<? extends ROI> clazz)
@Deprecated public static java.util.ArrayList<ROI> getROIList(java.util.ArrayList<? extends ROI> rois, java.lang.Class<? extends ROI> clazz)
getROIList(List, Class)
instead.@Deprecated public static java.util.List<ROI> getROIList(ROI[] rois, java.lang.Class<? extends ROI> clazz)
getROIList(List, Class)
instead.public static int getROICount(org.w3c.dom.Node node)
node
- XML node defining the ROI listpublic static java.util.List<ROI> loadROIsFromXML(org.w3c.dom.Node node)
node
- XML node defining the ROI list@Deprecated public static java.util.List<ROI> getROIsFromXML(org.w3c.dom.Node node)
loadROIsFromXML(Node)
instead.public static void saveROIsToXML(org.w3c.dom.Node node, java.util.List<ROI> rois)
node
- XML node which is used to store the list of ROIrois
- the list of ROI to store in the XML node@Deprecated public static void setROIsFromXML(org.w3c.dom.Node node, java.util.List<ROI> rois)
saveROIsToXML(Node, List)
insteadpublic static java.awt.Color getDefaultColor()
public static float getDefaultOpacity()
public static double getDefaultStroke()
public static boolean getDefaultShowName()
public static void setDefaultColor(java.awt.Color value)
public static void setDefaultOpacity(float value)
public static void setDefaultStroke(double value)
public static void setDefaultShowName(boolean value)
@Deprecated public static double canvasToImageDeltaX(IcyCanvas canvas, int value)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaX(IcyCanvas canvas, double value, double logFactor)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaX(IcyCanvas canvas, double value)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaX(IcyCanvas canvas, int value, double logFactor)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaX(IcyCanvas canvas, int value)
IcyCanvas
methods instead@Deprecated public static double canvasToImageDeltaY(IcyCanvas canvas, int value)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaY(IcyCanvas canvas, double value, double logFactor)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaY(IcyCanvas canvas, double value)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaY(IcyCanvas canvas, int value, double logFactor)
IcyCanvas
methods instead@Deprecated public static double canvasToImageLogDeltaY(IcyCanvas canvas, int value)
IcyCanvas
methods insteadpublic abstract int getDimension()
@Deprecated public void attachTo(Sequence sequence)
Sequence.addROI(ROI)
instead@Deprecated public void detachFrom(Sequence sequence)
Sequence.removeROI(ROI)
instead@Deprecated public void detachFromAll(boolean canUndo)
remove(boolean)
instead.@Deprecated public void detachFromAll()
remove()
instead.public boolean isAttached(Sequence sequence)
public Sequence getFirstSequence()
public java.util.ArrayList<Sequence> getSequences()
public void remove(boolean canUndo)
public void remove()
@Deprecated public void delete(boolean canUndo)
remove(boolean)
instead.public java.lang.String getClassName()
public java.lang.String getSimpleClassName()
public int getId()
@Deprecated public ROI.ROIPainter getPainter()
getOverlay()
instead.public ROI.ROIPainter getOverlay()
public double getStroke()
public double getAdjustedStroke(IcyCanvas canvas)
public void setStroke(double value)
public float getOpacity()
public void setOpacity(float value)
public java.awt.Color getFocusedColor()
@Deprecated public java.awt.Color getSelectedColor()
public java.awt.Color getDisplayColor()
public java.awt.Color getColor()
public void setColor(java.awt.Color value)
@Deprecated public void setSelectedColor(java.awt.Color value)
public java.awt.Image getIcon()
public void setIcon(java.awt.Image value)
value
- the icon to setpublic ROI.ROIGroupId getGroupId()
public void setGroupId(ROI.ROIGroupId value)
value
- the group id to setpublic java.lang.String getDefaultName()
public boolean isDefaultName()
true
if the ROI has its default namepublic java.lang.String getName()
public void setName(java.lang.String value)
value
- the name to setpublic java.util.Map<java.lang.String,java.lang.String> getProperties()
public java.lang.String getProperty(java.lang.String name)
null
if the property value is empty.name
- Property name.IllegalArgumentException
when not possible.public void setProperty(java.lang.String name, java.lang.String value)
name
- Property name.IllegalArgumentException
when not possible.value
- the value to set in the property (for instance "FALSE" for PROPERTY_READONLY
)@Deprecated public java.lang.Object getPropertyValue(java.lang.String propertyName)
getProperty(String)
instead.@Deprecated public void setPropertyValue(java.lang.String propertyName, java.lang.Object value)
setProperty(String, String)
public boolean isCreating()
public void setCreating(boolean value)
public abstract boolean hasSelectedPoint()
public void unselectAllPoints()
public boolean isFocused()
public void setFocused(boolean value)
value
- the focused to setpublic void internalFocus()
public void internalUnfocus()
public boolean isSelected()
public void setSelected(boolean value)
Sequence.setSelectedROI(ROI)
for exclusive ROI selection.value
- the selected to set@Deprecated public void setSelected(boolean value, boolean exclusive)
setSelected(boolean)
or Sequence.setSelectedROI(ROI)
depending you want
exclusive selection or not.@Deprecated public void internalUnselect()
setSelected(boolean)
instead.@Deprecated public void internalSelect()
setSelected(boolean)
instead.@Deprecated public boolean isEditable()
isReadOnly()
instead.@Deprecated public void setEditable(boolean value)
setReadOnly(boolean)
instead.public boolean isReadOnly()
public void setReadOnly(boolean value)
public boolean getShowName()
true
if ROI should display its name at draw time.public void setShowName(boolean value)
true
the ROI shows its name at draw time.public abstract boolean isActiveFor(IcyCanvas canvas)
public abstract Rectangle5D computeBounds5D()
ROI
.getBounds5D()
which should try to cache the result as the
bounding box calculation can take some computation time for complex ROI.public Rectangle5D getBounds5D()
ROI
. Note that there is no guarantee that the
returned Rectangle5D
is the smallest bounding box that encloses the ROI
,
only that the ROI
lies entirely within the indicated Rectangle5D
.Rectangle5D
that is a bounding box of the ROI
.computeBounds5D()
public Point5D getPosition5D()
getBounds5D()
public abstract boolean canSetBounds()
true
if this ROI accepts bounds change through the setBounds5D(Rectangle5D)
method.public abstract boolean canSetPosition()
true
if this ROI accepts position change through the setPosition5D(Point5D)
method.public abstract void setBounds5D(Rectangle5D bounds)
ROI
bounds.canSetBounds()
first to test if
the operation is supported.bounds
- new ROI boundspublic abstract void setPosition5D(Point5D position)
ROI
position.canSetPosition()
first to test
if the operation is supported.position
- new ROI positionpublic boolean isEmpty()
true
if the ROI is empty (does not contains anything).public abstract boolean contains(double x, double y, double z, double t, double c)
true
if the specified Point5D
is inside the boundary of the ROI
;
false
otherwise.public boolean contains(Point5D p)
Point5D
is inside the ROI.p
- the specified Point5D
to be testedtrue
if the specified Point2D
is inside the boundary of the ROI
;
false
otherwise.public abstract boolean contains(double x, double y, double z, double t, double c, double sizeX, double sizeY, double sizeZ, double sizeT, double sizeC)
ROI
entirely contains the specified 5D 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.x
- the X coordinate of the start corner of the specified rectangular areay
- the Y coordinate of the start corner of the specified rectangular areaz
- the Z coordinate of the start corner of the specified rectangular areat
- the T coordinate of the start corner of the specified rectangular areac
- the C coordinate of the start corner of the specified rectangular areasizeX
- the X size of the specified rectangular areasizeY
- the Y size of the specified rectangular areasizeZ
- the Z size of the specified rectangular areasizeT
- the T size of the specified rectangular areasizeC
- the C size 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 contains(Rectangle5D r)
ROI
entirely contains the specified Rectangle5D
. 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
Rectangle5D
.r
- The specified Rectangle5D
true
if the interior of the ROI
entirely contains the Rectangle5D
;
false
otherwise or, if the ROI
contains the Rectangle5D
and the
intersects
method returns true
and the containment
calculations would be too
expensive to perform.contains(double, double, double, double, double, double, double, double, double, double)
public boolean contains(ROI roi)
ROI
entirely contains the specified ROI
.
WARNING: this method may be "pixel accurate" only depending the internal implementation.true
if the current ROI
entirely contains the
specified ROI
; false
otherwise.public abstract boolean intersects(double x, double y, double z, double t, double c, double sizeX, double sizeY, double sizeZ, double sizeT, double sizeC)
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
.true
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 intersects(Rectangle5D r)
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
.true
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 intersects(ROI roi)
ROI
intersects the specified ROI
.true
if ROI
intersect, false
otherwise.public boolean[] getBooleanMask2D(int x, int y, int width, int height, int z, int t, int c, boolean inclusive)
  result[((y1 - y) * width) + (x1 - x)] = true
  result[((y1 - y) * width) + (x1 - x)] = false
x
- the X coordinate of the upper-left corner of the specified rectangular regiony
- the Y coordinate of the upper-left corner of the specified rectangular regionwidth
- the width of the specified rectangular regionheight
- the height of the specified rectangular regionz
- Z position we want to retrieve the boolean maskt
- T position we want to retrieve the boolean maskc
- C position we want to retrieve the boolean maskinclusive
- If true then all partially contained (intersected) pixels are included in the mask.public boolean[] getBooleanMask2D(java.awt.Rectangle rect, int z, int t, int c, boolean inclusive)
rect
- 2D rectangular area we want to retrieve the boolean maskz
- Z position we want to retrieve the boolean maskt
- T position we want to retrieve the boolean maskc
- C position we want to retrieve the boolean maskinclusive
- If true then all partially contained (intersected) pixels are included in the mask.public BooleanMask2D getBooleanMask2D(int z, int t, int c, boolean inclusive)
BooleanMask2D
object representing the XY plan content at specified Z, T,
C position.  mask[(y - bounds.y) * bounds.width) + (x - bounds.x)] = true
  mask[(y - bounds.y) * bounds.width) + (x - bounds.x)] = false
z
- Z position we want to retrieve the boolean mask.t
- T position we want to retrieve the boolean mask.c
- C position we want to retrieve the boolean mask.inclusive
- If true then all partially contained (intersected) pixels are included in the mask.public ROI mergeWith(ROI roi, ShapeUtil.BooleanOperator op, boolean allowCreate) throws java.lang.UnsupportedOperationException
#merge(ROI, BooleanOperator)
except it modifies the current ROI
to reflect the
result of the boolean operation with specified ROI
.UnsupportedOperationException
is thrown if allowCreate
parameter is set to
false
, if the parameter is set to true
the result may be returned
in a new created ROI.roi
- the ROI
to merge with current ROI
op
- the boolean operation to processallowCreate
- if set to true
the method will create a new ROI to return the result of
the operation if it
cannot be directly processed on the current ROI
allowCreate
parameter was set to true
java.lang.UnsupportedOperationException
- if the two ROI cannot be merged together.#merge(ROI, BooleanOperator)
public ROI add(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
into this ROI
.
The resulting content of this ROI
will include
the union of both ROI's contents.UnsupportedOperationException
is thrown if allowCreate
parameter
is set to false
, if the parameter is set to true
the result may be returned in a new
created ROI.
// Example: roi1 (before) + roi2 = roi1 (after) ################ ################ ################ ############## ############## ################ ############ ############ ################ ########## ########## ################ ######## ######## ################ ###### ###### ###### ###### #### #### #### #### ## ## ## ##
roi
- the ROI
to be added to the current ROI
allowCreate
- if set to true
the method will create a new ROI to return the result of
the operation if it
cannot be directly processed on the current ROI
allowCreate
parameter was set to true
java.lang.UnsupportedOperationException
- if the two ROI cannot be added together.getUnion(ROI)
public ROI intersect(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
to the intersection of
its current content and the content of the specified ROI
.
The resulting ROI will include only contents that were contained in both ROI.UnsupportedOperationException
is thrown if allowCreate
parameter
is set to false
, if the parameter is set to true
the result may be returned in a new
created ROI.
// Example: roi1 (before) intersect roi2 = roi1 (after) ################ ################ ################ ############## ############## ############ ############ ############ ######## ########## ########## #### ######## ######## ###### ###### #### #### ## ##
roi
- the ROI
to be intersected to the current ROI
allowCreate
- if set to true
the method will create a new ROI to return the result of
the operation if it
cannot be directly processed on the current ROI
allowCreate
parameter was set to true
java.lang.UnsupportedOperationException
- if the two ROI cannot be intersected together.getIntersection(ROI)
public ROI exclusiveAdd(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
to be the union of its current content and the
content of the specified ROI
, minus their intersection.
The resulting ROI
will include only content that were contained in either this ROI
or
in the specified ROI
, but not in both.UnsupportedOperationException
is thrown if allowCreate
parameter is set to
false
, if the parameter is set to true
the result may be returned
in a new created ROI.
// Example: roi1 (before) xor roi2 = roi1 (after) ################ ################ ############## ############## ## ## ############ ############ #### #### ########## ########## ###### ###### ######## ######## ################ ###### ###### ###### ###### #### #### #### #### ## ## ## ##
roi
- the ROI
to be exclusively added to the current ROI
allowCreate
- if set to true
the method will create a new ROI to return the result of
the operation if it
cannot be directly processed on the current ROI
allowCreate
parameter was set to true
java.lang.UnsupportedOperationException
- if the two ROI cannot be exclusively added together.getExclusiveUnion(ROI)
public ROI subtract(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
content from current ROI
.UnsupportedOperationException
is thrown if allowCreate
parameter
is set to false
, if the parameter is set to true
the result may be returned in a new
created ROI.roi
- the ROI
to subtract from the current ROI
allowCreate
- if set to true
the method will create a new ROI to return the result of
the operation if it
cannot be directly processed on the current ROI
allowCreate
parameter was set to true
java.lang.UnsupportedOperationException
- if we can't subtract the specified ROI
from this ROI
getSubtraction(ROI)
public ROI merge(ROI roi, ShapeUtil.BooleanOperator op) throws java.lang.UnsupportedOperationException
ROI
and return result in a new ROI
.java.lang.UnsupportedOperationException
public ROI getUnion(ROI roi) throws java.lang.UnsupportedOperationException
ROI
and return result in a new ROI
.ROIUtil.getUnion(ROI, ROI)
internally but it maybe overridden.java.lang.UnsupportedOperationException
public ROI getIntersection(ROI roi) throws java.lang.UnsupportedOperationException
ROI
and return result in a new ROI
.ROIUtil.getIntersection(ROI, ROI)
internally but it maybe overridden.java.lang.UnsupportedOperationException
public ROI getExclusiveUnion(ROI roi) throws java.lang.UnsupportedOperationException
ROI
and return result in a new ROI
.ROIUtil.getExclusiveUnion(ROI, ROI)
internally but it maybe overridden.java.lang.UnsupportedOperationException
public ROI getSubtraction(ROI roi) throws java.lang.UnsupportedOperationException
ROI
and return result in a new ROI
.ROIUtil.getSubtraction(ROI, ROI)
internally but it maybe overridden.java.lang.UnsupportedOperationException
public abstract double computeNumberOfContourPoints()
public double getNumberOfContourPoints()
computeNumberOfContourPoints()
public abstract double computeNumberOfPoints()
public double getNumberOfPoints()
public double getLength(Sequence sequence) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
getNumberOfContourPoints()
@Deprecated public double getPerimeter()
@Deprecated public double getVolume()
getNumberOfPoints()
instead for other type of
ROI.@Deprecated public void setMousePos(java.awt.geom.Point2D pos)
getOverlay().setMousePos(..)
instead.public static java.lang.String getNameSuffix(int z, int t, int c)
[Z=1, T=5]
z
- the specific Z position (slice) we want to retrieve (-1
to retrieve the
whole ROI Z dimension)t
- the specific T position (frame) we want to retrieve (-1
to retrieve the
whole ROI T dimension)c
- the specific C position (channel) we want to retrieve (-1
to retrieve the
whole ROI C dimension)public ROI getSubROI(int z, int t, int c)
ROI2DArea
, ROI3DArea
,
ROI4DArea
or ROI5DArea
) where only internals pixels are preserved.
Note that this function can eventually return null
when the result ROI is empty.z
- the specific Z position (slice) we want to retrieve (-1
to retrieve the
whole ROI Z dimension)t
- the specific T position (frame) we want to retrieve (-1
to retrieve the
whole ROI T dimension)c
- the specific C position (channel) we want to retrieve (-1
to retrieve the
whole ROI C dimension)public boolean copyFrom(ROI roi)
false
if the operation failedpublic boolean loadFromXML(org.w3c.dom.Node node, boolean preserveId)
public boolean loadFromXML(org.w3c.dom.Node node)
XMLPersistent
loadFromXML
in interface XMLPersistent
public boolean saveToXML(org.w3c.dom.Node node)
XMLPersistent
saveToXML
in interface XMLPersistent
@Deprecated public void roiChanged(ROIEvent.ROIPointEventType pointEventType, java.lang.Object point)
roiChanged(boolean)
insteadpublic void roiChanged(boolean contentChanged)
contentChanged
- mean that ROI content has changed otherwise we consider only a position change@Deprecated public void roiChanged()
roiChanged(boolean)
instead.public void selectionChanged()
public void focusChanged()
@Deprecated public void painterChanged()
@Deprecated public void nameChanged()
propertyChanged(String)
instead.public void propertyChanged(java.lang.String propertyName)
public void addListener(ROIListener listener)
listener
- public void removeListener(ROIListener listener)
listener
- public void beginUpdate()
public void endUpdate()
public boolean isUpdating()
public void onChanged(CollapsibleEvent object)
ChangeListener
onChanged
in interface ChangeListener