public abstract class ROI4D extends ROI
ROI.ROIGroupId, ROI.ROIIdComparator, ROI.ROINameComparator, ROI.ROIPainter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID_C |
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 |
---|
ROI4D() |
Modifier and Type | Method and Description |
---|---|
boolean |
canSetBounds()
Returns
true if this ROI accepts bounds change through the ROI.setBounds5D(Rectangle5D) 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. |
abstract Rectangle4D |
computeBounds4D()
Calculate and returns the 4D bounding box of the
ROI . |
Rectangle5D |
computeBounds5D()
Calculate and returns the bounding box of the
ROI . |
double |
computeNumberOfContourPoints()
Compute and returns the number of point (pixel) composing the ROI contour.
|
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)
Tests if the specified coordinates are inside the
ROI . |
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 sizeX,
double sizeY,
double sizeZ,
double sizeT)
Tests if the
ROI entirely contains the specified 4D rectangular area. |
boolean |
contains(double x,
double y,
double z,
double t,
double c,
double sizeX,
double sizeY,
double sizeT,
double sizeZ,
double sizeC)
Tests if the
ROI entirely contains the specified 5D rectangular area. |
boolean |
contains(Point4D p)
Tests if a specified
Point4D is inside the ROI. |
boolean |
contains(Rectangle4D r)
Tests if the interior of the
ROI entirely contains the specified Rectangle4D . |
boolean |
contains(ROI roi)
Tests if the
ROI entirely contains the specified ROI . |
BooleanMask4D |
getBooleanMask(boolean inclusive)
Get the
BooleanMask4D object representing the roi. |
BooleanMask2D |
getBooleanMask2D(int z,
int t,
boolean inclusive)
Get the
BooleanMask2D object representing the roi for the specified Z,T position. |
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,
boolean inclusive)
Get the boolean bitmap mask for the specified rectangular area of the roi and for the
specified Z,T 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,
boolean inclusive)
Get the boolean bitmap mask for the specified rectangular area of the roi and for the
specified Z,T position.
|
BooleanMask3D |
getBooleanMask3D(int t,
boolean inclusive)
Get the
BooleanMask3D object representing the roi for specified T position. |
BooleanMask3D |
getBooleanMask3D(int z,
int t,
int c,
boolean inclusive)
Returns the
BooleanMask3D object representing the XYZ volume content at specified Z,
T, C position. |
BooleanMask4D |
getBooleanMask4D(int z,
int t,
int c,
boolean inclusive)
Returns the
BooleanMask4D object representing the XYZT space content at specified Z,
T, C position. |
Rectangle4D.Integer |
getBounds()
Returns an integer
Rectangle4D that completely encloses the ROI . |
Rectangle4D |
getBounds4D()
Returns the bounding box of the
ROI . |
int |
getC()
Returns the C position.
|
java.lang.String |
getDefaultName() |
int |
getDimension()
Returns the number of dimension of the ROI:
2 for ROI2D 3 for ROI3D 4 for ROI4D 5 for ROI5D |
Point4D.Integer |
getPosition()
Returns the integer ROI position which normally correspond to the minimum point of the
ROI bounds.
|
Point4D |
getPosition4D()
Returns the ROI position which normally correspond to the minimum point of the ROI
bounds.
|
static java.util.ArrayList<ROI4D> |
getROI4DList(java.util.ArrayList<ROI> rois)
Deprecated.
Use
getROI4DList(List) instead. |
static java.util.List<ROI4D> |
getROI4DList(java.util.List<ROI> rois)
Return all 4D ROI from the ROI list
|
abstract boolean |
intersects(double x,
double y,
double z,
double t,
double sizeX,
double sizeY,
double sizeZ,
double sizeT)
Tests if the interior of the
ROI intersects the interior of a specified
4D rectangular area. |
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(Rectangle4D r)
Tests if the interior of the
ROI intersects the interior of a specified Rectangle4D . |
boolean |
intersects(ROI roi)
Tests if the current
ROI intersects the specified ROI . |
boolean |
isActiveFor(IcyCanvas canvas)
Return true if the ROI is active for the specified canvas.
|
boolean |
isActiveFor(int c)
Return true if the ROI is active for the specified C coordinate
|
boolean |
loadFromXML(org.w3c.dom.Node node)
LOAD
|
boolean |
saveToXML(org.w3c.dom.Node node)
SAVE
|
void |
setBounds4D(Rectangle4D bounds)
Set the
ROI 4D bounds. |
void |
setBounds5D(Rectangle5D bounds)
Set the
ROI bounds. |
void |
setC(int value)
Sets C position of this 4D ROI.
|
void |
setPosition4D(Point4D position)
Set the
ROI 4D position. |
void |
setPosition5D(Point5D position)
Set the
ROI position. |
void |
translate(double dx,
double dy,
double dz,
double dt)
Translate the ROI position by the specified delta X/Y/Z/T.
|
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, getExclusiveUnion, getFirstSequence, getFocusedColor, getGroupId, getIcon, getId, getIntersection, getLength, getName, getNameSuffix, getNumberOfContourPoints, getNumberOfPoints, getOpacity, getOverlay, getPainter, getPerimeter, getPosition5D, getProperties, getProperty, getPropertyValue, getROICount, getROIList, getROIList, getROIList, getROIsFromXML, getSelectedColor, getSequences, getShowName, getSimpleClassName, getStroke, getSubROI, getSubtraction, getUnion, getVolume, hasSelectedPoint, internalFocus, internalSelect, internalUnfocus, internalUnselect, intersect, intersects, isAttached, isCreating, isDefaultName, isEditable, isEmpty, isFocused, isReadOnly, isSelected, isUpdating, loadFromXML, loadROIsFromXML, merge, mergeWith, nameChanged, onChanged, 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, unselectAllPoints
public static final java.lang.String ID_C
public ROI4D()
@Deprecated public static java.util.ArrayList<ROI4D> getROI4DList(java.util.ArrayList<ROI> rois)
getROI4DList(List)
instead.public static java.util.List<ROI4D> getROI4DList(java.util.List<ROI> rois)
public java.lang.String getDefaultName()
getDefaultName
in class ROI
public final int getDimension()
ROI
getDimension
in class ROI
public boolean contains(Point4D p)
Point4D
is inside the ROI.p
- the specified Point4D
to be testedtrue
if the specified Point3D
is inside the boundary of the ROI
;
false
otherwise.public boolean contains(Rectangle4D r)
ROI
entirely contains the specified Rectangle4D
. The
ROI.contains()
method allows a implementation to
conservatively return false
when:
intersect
method returns true
and
ROI
entirely contains the
Rectangle3D
are prohibitively expensive.
false
even though the ROI
contains the
Rectangle4D
.r
- The specified Rectangle4D
true
if the interior of the ROI
entirely contains the Rectangle4D
;
false
otherwise or, if the ROI
contains the Rectangle4D
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)
public abstract boolean contains(double x, double y, double z, double t)
ROI
.x
- the specified X coordinate to be testedy
- the specified Y coordinate to be testedz
- the specified Z coordinate to be testedt
- the specified T coordinate to be testedtrue
if the specified 4D coordinates are inside the ROI
boundary;
false
otherwise.public abstract boolean contains(double x, double y, double z, double t, double sizeX, double sizeY, double sizeZ, double sizeT)
ROI
entirely contains the specified 4D 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 minimum corner position of the specified rectangular areay
- the Y coordinate of the minimum corner position of the specified rectangular areaz
- the Z coordinate of the minimum corner position of the specified rectangular areat
- the T coordinate of the minimum corner position of the specified rectangular areasizeX
- size for X dimension of the specified rectangular areasizeY
- size for Y dimension of the specified rectangular areasizeZ
- size for Z dimension of the specified rectangular areasizeT
- size for T dimension of the specified rectangular areatrue
if the interior of the ROI
entirely contains the
specified 4D rectangular area; false
otherwise or, if the ROI
contains the 4D
rectangular area and the intersects
method returns true
and the containment
calculations would be too
expensive to perform.public boolean contains(double x, double y, double z, double t, double c)
ROI
public boolean contains(double x, double y, double z, double t, double c, double sizeX, double sizeY, double sizeT, double sizeZ, double sizeC)
ROI
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.contains
in class ROI
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 areasizeT
- the Z size of the specified rectangular areasizeZ
- 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(ROI roi)
ROI
ROI
entirely contains the specified ROI
.
WARNING: this method may be "pixel accurate" only depending the internal implementation.public boolean intersects(Rectangle4D r)
ROI
intersects the interior of a specified Rectangle4D
.
The ROI.intersects()
method allows a ROI
implementation to conservatively return true
when:
Rectangle4D
and the ROI
intersect, but
ROIs
this method might return true
even though the Rectangle4D
does not intersect the ROI
.r
- the specified Rectangle4D
true
if the interior of the ROI
and the interior of the
specified Rectangle4D
intersect, or are both highly likely to intersect
and intersection calculations would be too expensive to perform; false
otherwise.intersects(double, double, double,double, double, double, double, double)
public abstract boolean intersects(double x, double y, double z, double t, double sizeX, double sizeY, double sizeZ, double sizeT)
ROI
intersects the interior of a specified
4D rectangular area. The 4D 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 4D rectangular area
does not intersect the ROI
.x
- the X coordinate of the minimum corner position of the specified rectangular areay
- the Y coordinate of the minimum corner position of the specified rectangular areaz
- the Z coordinate of the minimum corner position of the specified rectangular areat
- the T coordinate of the minimum corner position of the specified rectangular areasizeX
- size for X dimension of the specified rectangular areasizeY
- size for Y dimension of the specified rectangular areasizeZ
- size for Z dimension of the specified rectangular areasizeT
- size for T dimension 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 intersects(double x, double y, double z, double t, double c, double sizeX, double sizeY, double sizeZ, double sizeT, double sizeC)
ROI
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 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
ROI
intersects the specified ROI
.intersects
in class ROI
true
if ROI
intersect, false
otherwise.public abstract Rectangle4D computeBounds4D()
ROI
.getBounds4D()
which should try to cache the result as the
bounding box calculation can take some computation time for complex ROI.public Rectangle5D computeBounds5D()
ROI
ROI
.ROI.getBounds5D()
which should try to cache the result as the
bounding box calculation can take some computation time for complex ROI.computeBounds5D
in class ROI
public Rectangle4D.Integer getBounds()
Rectangle4D
that completely encloses the ROI
. Note
that there is no guarantee that the returned Rectangle4D
is the smallest
bounding box that encloses the ROI
, only that the ROI
lies entirely
within the indicated Rectangle4D
. The returned Rectangle4D
might
also fail to completely enclose the ROI
if the ROI
overflows the
limited range of the integer data type. The getBounds4D
method generally returns
a tighter bounding box due to its greater flexibility in representation.Rectangle4D
that completely encloses the ROI
.public Rectangle4D getBounds4D()
ROI
. Note that there is no guarantee that the
returned Rectangle4D
is the smallest bounding box that encloses the ROI
,
only that the ROI
lies entirely within the indicated Rectangle4D
.Rectangle4D
that is a bounding box of the ROI
.public Point4D.Integer getPosition()
getBounds()
public Point4D getPosition4D()
getBounds4D()
public boolean canSetBounds()
ROI
true
if this ROI accepts bounds change through the ROI.setBounds5D(Rectangle5D)
method.canSetBounds
in class ROI
public void setBounds4D(Rectangle4D bounds)
ROI
4D bounds.canSetBounds()
first to test if
the operation is supported.bounds
- new ROI 4D boundspublic void setBounds5D(Rectangle5D bounds)
ROI
ROI
bounds.ROI.canSetBounds()
first to test if
the operation is supported.setBounds5D
in class ROI
bounds
- new ROI boundspublic boolean canSetPosition()
ROI
true
if this ROI accepts position change through the ROI.setPosition5D(Point5D)
method.canSetPosition
in class ROI
public void setPosition4D(Point4D position)
ROI
4D position.canSetPosition()
first to test
if the operation is supported.position
- new ROI 4D positionpublic void setPosition5D(Point5D position)
ROI
ROI
position.ROI.canSetPosition()
first to test
if the operation is supported.setPosition5D
in class ROI
position
- new ROI positionpublic boolean canTranslate()
true
if the ROI support translate operation.public void translate(double dx, double dy, double dz, double dt)
canTranslate()
first.dx
- translation value to apply on X dimensiondy
- translation value to apply on Y dimensiondz
- translation value to apply on Z dimensiondt
- translation value to apply on T dimensioncanTranslate()
,
setPosition4D(Point4D)
public boolean[] getBooleanMask2D(int x, int y, int width, int height, int z, int t, int c, boolean inclusive)
ROI
  result[((y1 - y) * width) + (x1 - x)] = true
  result[((y1 - y) * width) + (x1 - x)] = false
