Package com.xinapse.multisliceimage.roi
Class Text
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.Marker
com.xinapse.multisliceimage.roi.Text
- All Implemented Interfaces:
RegularROI
,Cloneable
A Class for putting text on an image.
-
Field Summary
Fields inherited from class com.xinapse.multisliceimage.roi.ROI
BUTTON_ICON_SIZE, handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
-
Constructor Summary
ConstructorDescriptionText
(double x, double y) Creates a new Text roi at the given (x, y) coordinate.Creates a new Text ROI at the given (x, y) coordinate, and sets the state of the ROI.Text
(Point2D.Double pt) Creates a new Text ROI at the given point. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of thisROI
.dilate
(double radius, AtomicInteger opCounter, CancellableThread.Flag cancelFlag) Dilation of a Text ROI has no effect.boolean
draw
(Graphics g, 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
(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.static Icon
Returns an Icon that can be used for a button to create this type of ROI.getColor()
getCopy()
Returns a copy of thisROI
.static ROICreateDialog
getCreateDialog
(CanAddROIToFrame listener) Returns a JDialog that can be used to create Text ROIs.static InteractionType
Returns the type of interaction needed to create a Text ROI.Return a description of this type ofROI
.static ROI
getInstance
(Point2D point, boolean pixelSnap, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state) Create a Text ROI at a point on an image.static String
getName()
Returns a descriptive name for this type of ROI.int
hashCode()
Returns a hash code value for thisMarker
ROI.intersect
(ROI roi, IndeterminateProgressMonitor progressMonitor) Performs an intersection operation on the shape of this ROI with another ROI.boolean
selectDeselect
(Point point, boolean editMode, boolean showDeleted, int nAlreadySelected) Selects or deselects anROI
after a user click at the point.Methods inherited from class com.xinapse.multisliceimage.roi.Marker
andNot, contains, equals, exclusiveOr, flipHorizontal, flipVertical, getBoundingRectangle, getCentroid, getFeret, getPerimeter, getSquareArea, getStats, getX, getY, move, set, set, toString, union
Methods inherited from class com.xinapse.multisliceimage.roi.ROI
andNot, andNot, clearDeletionHistory, dilate, exclusiveOr, getAnnotation, getBoundingRectangle, getCentroid, getClasses, getDesignTextFontSize, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getFeret, getGroupUid, getGroupUid, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getTextColor, getUserColour, group, intersect, intersect, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, logicalUnion, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, setAnnotation, setCreationHistory, setGroupUid, setSlice, setState, setTextColor, setTextSize, setUserColour, ungroup, ungroup, union, write, write
-
Constructor Details
-
Text
Creates a new Text ROI at the given point.- Parameters:
pt
- the location of the Text ROI.
-
Text
public Text(double x, double y) Creates a new Text roi at the given (x, y) coordinate.- Parameters:
x
- the x location of the text.y
- the y location of the text.
-
Text
Creates a new Text ROI at the given (x, y) coordinate, and sets the state of the ROI.- Parameters:
x
- the x location of the text.y
- the y location of the text.state
- the ROIState of the text.
-
-
Method Details
-
getCreateInteractionType
Returns the type of interaction needed to create a Text ROI.- Returns:
- type of interaction needed to create a Text ROI - InteractionType.CLICK_TYPE.
-
getInstance
public static ROI getInstance(Point2D point, boolean pixelSnap, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state) Create a Text ROI at a point on an image.- Parameters:
point
- the point on the image in pixel coordinates.pixelSnap
- true if pixel snap is turned on.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 the text. A value of 0 indicates that the text will be drawn with the default colour for Text ROIs if unselected.state
- the ROIState of this ROI on creation.- Returns:
- a Text ROI.
-
intersect
Description copied from class:ROI
Performs an intersection operation on the shape of this ROI with another 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:Marker
Draws this ROI if it needs to be be drawn on screen. Marker ROIs are a special case, since we can't use the Bounding Rectangle to decide whether a Marker is on screen, since the zero-area bounding rectangle never intersects anything.- Overrides:
draw
in classMarker
- 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 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.- Returns:
- true if the ROI is visible and been drawn on screen; false otherwise.
-
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:ROI
Draws this ROI on top of an orthogonal view of an image.- Overrides:
drawInOrthoView
in classMarker
- Parameters:
orthoView
- theImage
into which the ROI is to be drawn.orthoViewPosition
- the coordinates (col, row, slice position) of the orthogonal view in the original image.imageToViewTx
- theTransform3D
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).
-
selectDeselect
public boolean selectDeselect(Point point, boolean editMode, boolean showDeleted, int nAlreadySelected) Description copied from class:ROI
Selects or deselects anROI
after a user click at the point.- Overrides:
selectDeselect
in classMarker
- Parameters:
point
- thePoint
at which the user has clicked.editMode
-true
if the tool working with ROIs is in edit mode;false
if it is in view mode.showDeleted
-true
if the tool working with ROIs is set to show deleted ROIs;false
if it is not.nAlreadySelected
- the number of ROIs already selected. This determines the exact selection/deselection behaviour.- Returns:
true
if the selection was changed.
-
getColor
-
dilate
Dilation of a Text ROI has no effect. The List of ROIs returned contains just a copy of this Text ROI.- Parameters:
radius
- the radius of dilation.opCounter
- a counter for the number of sub-operations that was performed to execute the dilation operation.cancelFlag
- a flag that, if set externally, cancels the operation.- Returns:
- a
List
containing a clone of this Text ROI.
-
getCreateDialog
Returns a JDialog that can be used to create Text ROIs.- Parameters:
listener
- the CanAddROIToFrame to which the ROI will be added when the Add button of the Dialog is clicked.- Returns:
- a JDialog that can be used to create Text ROIs.
-
hashCode
public int hashCode()Returns a hash code value for thisMarker
ROI. -
getCopy
Description copied from class:ROI
Returns 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. -
getDescription
Description copied from class:ROI
Return a description of this type ofROI
.- Overrides:
getDescription
in classMarker
- 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.
-
getButtonIcon
Returns an Icon that can be used for a button to create this type of ROI.- Returns:
- an Icon that can be used to represent this type of ROI.
-
clone
Description copied from class:ROI
-