|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.IrregularROI
public class IrregularROI
A Class representing an irregularly-shaped closed region on an image.
| Field Summary | |
|---|---|
protected int |
nPoints
The number of points forming the outline. |
static java.lang.String |
POINTSTOKEN
The token written to ROI output files to indicate that a list of points is to follow. |
protected double[] |
xpts
The x-coodinates of points forming the outline of this Irregular ROI in real-space (mm) cooordinates. |
protected double[] |
ypts
The y-coodinates of points forming the outline of this Irregular ROI in real-space (mm) cooordinates. |
| Fields inherited from class com.xinapse.multisliceimage.roi.ROI |
|---|
handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN |
| Constructor Summary | |
|---|---|
IrregularROI(double[] x,
double[] y,
int n,
ROIState state)
Creates a new IrregularROI with the specified shape in mm coordinates. |
|
IrregularROI(java.util.List<java.awt.geom.Point2D.Double> pointsList,
ROIState state)
Creates a new IrregularROI with the specified shape in mm coordinates. |
|
| Method Summary | |
|---|---|
IrregularROI |
clone()
Returns a clone of this ROI. |
java.awt.geom.Line2D |
closestPoints(IrregularROI roi)
Returns the line that represents the line that joins the two points that are closest together (in space) between this IrregularROI and another IrregularROI. |
boolean |
contains(ROI roi)
Indicates whether this IrregularROI contains another ROI entirely within its borders. |
boolean |
deleteVertex(Handle handle)
Delete a point on the outline of this EditableOutlineROI that is under a handle. |
java.util.List<ROI> |
dilate(double radius,
java.util.concurrent.atomic.AtomicInteger opCounter,
CancellableThread.Flag cancelFlag)
Dilates this ROI by the specified distance. |
boolean |
draw(java.awt.Graphics g,
java.awt.Rectangle visibleRectangle,
int imageDrawCols,
int imageDrawRows,
int xOffset,
int yOffset,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize,
boolean drawAnnotation)
Draws this ROI if it needs to be be drawn on screen. |
void |
drawInOrthoView(java.awt.Image orthoView,
javax.vecmath.Point3f orthoViewPosition,
javax.media.j3d.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 |
equals(java.lang.Object o)
Indicates whether some Object is equal to this ROI. |
java.util.List<ROI> |
erasePoints(java.util.List<java.awt.geom.Point2D> erasePoints,
float size,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize)
Erase points from this ROI. |
void |
flipHorizontal(java.awt.geom.Point2D flipPoint)
Flip this ROI horizontally about a given location. |
void |
flipVertical(java.awt.geom.Point2D flipPoint)
Flip this ROI vertically about a given location. |
static javax.swing.Icon |
getButtonIcon()
Returns an Icon that can be used for a button to create this type of ROI. |
java.awt.geom.Point2D |
getCentre()
Gets the centre (about which rotation will occur) of this RotatableROI in mm. |
ROI |
getCopy()
Returns a copy of this ROI. |
static InteractionType |
getCreateInteractionType()
Returns the type of interaction needed to create an IrregularROI. |
java.lang.String |
getDescription()
Return a description of this type of ROI. |
Feret |
getFeret()
Returns the minimum and maximum Feret's diameter for this ROI, in mm. |
Handle |
getFollowingHandle(Handle handle)
Returns the Handle that is immediately after the specified handle, in the order in which they were placed around the ROI. |
static java.lang.String |
getName()
Returns a descriptive name for this type of ROI. |
int |
getNPoints()
Returns the number of vertices that define the outline. |
double |
getPerimeter()
Returns the perimeter length of this ROI. |
Handle |
getPrecedingHandle(Handle handle)
Returns the 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. |
java.awt.geom.Point2D |
getVertex(int index)
Returns a vertex location for this IrregularROI. |
Handle[] |
getVertexHandles()
Returns an array of VertexHandles. |
java.awt.geom.Point2D[] |
getVertices()
Returns the vertex locations for this IrregularROI. |
int |
hashCode()
Returns a hash code value for this IrregularROI. |
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. |
boolean |
intersects(ROI roi)
Tests whether this ROI intersects another ROI. |
IrregularROI |
join(IrregularROI roi)
Joins this ROI to another IrregularROI with a waisted join - a join at the nearest point. |
void |
makeConvex(CanAddROIToFrame canAddROIToFrame,
float pixelXSize,
float pixelYSize,
float minConcaveRadius)
Make this Irregular ROI convex, or at least less concave. |
void |
move(double dx,
double dy)
Move this ROI 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(java.awt.geom.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. |
boolean |
selfIntersects()
Returns true if this ROI has line segments that cross. |
void |
set(ROI roi)
Sets the shape of this ROI to the shape of the supplied argument ROI. |
void |
setTheta(double theta)
Sets the rotation angle for this RotatableROI. |
void |
setVertex(java.awt.geom.Point2D pos,
int idx)
Sets one vertex position for this ROI. |
void |
setVertices(double[] x,
double[] y)
Sets the vertex positions for this ROI. |
void |
setVertices(double[] x,
double[] y,
int n)
Sets the vertex positions for this ROI. |
void |
setVertices(java.util.List<? extends java.awt.geom.Point2D> vertices)
Sets the vertex positions for this ROI. |
void |
setVertices(java.awt.geom.Point2D[] vertices)
Sets the vertex positions for this ROI. |
java.lang.String |
toString()
Returns a String describing this ROI. |
| Methods inherited from class com.xinapse.multisliceimage.roi.ROI |
|---|
add, add, addMorphological, clearDeletionHistory, clearStats, dilate, exclusiveOr, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCachedStatistics, getClasses, getColor, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getFeret, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getStats, getTextColor, getTextFontSize, getUserColour, intersect, isDeleted, isEditable, isReloaded, isSelected, join, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setSlice, setState, setTextColor, setTextSize, setUserColour, subtract, subtract, 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 Detail |
|---|
public static final java.lang.String POINTSTOKEN
protected double[] xpts
protected double[] ypts
protected int nPoints
| Constructor Detail |
|---|
public IrregularROI(double[] x,
double[] y,
int n,
ROIState state)
throws ROIException
x - an array of x-coordinates for the points forming the outline.y - an array of y-coordinates for the points forming the outline.n - the number points to be taken from the x and y arrays - must be less that or
equal to then length of the smallest array.state - the ROIState of the newly-created ROI.
ROIException - if the ROI cannot be created as specified.
public IrregularROI(java.util.List<java.awt.geom.Point2D.Double> pointsList,
ROIState state)
throws ROIException
pointsList - a List of Point2D.Double, in real-space (mm) coordinates,
forming the outline.state - the ROIState of the newly-created ROI.
ROIException - if the ROI cannot be created as specified.| Method Detail |
|---|
public java.awt.geom.Point2D[] getVertices()
public java.awt.geom.Point2D getVertex(int index)
index - the index of the vertex to return.
public static InteractionType getCreateInteractionType()
public void move(double dx,
double dy)
ROI
move in class ROIdx - the distance to move in the x-direction.dy - the distance to move in the y-direction.
public void move(double dx,
double dy,
double stretchX,
double stretchY)
StretchableROI
move in interface StretchableROIdx - the distance (in mm) to move the centre of the StretchableROI
in the horizontal direction.dy - the distance (in mm) to move the centre of the StretchableROI
in the vertical direction.stretchX - the stretch in the horizontal direction.stretchY - the stretch in the vertical direction.public void flipVertical(java.awt.geom.Point2D flipPoint)
ROI
flipVertical in class ROIflipPoint - the point about which the ROI will be flipped.public void flipHorizontal(java.awt.geom.Point2D flipPoint)
ROI
flipHorizontal in class ROIflipPoint - the point about which the ROI will be flipped.
public void moveVertex(java.awt.geom.Point2D newPos,
Handle handle,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize,
boolean pixelSnap)
EditableOutlineROI
moveVertex in interface EditableOutlineROInewPos - 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.public boolean deleteVertex(Handle handle)
EditableOutlineROI
deleteVertex in interface EditableOutlineROIhandle - the Handle that the user has grabbed, used to identify the vertex to be deleted.
public boolean insertTwoVertices(Handle handle)
EditableOutlineROI
insertTwoVertices in interface EditableOutlineROIhandle - the Handle that the user has grabbed, used to identify the vertex around which
the new vertices are to be placed.
public void setVertex(java.awt.geom.Point2D pos,
int idx)
pos - the coordinates of the new position.idx - an index to the corordinate position.
java.lang.ArrayIndexOutOfBoundsException - if the index is invalid.
public void setVertices(double[] x,
double[] y)
throws ROIException
x - a list of x-coordinates for the new vertex positions.y - a list of y-coordinates for the new vertex positions.
ROIException - if the vertices cannot be set as specified.
public void setVertices(double[] x,
double[] y,
int n)
throws ROIException
x - an array of x-coordinates for the new vertex positions.y - an array of y-coordinates for the new vertex positions.n - the number of points to copy from the arrays, starting at index 0.
ROIException - if the vertices cannot be set as specified.public void setVertices(java.awt.geom.Point2D[] vertices)
vertices - an array of new vertex positions.public void setVertices(java.util.List<? extends java.awt.geom.Point2D> vertices)
vertices - a java.util.List extends Point2D> of new vertex positions.public java.awt.geom.Point2D getCentre()
RotatableROI
getCentre in interface RotatableROIpublic void setTheta(double theta)
RotatableROI
setTheta in interface RotatableROItheta - the rotation angle.public double getTheta()
RotatableROI
getTheta in interface RotatableROIpublic int getNPoints()
public java.util.List<ROI> erasePoints(java.util.List<java.awt.geom.Point2D> erasePoints,
float size,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize)
EditableOutlineROI
erasePoints in interface EditableOutlineROIerasePoints - 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.
public IrregularROI join(IrregularROI roi)
throws ROIException
roi - the roi to which this is to be joined.
ROIException - if the two ROIs cannot be joined.public java.awt.geom.Line2D closestPoints(IrregularROI roi)
roi - the IrregularROI against which this IrregularROI will be tested.
public void makeConvex(CanAddROIToFrame canAddROIToFrame,
float pixelXSize,
float pixelYSize,
float minConcaveRadius)
EditableOutlineROI
makeConvex in interface EditableOutlineROIcanAddROIToFrame - the CanAddROIToFrame to be updated when the
operation is complete.pixelXSize - the width of an image pixel in mm.pixelYSize - the height of an image pixel in mm.minConcaveRadius - the minimum radius of curvature for concave parts of this
ROI.
public java.util.List<ROI> dilate(double radius,
java.util.concurrent.atomic.AtomicInteger opCounter,
CancellableThread.Flag cancelFlag)
throws CancelledException
ROI
radius - the radius of dilation.opCounter - a counter for the number of sub-operations that was performed to execute the
dilation operations.cancelFlag - a flag that, if set externally, cancels the operation.
CancelledException
public boolean draw(java.awt.Graphics g,
java.awt.Rectangle visibleRectangle,
int imageDrawCols,
int imageDrawRows,
int xOffset,
int yOffset,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize,
boolean drawAnnotation)
ROI
draw in class ROIg - 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 this ROI is defined.nRows - the number of rows in the image on which this ROI is defined.pixelXSize - pixel width for the image on which this ROI is defined.pixelYSize - pixel height for the image on which this ROI is defined.drawAnnotation - a flag to indicate whether annotation should be drawn.
public void drawInOrthoView(java.awt.Image orthoView,
javax.vecmath.Point3f orthoViewPosition,
javax.media.j3d.Transform3D imageToViewTx,
int nCols,
int nRows,
int nSlices,
float pixelXSize,
float pixelYSize,
boolean filled)
ROI
drawInOrthoView in class ROIorthoView - the java.awt.Image into which the ROI is to be drawn.orthoViewPosition - the coordinates (col, row, slice position) of the orthogonal view
in the original image.imageToViewTx - the Transform3D 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).public Feret getFeret()
ROI
getFeret in class ROIpublic double getPerimeter()
ROI
getPerimeter in class ROIpublic Handle[] getVertexHandles()
EditableOutlineROI
getVertexHandles in interface EditableOutlineROIpublic Handle getPrecedingHandle(Handle handle)
EditableOutlineROI
getPrecedingHandle in interface EditableOutlineROIhandle - the handle for which to get the preceding handle.
public Handle getFollowingHandle(Handle handle)
EditableOutlineROI
getFollowingHandle in interface EditableOutlineROIhandle - the handle for which to get the following handle.
public boolean selfIntersects()
public boolean contains(ROI roi)
contains in class ROIroi - the ROI to be tested for containment within this ROI.
public boolean intersects(ROI roi)
ROINote that the area of intersection may be zero if one or other of the ROIs (or both) contains no area.
intersects in class ROIroi - the ROI to be tested for intersection.
public boolean equals(java.lang.Object o)
ROI
equals in class ROIo - the Object to be tested for equality to this ROI.
public int hashCode()
hashCode in class ROI
public void set(ROI roi)
throws java.lang.ClassCastException
ROI
set in class ROIjava.lang.ClassCastException - of the sub class of the argument ROI is not the
same as this ROI.public ROI getCopy()
ROI
getCopy in class ROIpublic IrregularROI clone()
ROI
clone in class ROIpublic java.lang.String toString()
ROI
toString in class ROIpublic java.lang.String getDescription()
ROI
getDescription in class ROIpublic static java.lang.String getName()
public static javax.swing.Icon getButtonIcon()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||