Package com.xinapse.multisliceimage.roi
Class HollowROI
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.HollowROI
- All Implemented Interfaces:
EditableOutlineROI
,RotatableROI
,StretchableROI
,Cloneable
public class HollowROI
extends ROI
implements Cloneable, StretchableROI, RotatableROI, EditableOutlineROI
A Class representing an irregularly-shaped region but with one or more holes.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The token written to ROI output files to indicate that a list of inner points is to follow.static final String
The token written to ROI output files to indicate that a list of outer points is to follow.Fields inherited from class com.xinapse.multisliceimage.roi.ROI
BUTTON_ICON_SIZE, handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of thisROI
.boolean
boolean
deleteVertex
(Handle handle) Delete a point on the outline of this EditableOutlineROI that is under a handle.boolean
draw
(Graphics g, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean drawAnnotation) Draws thisROI
if it needs to be be drawn on screen.void
drawInOrthoView
(Image orthoView, org.jogamp.vecmath.Point3f orthoViewPosition, org.jogamp.java3d.Transform3D imageToViewTx, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, boolean filled) Draws this ROI on top of an orthogonal view of an image.boolean
void
flipHorizontal
(Point2D flipPoint) Flip thisROI
horizontally about a given location.void
flipVertical
(Point2D flipPoint) Flip thisROI
vertically about a given location.Gets the centre (about which rotation will occur) of this RotatableROI in mm.org.jogamp.vecmath.Point2d
Returns the centroid (centre of area) of thisROI
.getCopy()
Returns a copy of thisROI
.Return a description of this type ofROI
.getFeret()
Returns the minimum and maximum Feret's diameter for thisROI
, in mm.getFollowingVisibleHandle
(Handle handle) Returns the visible Handle that is immediately after the specified handle, in the order in which they were placed around the ROI.Returns a list of ROIs that form the holes in this HollowROI.static String
getName()
Returns a descriptive name for this type of ROI.Returns the ROI that encloses all the inner ROIs.double
Returns the perimeter length of thisROI
.getPrecedingVisibleHandle
(Handle handle) Returns the visible Handle that is immediately before the specified handle, in the order in which they were placed around the ROI.double
getTheta()
Returns the current rotation angle for this RotatableROI.Handle[]
Returns an array of VertexHandles.int
hashCode()
Returns a hash code value for thisIrregularROI
.boolean
insertTwoVertices
(Handle handle) Insert two points into the outline of this EditableOutlineROI: one just before the one that is under a handle, and one just after.intersect
(ROI roi, IndeterminateProgressMonitor progressMonitor) Performs an intersection operation on the shape of this ROI with another ROI.void
move
(double dx, double dy) Move thisROI
by specified distances (in mm) in the x and y directions.void
move
(double dx, double dy, double stretchX, double stretchY) Moves and stretches an ROI.void
moveVertex
(Point2D newPos, Handle handle, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean pixelSnap) Move a point on the outline of this EditableOutlineROI to a new position.void
void
Sets the state of thisROI
.void
setTheta
(double theta) Sets the rotation angle for this RotatableROI.void
setUserColour
(byte index) Sets the user-defined colour for this ROI.toString()
Methods inherited from class com.xinapse.multisliceimage.roi.ROI
andNot, andNot, andNot, clearDeletionHistory, dilate, exclusiveOr, exclusiveOr, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCentroid, getClasses, getColor, getDesignTextFontSize, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getFeret, getGroupUid, getGroupUid, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getStats, getTextColor, getUserColour, group, intersect, intersect, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, logicalUnion, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setGroupUid, setSlice, setTextColor, setTextSize, ungroup, ungroup, union, union, write, write
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.xinapse.multisliceimage.roi.StretchableROI
getDisplayedBounds2D
-
Field Details
-
OUTERPOINTSTOKEN
The token written to ROI output files to indicate that a list of outer points is to follow.- See Also:
-
INNERPOINTSTOKEN
The token written to ROI output files to indicate that a list of inner points is to follow.- See Also:
-
-
Constructor Details
-
HollowROI
Creates a newHollowROI
, created from a List of ROIs, where one ROI completely contains all the others. The ROIs may be Irregular, Rectangular, Elliptical or SplineROIs.- Parameters:
rois
- the List of ROIs.state
- theROIState
of the newly-createdHollowROI
.- Throws:
ROIException
- if theHollowROI
cannot be created.
-
-
Method Details
-
getOuterROI
Returns the ROI that encloses all the inner ROIs.- Returns:
- the ROI that encloses all the inner ROIs.
-
getInnerROIs
Returns a list of ROIs that form the holes in this HollowROI.- Returns:
- a list of ROIs that form the holes in this HollowROI.
-
move
public void move(double dx, double dy) Description copied from class:ROI
Move thisROI
by specified distances (in mm) in the x and y directions. -
move
public void move(double dx, double dy, double stretchX, double stretchY) Description copied from interface:StretchableROI
Moves and stretches an ROI. A stretch value is a scaling factor for dimensions in either the horizontal or vertical directions. A stretch of 1.0 means no stretch.- Specified by:
move
in interfaceStretchableROI
- Parameters:
dx
- the distance (in mm) to move the centre of theStretchableROI
in the horizontal direction.dy
- the distance (in mm) to move the centre of theStretchableROI
in the vertical direction.stretchX
- the stretch in the horizontal direction.stretchY
- the stretch in the vertical direction.
-
getCentre
Description copied from interface:RotatableROI
Gets the centre (about which rotation will occur) of this RotatableROI in mm.- Specified by:
getCentre
in interfaceRotatableROI
- Returns:
- the centre of this ROI, about which rotation will occur.
-
setTheta
public void setTheta(double theta) Description copied from interface:RotatableROI
Sets the rotation angle for this RotatableROI.- Specified by:
setTheta
in interfaceRotatableROI
- Parameters:
theta
- the rotation angle.
-
getTheta
public double getTheta()Description copied from interface:RotatableROI
Returns the current rotation angle for this RotatableROI.- Specified by:
getTheta
in interfaceRotatableROI
- Returns:
- theta the current rotation angle.
-
contains
Description copied from class:ROI
-
intersect
public List<ROI> intersect(ROI roi, IndeterminateProgressMonitor progressMonitor) throws ROIException, CancelledException Description copied from class:ROI
Performs an intersection operation on the shape of this ROI with another ROI.- Overrides:
intersect
in classROI
- Parameters:
roi
- the ROI with which to perform the intersection operation.progressMonitor
- if non-null, the IndeterminateProgressMonitor that can be used to cancel the operation.- Returns:
- a List<ROI> of ROIs that result from the operation.
- Throws:
ROIException
- if the operation cannot be performed.CancelledException
- if the operation is cancelled by the user.
-
moveVertex
public void moveVertex(Point2D newPos, Handle handle, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean pixelSnap) throws ROIException Description copied from interface:EditableOutlineROI
Move a point on the outline of this EditableOutlineROI to a new position.- Specified by:
moveVertex
in interfaceEditableOutlineROI
- Parameters:
newPos
- the new location of the vertex in real-space coordinates.handle
- the Handle that the user has grabbed, used to identify the vertex to be moved.nCols
- the number of image columns.nRows
- the number of image rows.pixelXSize
- the pixel width in mm.pixelYSize
- the pixel height in mm.pixelSnap
- whether pixel snap is turned on.- Throws:
ROIException
- if the vertex cannot be moved to the requested position.
-
deleteVertex
Description copied from interface:EditableOutlineROI
Delete a point on the outline of this EditableOutlineROI that is under a handle.- Specified by:
deleteVertex
in interfaceEditableOutlineROI
- Parameters:
handle
- the Handle that the user has grabbed, used to identify the vertex to be deleted.- Returns:
- true if a point is successfully deleted.
- Throws:
ROIException
- if the point cannot be deleted from this ROI.
-
insertTwoVertices
Description copied from interface:EditableOutlineROI
Insert two points into the outline of this EditableOutlineROI: one just before the one that is under a handle, and one just after.- Specified by:
insertTwoVertices
in interfaceEditableOutlineROI
- Parameters:
handle
- the Handle that the user has grabbed, used to identify the vertex around which the new vertices are to be placed.- Returns:
- true if a point is successfully inserted.
-
getVertexHandles
Description copied from interface:EditableOutlineROI
Returns an array of VertexHandles.- Specified by:
getVertexHandles
in interfaceEditableOutlineROI
- Returns:
- an array of VertexHandles, or null if this ROI is not having its outline edited.
-
getPrecedingVisibleHandle
Description copied from interface:EditableOutlineROI
Returns the visible Handle that is immediately before the specified handle, in the order in which they were placed around the ROI.- Specified by:
getPrecedingVisibleHandle
in interfaceEditableOutlineROI
- Parameters:
handle
- the handle for which to get the preceding handle.- Returns:
- the preceding visible Handle, or null if there is no preceding visible handle.
-
getFollowingVisibleHandle
Description copied from interface:EditableOutlineROI
Returns the visible Handle that is immediately after the specified handle, in the order in which they were placed around the ROI.- Specified by:
getFollowingVisibleHandle
in interfaceEditableOutlineROI
- Parameters:
handle
- the handle for which to get the following handle.- Returns:
- the following visible Handle, or null if there is no following visible handle.
-
getFeret
Description copied from class:ROI
Returns the minimum and maximum Feret's diameter for thisROI
, in mm. -
getPerimeter
public double getPerimeter()Description copied from class:ROI
Returns the perimeter length of thisROI
.- Specified by:
getPerimeter
in classROI
- Returns:
- the perimeter length of this
ROI
.
-
getCentroid
public org.jogamp.vecmath.Point2d getCentroid()Description copied from class:ROI
Returns the centroid (centre of area) of thisROI
.- Specified by:
getCentroid
in classROI
- Returns:
- the centroid of this
ROI
.
-
draw
public boolean draw(Graphics g, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean drawAnnotation) Description copied from class:ROI
Draws thisROI
if it needs to be be drawn on screen.- Overrides:
draw
in classROI
- Parameters:
g
- the graphics context for the drawing operation.visibleRectangle
- the part of the image that can be seen on-screen.imageDrawCols
- width of the area in which this portion of the image is to be drawn.imageDrawRows
- height of the area in which this portion of the image is to be drawn.xOffset
- a horizontal offset for drawing operations.yOffset
- a vertical offset for drawing operations.nCols
- the number of columns in the image on which thisROI
is defined.nRows
- the number of rows in the image on which thisROI
is defined.pixelXSize
- pixel width for the image on which thisROI
is defined.pixelYSize
- pixel height for the image on which thisROI
is defined.drawAnnotation
- a flag to indicate whether annotation should be drawn.- Returns:
true
if theROI
is visible and been drawn on screen;false
otherwise.
-
drawInOrthoView
public void drawInOrthoView(Image orthoView, org.jogamp.vecmath.Point3f orthoViewPosition, org.jogamp.java3d.Transform3D imageToViewTx, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, boolean filled) Description copied from class:ROI
Draws this ROI on top of an orthogonal view of an image.- Specified by:
drawInOrthoView
in classROI
- Parameters:
orthoView
- theImage
into which the ROI is to be drawn.orthoViewPosition
- the coordinates (col, row, slice position) of the orthogonal view in the original image.imageToViewTx
- theTransform3D
that maps original image pixel coordinates to pixel coordinates in the orthogonal view.nCols
- the number of columns in the original image.nRows
- the number of rows in the original image.nSlices
- the number of slices in the original image.pixelXSize
- the pixel width in the original image.pixelYSize
- the pixel height in the original image.filled
- whether the ROI should be drawn filled (effective only for ROIs that enclose an area).
-
flipVertical
Description copied from class:ROI
Flip thisROI
vertically about a given location.- Specified by:
flipVertical
in classROI
- Parameters:
flipPoint
- the point about which the ROI will be flipped.
-
flipHorizontal
Description copied from class:ROI
Flip thisROI
horizontally about a given location.- Specified by:
flipHorizontal
in classROI
- Parameters:
flipPoint
- the point about which the ROI will be flipped.
-
setState
Description copied from class:ROI
Sets the state of thisROI
.- Overrides:
setState
in classROI
- Parameters:
state
- theROIState
of thisROI
to be set. One of:ROIState.DELETED
,ROIState.DELETED_SELECTED
,ROIState.NORMAL
,ROIState.SELECTED
,ROIState.EDITABLE
,ROIState.EDIT_OUTLINE
.
-
setUserColour
public void setUserColour(byte index) Description copied from class:ROI
Sets the user-defined colour for this ROI.- Overrides:
setUserColour
in classROI
- Parameters:
index
- a value which is an index to the user-defined colour. A value of 0 indicates the a user-defined colour is to be unset; values greater than zero are the index into the user-defined colour palette of user-settable ROI colours.
-
equals
Description copied from class:ROI
-
hashCode
public int hashCode()Returns a hash code value for thisIrregularROI
.- Overrides:
hashCode
in classROI
- Returns:
- a hash code value for this
IrregularROI
.
-
set
Description copied from class:ROI
- Specified by:
set
in classROI
- Parameters:
roi
- the ROI from which the shape is set.- Throws:
ClassCastException
- if the sub-class of the argumentROI
is not the same as thisROI
.
-
getCopy
Description copied from class:ROI
Returns a copy of thisROI
. The copy will be identical in shape and annotation as the original ROI, but with a history of that of a newly-created ROI. -
clone
Description copied from class:ROI
-
toString
Description copied from class:ROI
-
getDescription
Description copied from class:ROI
Return a description of this type ofROI
.- Specified by:
getDescription
in classROI
- Returns:
- a String describing the type of this
ROI
.
-
getName
Returns a descriptive name for this type of ROI.- Returns:
- a String describing this type of ROI.
-