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
FieldsModifier and TypeFieldDescriptionstatic final StringThe token written to ROI output files to indicate that a list of inner points is to follow.static final StringThe 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a clone of thisROI.booleanbooleandeleteVertex(Handle handle) Delete a point on the outline of this EditableOutlineROI that is under a handle.booleandraw(Graphics g, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean drawAnnotation) Draws thisROIif it needs to be be drawn on screen.voiddrawInOrthoView(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.booleanvoidflipHorizontal(Point2D flipPoint) Flip thisROIhorizontally about a given location.voidflipVertical(Point2D flipPoint) Flip thisROIvertically about a given location.Gets the centre (about which rotation will occur) of this RotatableROI in mm.org.jogamp.vecmath.Point2dReturns 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 StringgetName()Returns a descriptive name for this type of ROI.Returns the ROI that encloses all the inner ROIs.doubleReturns 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.doublegetTheta()Returns the current rotation angle for this RotatableROI.Handle[]Returns an array of VertexHandles.inthashCode()Returns a hash code value for thisIrregularROI.booleaninsertTwoVertices(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.voidmove(double dx, double dy) Move thisROIby specified distances (in mm) in the x and y directions.voidmove(double dx, double dy, double stretchX, double stretchY) Moves and stretches an ROI.voidmoveVertex(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.voidvoidSets the state of thisROI.voidsetTheta(double theta) Sets the rotation angle for this RotatableROI.voidsetUserColour(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, writeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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- theROIStateof the newly-createdHollowROI.- Throws:
ROIException- if theHollowROIcannot 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:ROIMove thisROIby 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:StretchableROIMoves 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:
movein interfaceStretchableROI- Parameters:
dx- the distance (in mm) to move the centre of theStretchableROIin the horizontal direction.dy- the distance (in mm) to move the centre of theStretchableROIin the vertical direction.stretchX- the stretch in the horizontal direction.stretchY- the stretch in the vertical direction.
-
getCentre
Description copied from interface:RotatableROIGets the centre (about which rotation will occur) of this RotatableROI in mm.- Specified by:
getCentrein interfaceRotatableROI- Returns:
- the centre of this ROI, about which rotation will occur.
-
setTheta
public void setTheta(double theta) Description copied from interface:RotatableROISets the rotation angle for this RotatableROI.- Specified by:
setThetain interfaceRotatableROI- Parameters:
theta- the rotation angle.
-
getTheta
public double getTheta()Description copied from interface:RotatableROIReturns the current rotation angle for this RotatableROI.- Specified by:
getThetain 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:ROIPerforms an intersection operation on the shape of this ROI with another ROI.- Overrides:
intersectin 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:EditableOutlineROIMove a point on the outline of this EditableOutlineROI to a new position.- Specified by:
moveVertexin 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:EditableOutlineROIDelete a point on the outline of this EditableOutlineROI that is under a handle.- Specified by:
deleteVertexin 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:EditableOutlineROIInsert two points into the outline of this EditableOutlineROI: one just before the one that is under a handle, and one just after.- Specified by:
insertTwoVerticesin 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:EditableOutlineROIReturns an array of VertexHandles.- Specified by:
getVertexHandlesin interfaceEditableOutlineROI- Returns:
- an array of VertexHandles, or null if this ROI is not having its outline edited.
-
getPrecedingVisibleHandle
Description copied from interface:EditableOutlineROIReturns the visible Handle that is immediately before the specified handle, in the order in which they were placed around the ROI.- Specified by:
getPrecedingVisibleHandlein 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:EditableOutlineROIReturns the visible Handle that is immediately after the specified handle, in the order in which they were placed around the ROI.- Specified by:
getFollowingVisibleHandlein 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:ROIReturns the minimum and maximum Feret's diameter for thisROI, in mm. -
getPerimeter
public double getPerimeter()Description copied from class:ROIReturns the perimeter length of thisROI.- Specified by:
getPerimeterin classROI- Returns:
- the perimeter length of this
ROI.
-
getCentroid
public org.jogamp.vecmath.Point2d getCentroid()Description copied from class:ROIReturns the centroid (centre of area) of thisROI.- Specified by:
getCentroidin 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:ROIDraws thisROIif it needs to be be drawn on screen.- Overrides:
drawin 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 thisROIis defined.nRows- the number of rows in the image on which thisROIis defined.pixelXSize- pixel width for the image on which thisROIis defined.pixelYSize- pixel height for the image on which thisROIis defined.drawAnnotation- a flag to indicate whether annotation should be drawn.- Returns:
trueif theROIis visible and been drawn on screen;falseotherwise.
-
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:ROIDraws this ROI on top of an orthogonal view of an image.- Specified by:
drawInOrthoViewin classROI- Parameters:
orthoView- theImageinto which the ROI is to be drawn.orthoViewPosition- the coordinates (col, row, slice position) of the orthogonal view in the original image.imageToViewTx- theTransform3Dthat 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:ROIFlip thisROIvertically about a given location.- Specified by:
flipVerticalin classROI- Parameters:
flipPoint- the point about which the ROI will be flipped.
-
flipHorizontal
Description copied from class:ROIFlip thisROIhorizontally about a given location.- Specified by:
flipHorizontalin classROI- Parameters:
flipPoint- the point about which the ROI will be flipped.
-
setState
Description copied from class:ROISets the state of thisROI.- Overrides:
setStatein classROI- Parameters:
state- theROIStateof thisROIto 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:ROISets the user-defined colour for this ROI.- Overrides:
setUserColourin 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:
hashCodein classROI- Returns:
- a hash code value for this
IrregularROI.
-
set
Description copied from class:ROI- Specified by:
setin classROI- Parameters:
roi- the ROI from which the shape is set.- Throws:
ClassCastException- if the sub-class of the argumentROIis not the same as thisROI.
-
getCopy
Description copied from class:ROIReturns 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:ROIReturn a description of this type ofROI.- Specified by:
getDescriptionin 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.
-