public class RectangularROI extends ROI implements java.lang.Cloneable, StretchableROI, RegularROI
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HEIGHTTOKEN
The token written to ROI output files to represent the height of a rectangular ROI.
|
static java.lang.String |
WIDTHTOKEN
The token written to ROI output files to represent the width of a rectangular ROI.
|
handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
Constructor and Description |
---|
RectangularROI(double x,
double y,
double width,
double height)
Creates a new RectangularROI with the supplied dimensions in mm coordinates.
|
RectangularROI(double x,
double y,
double width,
double height,
ROIState state)
Creates a new RectangularROI with the supplied dimensions in mm.
|
RectangularROI(java.awt.geom.Rectangle2D.Double rect,
ROIState state)
Creates a new RectangularROI with the dimension given by the supplied Rectangle2D in
mm coordinates.
|
Modifier and Type | Method and Description |
---|---|
RectangularROI |
clone()
Returns a clone of this ROI.
|
boolean |
contains(ROI roi)
Indicates whether this RectangularROI contains another ROI entirely
within its borders.
|
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.
|
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.
|
javax.vecmath.Point2d |
getCentroid()
Returns the centroid (centre of area) of this ROI.
|
ROI |
getCopy()
Returns a copy of this ROI.
|
static ROICreateDialog |
getCreateDialog(CanAddROIToFrame listener)
Returns a JDialog that can be used to create Rectangular ROIs.
|
static InteractionType |
getCreateInteractionType()
Returns the type of interaction needed to create a RectangularROI.
|
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.
|
double |
getHeight()
Returns the height of this RectangularROI in mm.
|
static ROI |
getInstance(java.awt.Rectangle boundingRectangle,
int nCols,
int nRows,
float pixelXSize,
float pixelYSize,
byte userColour,
ROIState state)
Creates an instance of a RectangularROI suitable for drawing on a window.
|
static java.lang.String |
getName()
Returns a descriptive name for this type of ROI.
|
double |
getPerimeter()
Returns the perimeter length of this ROI.
|
double |
getPrincipalAxisAngle()
Returns the angle between the major principal axis of this ROI and the x-axis.
|
double |
getSquareArea()
Returns the area of this regular ROI in square mm.
|
double |
getWidth()
Returns the width of this RectangularROI in mm.
|
double |
getX()
Returns the x-coordinate of the top left corner of this RectangularROI in mm.
|
double |
getY()
Returns the y-coordinate of the top left corner of this RectangularROI in mm.
|
int |
hashCode()
Returns a hash code value for this RectangularROI.
|
java.util.List<ROI> |
intersect(ROI roi)
Performs an intersection operation on the shape of this ROI with another ROI.
|
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 |
set(ROI roi)
Sets the shape of this ROI to the shape of the supplied argument ROI.
|
java.lang.String |
toString()
Returns a String describing this ROI.
|
add, add, addMorphological, clearDeletionHistory, dilate, exclusiveOr, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCentroid, getClasses, getColor, getDesignTextFontSize, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getFeret, getGroupUid, getGroupUid, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getStats, getTextColor, getUserColour, group, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setGroupUid, setSlice, setState, setTextColor, setTextSize, setUserColour, subtract, subtract, ungroup, ungroup, write, write
finalize, getClass, notify, notifyAll, wait, wait, wait
getDisplayedBounds2D
public static final java.lang.String WIDTHTOKEN
public static final java.lang.String HEIGHTTOKEN
public RectangularROI(java.awt.geom.Rectangle2D.Double rect, ROIState state) throws ROIException
rect
- the Rectangle2D.Double that gives the size and location of the ROI in mm.state
- the ROIState for the ROI at creation.ROIException
- if the ROI cannot be created.public RectangularROI(double x, double y, double width, double height) throws ROIException
x
- the x-coordinate of the top left corner of the rectangle in mm.y
- the y-coordinate of the top left corner of the rectangle in mm.width
- the width of the rectangle.height
- the height of the rectangle.ROIException
- if the ROI cannot be created.public RectangularROI(double x, double y, double width, double height, ROIState state) throws ROIException
x
- the x-coordinate of the top left corner of the rectangle in mm.y
- the y-coordinate of the top left corner of the rectangle in mm.width
- the width of the rectangle in mm.height
- the height of the rectangle in mm.state
- the ROIState for the ROI at creation.ROIException
- if the ROI cannot be created.public double getX()
public double getY()
public double getWidth()
public double getHeight()
public static InteractionType getCreateInteractionType()
public double getSquareArea()
RegularROI
getSquareArea
in interface RegularROI
public void move(double dx, double dy)
ROI
public void move(double dx, double dy, double stretchX, double stretchY)
StretchableROI
move
in interface StretchableROI
dx
- 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 ROI
flipPoint
- the point about which the ROI will be flipped.public void flipHorizontal(java.awt.geom.Point2D flipPoint)
ROI
flipHorizontal
in class ROI
flipPoint
- the point about which the ROI will be flipped.public static ROI getInstance(java.awt.Rectangle boundingRectangle, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state) throws ROIException
boundingRectangle
- the area of screen into which the ROI must fit.nCols
- the number of image columns.nRows
- the number of image rows.pixelXSize
- the size of image pixels in the horizontal direction.pixelYSize
- the size of image pixels in the vertical direction.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 initial state of this newly-created ROI.ROIException
- if the ROI cannot be created as specified.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 ROI
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 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 ROI
orthoView
- 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
public double getPerimeter()
ROI
getPerimeter
in class ROI
public javax.vecmath.Point2d getCentroid()
ROI
getCentroid
in class ROI
public double getPrincipalAxisAngle()
public static ROICreateDialog getCreateDialog(CanAddROIToFrame listener)
listener
- the CanAddROIToFrame to which the ROI will be added when
the Add button of the Dialog is clicked.public boolean contains(ROI roi)
public java.util.List<ROI> intersect(ROI roi)
ROI
public boolean equals(java.lang.Object o)
ROI
public int hashCode()
public void set(ROI roi) throws java.lang.ClassCastException
ROI
public ROI getCopy()
ROI
public RectangularROI clone()
ROI
public java.lang.String toString()
ROI
public java.lang.String getDescription()
ROI
getDescription
in class ROI
public static java.lang.String getName()
public static javax.swing.Icon getButtonIcon()
Copyright 2017 Xinapse Systems Limited. All Rights Reserved.