getBooleanMask2D
in class ROI
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(int x, int y, int width, int height, int z, int t, boolean inclusive)
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 areaz
- Z position we want to retrieve the boolean maskt
- T 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, 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 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)
ROI
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
getBooleanMask2D
in class ROI
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 BooleanMask2D getBooleanMask2D(int z, int t, boolean inclusive)
BooleanMask2D
object representing the roi for the specified Z,T position.z
- Z position we want to retrieve the boolean maskt
- T position we want to retrieve the boolean maskinclusive
- If true then all partially contained (intersected) pixels are included in the mask.public BooleanMask3D getBooleanMask3D(int z, int t, int c, boolean inclusive)
BooleanMask3D
object representing the XYZ volume content at specified Z,
T, C position.z
- Z position we want to retrieve the boolean mask or -1 to retrieve the whole Z
dimensiont
- 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 BooleanMask3D getBooleanMask3D(int t, boolean inclusive)
BooleanMask3D
object representing the roi for specified T position.inclusive
- If true then all partially contained (intersected) pixels are included in the mask.public BooleanMask4D getBooleanMask4D(int z, int t, int c, boolean inclusive)
BooleanMask4D
object representing the XYZT space content at specified Z,
T, C position.z
- Z position we want to retrieve the boolean mask or -1 to retrieve the whole Z
dimensiont
- T position we want to retrieve the boolean mask or -1 to retrieve the whole T
dimensionc
- C position we want to retrieve the boolean mask.inclusive
- If true then all partially contained (intersected) pixels are included in the mask.public BooleanMask4D getBooleanMask(boolean inclusive)
BooleanMask4D
object representing the roi.inclusive
- If true then all partially contained (intersected) pixels are included in the mask.public double computeNumberOfContourPoints()
ROI
computeNumberOfContourPoints
in class ROI
public double computeNumberOfPoints()
ROI
computeNumberOfPoints
in class ROI
public int getC()
-1
is a special value meaning the ROI is set on all C channels (infinite C
dimension).public void setC(int value)
-1
is a special value meaning
the ROI is set on all C channels (infinite C dimension).public boolean isActiveFor(IcyCanvas canvas)
ROI
isActiveFor
in class ROI
public boolean isActiveFor(int c)
public boolean loadFromXML(org.w3c.dom.Node node)
XMLPersistent
loadFromXML
in interface XMLPersistent
loadFromXML
in class ROI
public boolean saveToXML(org.w3c.dom.Node node)
XMLPersistent
saveToXML
in interface XMLPersistent
saveToXML
in class ROI