Class HollowROI
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.HollowROI
- All Implemented Interfaces:
EditableOutlineROI, RotatableROI
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 ROI
BUTTON_ICON_SCALE, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleandeleteVertex(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 offsetX, int offsetY, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, boolean filled) Draws this ROI on top of an orthogonal view of an image.booleanerasePoints(List<Point2D> erasePoints, float size, int nCols, int nRows, float pixelXSize, float pixelYSize) Erase points from thisHollowROI.voidflipHorizontal(Point2D flipPoint) Flip thisROIhorizontally about a given location.voidflipVertical(Point2D flipPoint) Flip thisROIvertically about a given location.org.jogamp.vecmath.Point2dGets the centre (about which rotation will occur) of thisRotatableROI, in mm coordinates.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.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, org.jogamp.vecmath.Point2d centreOfRotation) Sets the rotation angle for this RotatableROI.voidsetUserColour(byte index) Sets the user-defined colour for this ROI.voidstretch(double dx, double dy, double stretchX, double stretchY) Moves and stretches an ROI.toString()Methods inherited from class ROI
andNot, andNot, andNot, clearDeletionHistory, createXMLElement, dilate, exclusiveOr, exclusiveOr, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCentroid, getClasses, getColor, getDesignTextFontSize, getDisplayedBounds2D, getDisplayedBounds2D, getFeret, getGroupUid, getGroupUid, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getStats, getTextColor, getUserColour, getXMLDeclaration, group, intersect, intersect, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, logicalUnion, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setGroupUid, setSlice, setTextColor, setTextSize, ungroup, ungroup, union, union, write, write, writeCoordinatesMethods inherited from interface RotatableROI
setTheta
-
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
-
move
-
stretch
public void stretch(double dx, double dy, double stretchX, double stretchY) Description copied from class:ROIMoves 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:
stretchin classROI- Parameters:
dx- the distance (in mm) to move the centre of theROIin the horizontal direction.dy- the distance (in mm) to move the centre of theROIin the vertical direction.stretchX- the stretch in the horizontal direction.stretchY- the stretch in the vertical direction.
-
getCentre
public org.jogamp.vecmath.Point2d getCentre()Description copied from interface:RotatableROIGets the centre (about which rotation will occur) of thisRotatableROI, in mm coordinates.- Specified by:
getCentrein interfaceRotatableROI- Returns:
- the point about which rotation will occur.
-
setTheta
public void setTheta(double theta, org.jogamp.vecmath.Point2d centreOfRotation) Description copied from interface:RotatableROISets the rotation angle for this RotatableROI.- Specified by:
setThetain interfaceRotatableROI- Parameters:
theta- the rotation angle, in radians.centreOfRotation- the centre of rotation, in image coordinates.
-
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
-
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.
-
erasePoints
public List<ROI> erasePoints(List<Point2D> erasePoints, float size, int nCols, int nRows, float pixelXSize, float pixelYSize) Erase points from thisHollowROI. erasePoints may edit this HollowROI by deleting points, or it may split it into two or more new ROIs.- Parameters:
erasePoints- a List of points through which the erasing pen has passed.size- the size of the erasing pen in mm.nCols- the number of image columns.nRows- the number of image rows.pixelXSize- the pixel width in mm.pixelYSize- the pixel height in mm.- Returns:
- a (possibly empty)
Listof ROIs resulting from the points erasure.
-
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
-
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 offsetX, int offsetY, 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.offsetX- the offset in the horizontal direction of the orthoView image, relative to the JPanel into which it will be drawn.offsetY- the offset in the vertical direction of the orthoView image, relative to the JPanel into which it will be drawn.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
-
hashCode
public int hashCode()Returns a hash code value for thisIrregularROI.- Overrides:
hashCodein classROI- Returns:
- a hash code value for this
IrregularROI.
-
set
-
getCopy
-
toString
-
getDescription
-
getName
Returns a descriptive name for this type of ROI.- Returns:
- a String describing this type of ROI.
-