R
- the type of 2D ROI for each slice of this 3D ROIpublic class ROI3DStack<R extends ROI2D> extends ROI3D implements ROIListener, OverlayListener, java.lang.Iterable<R>
Modifier and Type | Class and Description |
---|---|
class |
ROI3DStack.ROI3DStackPainter |
ROI3D.ROI3DPainter
ROI.ROIGroupId, ROI.ROIIdComparator, ROI.ROINameComparator, ROI.ROIPainter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_USECHILDCOLOR
Deprecated.
this property does not exist anymore
|
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 |
---|
ROI3DStack(java.lang.Class<? extends R> roiClass)
Creates a new 3D ROI based on the given 2D ROI type.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int z,
R roiSlice)
Adds content of specified
ROI slice into the ROI slice at given Z position. |
void |
add(ROI3DStack<R> roi)
Add the specified
ROI3DStack content to this ROI3DStack |
ROI |
add(ROI roi,
boolean allowCreate)
Adds content of specified
ROI into this ROI . |
boolean |
canTranslate()
Returns
true if the ROI support translate operation. |
void |
clear()
Removes all slices.
|
Rectangle3D |
computeBounds3D()
Calculate and returns the 3D 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.
|
double |
computeSurfaceArea(Sequence sequence)
Compute the surface area in um2 given the pixel size informations from the specified Sequence.
|
boolean |
contains(double x,
double y,
double z)
Tests if the specified coordinates are inside the
ROI . |
boolean |
contains(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the
ROI entirely contains the specified 3D rectangular area. |
void |
exclusiveAdd(int z,
R roiSlice)
Sets the content of the
ROI slice at given Z position to be the union of its current content and the
content of the specified ROI , minus their intersection. |
void |
exclusiveAdd(ROI3DStack<R> roi)
Exclusively add the specified
ROI3DStack content to this ROI3DStack |
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. |
BooleanMask2D |
getBooleanMask2D(int z,
boolean inclusive)
Get the
BooleanMask2D object representing the roi for the specified Z position. |
boolean[] |
getBooleanMask2D(int x,
int y,
int width,
int height,
int z,
boolean inclusive)
Get the boolean bitmap mask for the specified rectangular area of the roi and for the
specified Z position.
|
java.lang.String |
getDefaultName() |
int |
getSizeZ() |
R |
getSlice(int z)
Returns the ROI slice at given Z position.
|
R |
getSlice(int z,
boolean createIfNull)
Returns the ROI slice at given Z position.
|
boolean |
getUseChildColor()
Returns
true if the ROI directly uses the 2D slice color draw property and false if it
uses the global 3D ROI color draw property. |
boolean |
hasSelectedPoint()
Returns true if the ROI has a (control) point which is currently focused/selected
|
void |
intersect(int z,
R roiSlice)
Sets the content of the
ROI slice at given Z position to the intersection of
its current content and the content of the specified ROI . |
void |
intersect(ROI3DStack<R> roi)
Process intersection of the specified
ROI3DStack with this ROI3DStack. |
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 . |
boolean |
intersects(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the interior of the
ROI intersects the interior of a specified
3D rectangular area. |
boolean |
isEmpty()
Returns
true if the ROI stack is empty. |
java.util.Iterator<R> |
iterator() |
boolean |
loadFromXML(org.w3c.dom.Node node)
LOAD
|
void |
overlayChanged(OverlayEvent event) |
R |
removeSlice(int z)
Removes slice at the given Z position and returns it.
|
void |
roiChanged(ROIEvent event) |
boolean |
saveToXML(org.w3c.dom.Node node)
SAVE
|
void |
setC(int value)
Sets C position of this 3D ROI.
|
void |
setColor(int z,
java.awt.Color value)
Set the painter color for the specified ROI slice.
|
void |
setCreating(boolean value)
Set the internal creation mode state.
|
void |
setFocused(boolean value) |
void |
setName(java.lang.String value) |
void |
setReadOnly(boolean value)
Set the read only state of ROI.
|
void |
setSelected(boolean value)
Set the selected state of this ROI.
|
void |
setSlice(int z,
R roi2d)
Sets the ROI slice for the given Z position.
|
void |
setT(int value)
Sets T position of this 3D ROI.
|
void |
setUseChildColor(boolean value)
Set to
true if you want to directly use the 2D slice color draw property and false to
keep the global 3D ROI color draw property. |
void |
subtract(int z,
R roiSlice)
Subtract the specified
ROI content from the ROI slice at given Z position. |
void |
subtract(ROI3DStack<R> roi)
Remove the specified
ROI3DStack from this ROI3DStack |
ROI |
subtract(ROI roi,
boolean allowCreate)
Subtract the specified
ROI content from current ROI . |
void |
translate(double dx,
double dy,
double dz)
Translate the ROI position by the specified delta X/Y/Z.
|
void |
translate(int z)
Translate the stack of specified Z position.
|
void |
unselectAllPoints()
Remove focus/selected state on all (control) points.
|
canSetBounds, canSetPosition, computeBounds5D, contains, contains, contains, contains, contains, getBooleanMask, getBooleanMask2D, getBooleanMask2D, getBooleanMask2D, getBooleanMask3D, getBounds, getBounds3D, getC, getDimension, getLength, getPosition, getPosition3D, getROI3DList, getROI3DList, getSurfaceArea, getSurfaceArea, getT, getVolume, intersects, intersects, intersects, isActiveFor, isActiveFor, isOverEdge, isOverEdge, isOverEdge, isOverEdge, setBounds3D, setBounds5D, setPosition3D, setPosition5D
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, getDefaultColor, getDefaultOpacity, getDefaultShowName, getDefaultStroke, getDisplayColor, getExclusiveUnion, getFirstSequence, getFocusedColor, getGroupId, getIcon, getId, getIntersection, 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, internalFocus, internalSelect, internalUnfocus, internalUnselect, intersects, isAttached, isCreating, isDefaultName, isEditable, isFocused, isReadOnly, isSelected, isUpdating, loadFromXML, loadROIsFromXML, merge, mergeWith, nameChanged, onChanged, painterChanged, propertyChanged, remove, remove, removeListener, roiChanged, roiChanged, roiChanged, saveROIsToXML, selectionChanged, setColor, setDefaultColor, setDefaultOpacity, setDefaultShowName, setDefaultStroke, setEditable, setGroupId, setIcon, setMousePos, setOpacity, setProperty, setPropertyValue, setROIsFromXML, setSelected, setSelectedColor, setShowName, setStroke
@Deprecated public static final java.lang.String PROPERTY_USECHILDCOLOR
public ROI3DStack(java.lang.Class<? extends R> roiClass)
public java.lang.String getDefaultName()
getDefaultName
in class ROI3D
public boolean getUseChildColor()
true
if the ROI directly uses the 2D slice color draw property and false
if it
uses the global 3D ROI color draw property.public void setUseChildColor(boolean value)
true
if you want to directly use the 2D slice color draw property and false
to
keep the global 3D ROI color draw property.setColor(int, Color)
public void setColor(int z, java.awt.Color value)
setUseChildColor(boolean)
public void setCreating(boolean value)
ROI
setCreating
in class ROI
public void setReadOnly(boolean value)
ROI
setReadOnly
in class ROI
public void setFocused(boolean value)
setFocused
in class ROI
value
- the focused to setpublic void setSelected(boolean value)
ROI
Sequence.setSelectedROI(ROI)
for exclusive ROI selection.setSelected
in class ROI
value
- the selected to setpublic void setName(java.lang.String value)
public void setT(int value)
ROI3D
-1
is a special value meaning
the ROI is set on all T frames (infinite T dimension).public void setC(int value)
ROI3D
-1
is a special value meaning
the ROI is set on all C channels (infinite C dimension).public boolean isEmpty()
true
if the ROI stack is empty.public int getSizeZ()
getSlice(int)
may still
return null
.public R removeSlice(int z)
public void clear()
public void add(ROI3DStack<R> roi) throws java.lang.UnsupportedOperationException
ROI3DStack
content to this ROI3DStackjava.lang.UnsupportedOperationException
public void exclusiveAdd(ROI3DStack<R> roi) throws java.lang.UnsupportedOperationException
ROI3DStack
content to this ROI3DStackjava.lang.UnsupportedOperationException
public void intersect(ROI3DStack<R> roi) throws java.lang.UnsupportedOperationException
ROI3DStack
with this ROI3DStack.java.lang.UnsupportedOperationException
public void subtract(ROI3DStack<R> roi) throws java.lang.UnsupportedOperationException
ROI3DStack
from this ROI3DStackjava.lang.UnsupportedOperationException
public ROI add(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
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) ################ ################ ################ ############## ############## ################ ############ ############ ################ ########## ########## ################ ######## ######## ################ ###### ###### ###### ###### #### #### #### #### ## ## ## ##
add
in class ROI
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.ROI.getUnion(ROI)
public ROI intersect(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
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) ################ ################ ################ ############## ############## ############ ############ ############ ######## ########## ########## #### ######## ######## ###### ###### #### #### ## ##
intersect
in class ROI
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.ROI.getIntersection(ROI)
public ROI exclusiveAdd(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
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) ################ ################ ############## ############## ## ## ############ ############ #### #### ########## ########## ###### ###### ######## ######## ################ ###### ###### ###### ###### #### #### #### #### ## ## ## ##
exclusiveAdd
in class ROI
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.ROI.getExclusiveUnion(ROI)
public ROI subtract(ROI roi, boolean allowCreate) throws java.lang.UnsupportedOperationException
ROI
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.subtract
in class 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
ROI.getSubtraction(ROI)
public void add(int z, R roiSlice)
ROI
slice into the ROI
slice at given Z position.
The resulting content of this ROI
will include the union of both ROI's contents.setSlice(int, ROI2D)
z
- the position where the slice must be mergedroiSlice
- the 2D ROI to mergejava.lang.UnsupportedOperationException
- if the given ROI slice cannot be added to this ROIpublic void exclusiveAdd(int z, R roiSlice)
ROI
slice at given Z position 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.setSlice(int, ROI2D)
z
- the position where the slice must be mergedroiSlice
- the 2D ROI to mergejava.lang.UnsupportedOperationException
- if the given ROI slice cannot be exclusively added to this ROIpublic void intersect(int z, R roiSlice)
ROI
slice at given Z position 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.z
- the position where the slice must be mergedroiSlice
- the 2D ROI to mergejava.lang.UnsupportedOperationException
- if the given ROI slice cannot be intersected with this ROIpublic void subtract(int z, R roiSlice) throws java.lang.UnsupportedOperationException
ROI
content from the ROI
slice at given Z position.z
- the position where the subtraction should be doneroiSlice
- the 2D ROI to subtract from Z slicejava.lang.UnsupportedOperationException
- if the given ROI slice cannot be subtracted from this ROIpublic Rectangle3D computeBounds3D()
ROI3D
ROI
.ROI3D.getBounds3D()
which should try to cache the result as the
bounding box calculation can take some computation time for complex ROI.computeBounds3D
in class ROI3D
public boolean contains(double x, double y, double z)
ROI3D
ROI
.public boolean contains(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
ROI3D
ROI
entirely contains the specified 3D 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 ROI3D
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 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 areatrue
if the interior of the ROI
entirely contains the
specified 3D rectangular area; false
otherwise or, if the ROI
contains the 3D
rectangular area and the intersects
method returns true
and the containment
calculations would be too
expensive to perform.public boolean intersects(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
ROI3D
ROI
intersects the interior of a specified
3D rectangular area. The 3D 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 3D rectangular area
does not intersect the ROI
.intersects
in class ROI3D
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 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 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 hasSelectedPoint()
ROI
hasSelectedPoint
in class ROI
public void unselectAllPoints()
ROI
unselectAllPoints
in class ROI
public double computeSurfaceArea(Sequence sequence) throws java.lang.UnsupportedOperationException
ROI3D
computeSurfaceArea
in class ROI3D
java.lang.UnsupportedOperationException
public double computeNumberOfContourPoints()
ROI
computeNumberOfContourPoints
in class ROI3D
public double computeNumberOfPoints()
ROI
computeNumberOfPoints
in class ROI3D
public boolean canTranslate()
ROI3D
true
if the ROI support translate operation.canTranslate
in class ROI3D
ROI3D.translate(double, double, double)
public void translate(int z)
public void translate(double dx, double dy, double dz)
ROI3D
ROI3D.canTranslate()
first.translate
in class ROI3D
dx
- translation value to apply on X dimensiondy
- translation value to apply on Y dimensiondz
- translation value to apply on Z dimensionROI3D.canTranslate()
,
ROI3D.setPosition3D(Point3D)
public boolean[] getBooleanMask2D(int x, int y, int width, int height, int z, boolean inclusive)
ROI3D
getBooleanMask2D
in class ROI3D
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 maskinclusive
- If true then all partially contained (intersected) pixels are included in the mask.public BooleanMask2D getBooleanMask2D(int z, boolean inclusive)
ROI3D
BooleanMask2D
object representing the roi for the specified Z position.getBooleanMask2D
in class ROI3D
z
- Z position we want to retrieve the boolean maskinclusive
- If true then all partially contained (intersected) pixels are included in the mask.public void roiChanged(ROIEvent event)
roiChanged
in interface ROIListener
public void overlayChanged(OverlayEvent event)
overlayChanged
in interface OverlayListener
public boolean loadFromXML(org.w3c.dom.Node node)
XMLPersistent
loadFromXML
in interface XMLPersistent
loadFromXML
in class ROI3D
public boolean saveToXML(org.w3c.dom.Node node)
XMLPersistent
saveToXML
in interface XMLPersistent
saveToXML
in class ROI3D