public class CurvedLineROI extends IrregularROI implements LinearROI, RegularROI
nPoints, POINTSTOKEN, xpts, ypts
handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
Constructor and Description |
---|
CurvedLineROI(double[] x,
double[] y,
int n,
ROIState state)
Creates a new CurvedLineROI with the coordinates of the points forming the line
given by the x and y arrays in mm coordinates.
|
CurvedLineROI(java.util.List<java.awt.geom.Point2D.Double> pointsList,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize,
byte userColour,
ROIState state)
Creates a new CurvedLineROI with the coordinates of the points forming the line
given by the List of points in image pixel coordinates.
|
CurvedLineROI(java.util.List<java.awt.geom.Point2D.Double> pointsList,
ROIState state)
Creates a new CurvedLineROI with the coordinates of the points forming the line
given by the List of points in mm coordinates.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<ROI> |
add(ROI roi)
Morphologically adds an ROI to this ROI to create a new java.util.List<ROI>
of ROIs that is the result of adding the shapes of the two ROIs.
|
CurvedLineROI |
clone()
Returns a clone of this ROI.
|
boolean |
contains(ROI roi)
Indicates whether this CurvedLineROI 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.
|
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.
|
java.util.List<IrregularROI> |
erasePoints(java.util.List<java.awt.geom.Point2D> erasePoints,
float size,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize)
Erase points from this CurvedLineROI.
|
java.util.List<ROI> |
exclusiveOr(ROI roi)
Performs an exclusive OR operation on the shape of this ROI with another ROI.
|
static javax.swing.Icon |
getButtonIcon()
Returns an Icon that can be used for a button to create this type of ROI.
|
javax.vecmath.Point2d |
getCentroid()
Returns the centroid (centre of area) of this ROI.
|
ROI |
getCopy()
Returns a copy of this ROI.
|
static InteractionType |
getCreateInteractionType()
Returns the type of interaction needed to create a CurvedLineROI.
|
java.lang.String |
getDescription()
Return a description of this type of ROI.
|
Handle |
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.
|
java.awt.geom.Point2D[] |
getIntensityProfile(java.lang.Object pix,
PixelDataType dataType,
int nCols,
int nRows,
int offset,
float pixelXSize,
float pixelYSize,
ComplexMode complexMode)
Returns an array of Point2D representing the pixel intensities along this
LinearROI.
|
double |
getLength()
Returns the length of this ROI in mm.
|
double |
getLengthPix(float pixelXSize,
float pixelYSize)
Returns the length of this ROI in image pixels.
|
static java.lang.String |
getName()
Returns a descriptive name for this type of ROI.
|
double |
getPerimeter()
Returns the perimeter length of this ROI.
|
Handle |
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 |
getSquareArea()
Returns zero - a curved line has no area.
|
ROIStats |
getStats(java.lang.Object pix,
PixelDataType dataType,
int nCols,
int nRows,
int offset,
float pixelXSize,
float pixelYSize,
MaskAction maskAction,
MaskMode maskMode,
double maskValue,
java.io.PrintStream intensityOutputStream,
boolean isUnitsMM,
ComplexMode complexMode)
Returns statistics about this ROI, and (optionally) performs a masking operation.
|
int |
hashCode()
Returns a hash code value for this CurvedLine ROI.
|
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.
|
java.util.List<ROI> |
intersect(ROI roi)
Performs an intersection operation on the shape of this ROI with another ROI.
|
void |
makeConvex(CanAddROIToFrame canAddROIToFrame,
float pixelXSize,
float pixelYSize,
float minConcaveRadius)
Make this IrregularROI 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 |
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.
|
java.util.List<ROI> |
subtract(ROI roi)
Morphologically subtracts an ROI from this ROI to create a new
java.util.List<ROI>
of ROIs that is the result of subtracting the shapes of the two ROIs.
|
closestPoints, containsVertex, drawInOrthoView, equals, flipHorizontal, flipVertical, getCentre, getFeret, getNormal, getNPoints, getPrincipalAxisAngle, getTheta, getVertex, getVertexHandles, getVertices, join, main, makeConvex, move, orderPoints, removeSelfIntersections, selfIntersects, set, setTheta, setVertex, setVertices, setVertices, setVertices, setVertices, simplify, toSpline, toSpline, toString
add, addMorphological, clearDeletionHistory, dilate, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCentroid, getClasses, getColor, getDesignTextFontSize, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getFeret, getGroupUid, getGroupUid, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getTextColor, getUserColour, group, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setGroupUid, setSlice, setState, setTextColor, setTextSize, setUserColour, subtract, ungroup, ungroup, write, write
finalize, getClass, notify, notifyAll, wait, wait, wait
getDisplayedBounds2D
public CurvedLineROI(double[] x, double[] y, int n, ROIState state) throws ROIException
x
- an array of x-coordinates for the points forming the line.y
- an array of y-coordinates for the points forming the line.n
- the number points to be taken from the x and y arrays - must be less than 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 requested.public CurvedLineROI(java.util.List<java.awt.geom.Point2D.Double> pointsList, ROIState state) throws ROIException
pointsList
- a List of points forming the line.state
- the ROIState of the newly-created ROI.ROIException
- if the ROI cannot be created as requested.public CurvedLineROI(java.util.List<java.awt.geom.Point2D.Double> pointsList, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state) throws ROIException
pointsList
- a List of points forming the line.nCols
- the number of columns in the image.nRows
- the number of rows in the image.pixelXSize
- the width of an image pixel in mm.pixelYSize
- the height of an image pixel in mm.userColour
- the colour of this ROI. A value of 0 indicates that the ROI will be
drawn with the default colour for normal ROIs if unselected.state
- the ROIState of the newly-created ROI.ROIException
- if the ROI cannot be created as requested.public static InteractionType getCreateInteractionType()
public void move(double dx, double dy)
ROI
move
in class IrregularROI
dx
- the distance to move in the x-direction.dy
- the distance to move in the y-direction.public Handle getPrecedingVisibleHandle(Handle handle)
EditableOutlineROI
getPrecedingVisibleHandle
in interface EditableOutlineROI
getPrecedingVisibleHandle
in class IrregularROI
handle
- the handle for which to get the preceding handle.public Handle getFollowingVisibleHandle(Handle handle)
EditableOutlineROI
getFollowingVisibleHandle
in interface EditableOutlineROI
getFollowingVisibleHandle
in class IrregularROI
handle
- the handle for which to get the following handle.public void moveVertex(java.awt.geom.Point2D newPos, Handle handle, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean pixelSnap) throws ROIException
EditableOutlineROI
moveVertex
in interface EditableOutlineROI
moveVertex
in class IrregularROI
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.ROIException
- if the vertex cannot be moved to the requested position.public double getSquareArea()
getSquareArea
in interface RegularROI
public boolean deleteVertex(Handle handle)
EditableOutlineROI
deleteVertex
in interface EditableOutlineROI
deleteVertex
in class IrregularROI
handle
- the Handle that the user has grabbed, used to identify the vertex to be deleted.public boolean insertTwoVertices(Handle handle)
EditableOutlineROI
insertTwoVertices
in interface EditableOutlineROI
insertTwoVertices
in class IrregularROI
handle
- the Handle that the user has grabbed, used to identify the vertex around which
the new vertices are to be placed.public java.util.List<IrregularROI> erasePoints(java.util.List<java.awt.geom.Point2D> erasePoints, float size, int nCols, int nRows, float pixelXSize, float pixelYSize)
erasePoints
in class IrregularROI
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.public void makeConvex(CanAddROIToFrame canAddROIToFrame, float pixelXSize, float pixelYSize, float minConcaveRadius)
IrregularROI
makeConvex
in class IrregularROI
canAddROIToFrame
- 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 double getLength()
LinearROI
public double getLengthPix(float pixelXSize, float pixelYSize)
LinearROI
getLengthPix
in interface LinearROI
pixelXSize
- the size of image pixels in the horizontal direction.pixelYSize
- the size of image pixels in the vertical direction.public java.awt.geom.Point2D[] getIntensityProfile(java.lang.Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode)
LinearROI
getIntensityProfile
in interface LinearROI
pix
- the array of pixel intensities for in which this LinearROI is positioned.dataType
- the PixelDataType of the array of pixel intensities.nCols
- the number of columns in the slice.nRows
- the number of rows in the slice.offset
- an offset (in pixels) into the pixel value array for the starting
pixel of the slice on which this ROI is defined.pixelXSize
- the size of image pixels in the horizontal direction.pixelYSize
- the size of image pixels in the vertical direction.complexMode
- the calculation mode for Complex images. The intensity profile
returned will correspond to the mode: the real part, imaginary part, magnitude or phase.public double getPerimeter()
getPerimeter
in class IrregularROI
public javax.vecmath.Point2d getCentroid()
ROI
getCentroid
in class IrregularROI
public java.util.List<ROI> add(ROI roi)
ROI
public java.util.List<ROI> subtract(ROI roi)
ROI
public java.util.List<ROI> intersect(ROI roi)
ROI
intersect
in class IrregularROI
roi
- the ROI with which to perform the intersection operation.public java.util.List<ROI> exclusiveOr(ROI roi)
ROI
exclusiveOr
in class ROI
roi
- the ROI with which to perform the XOR operation.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 IrregularROI
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 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 ROIStats getStats(java.lang.Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, MaskAction maskAction, MaskMode maskMode, double maskValue, java.io.PrintStream intensityOutputStream, boolean isUnitsMM, ComplexMode complexMode)
ROI
getStats
in class ROI
pix
- the whole image pixel value array. If pix is null, then the intensity-related
stats will all be set to zero.dataType
- the type of pixels.nCols
- the number of columns in the slice.nRows
- the number of rows in the slice.offset
- an offset (in pixels) into the pixel value array for the starting
pixel of the slice on which this ROI is defined.pixelXSize
- the size of image pixels in the horizontal direction.pixelYSize
- the size of image pixels in the vertical direction.maskAction
- one of:
maskMode
- how much of a pixel must be inside ROIs for the pixel to be part of the mask.maskValue
- the pixel value to set outside/inside the shape when performing masking ops.intensityOutputStream
- if non-null, pixel intensities within the
ROI will be printed to this PrintStream.isUnitsMM
- true if the (x,y) coordinates of the pixel intensities
are to be written in mm, false if the coordinates are to be writtn in pixel units.complexMode
- the calculation mode for PixelDataType.Complex images.
The statistics returned will correspond to the mode: the real part, imaginary part,
magnitude or phase.public boolean contains(ROI roi)
contains
in class IrregularROI
roi
- the ROI to be tested for containment within this ROI.public int hashCode()
hashCode
in class IrregularROI
public ROI getCopy()
ROI
getCopy
in class IrregularROI
public CurvedLineROI clone()
ROI
clone
in class IrregularROI
public java.lang.String getDescription()
ROI
getDescription
in class IrregularROI
public static java.lang.String getName()
public static javax.swing.Icon getButtonIcon()
Copyright 2017 Xinapse Systems Limited. All Rights Reserved.