Package com.xinapse.multisliceimage.roi
Class Marker
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.Marker
- All Implemented Interfaces:
RegularROI,Cloneable
- Direct Known Subclasses:
Text
A Class representing a point 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
ConstructorsConstructorDescriptionMarker(double x, double y) Creates a new Marker at the given (x, y) coordinate.Creates a new Marker at the given (x, y) coordinate, and sets the state of the ROI.Marker(Point2D.Double pt) Creates a new Marker at the given point. -
Method Summary
Modifier and TypeMethodDescriptionandNot(ROI roi, IndeterminateProgressMonitor progressMonitor) Logically AND NOTs (subtracts) an ROI from this ROI to create a newjava.util.List<ROI>of ROIs that is the result of subtracting the shape of the supplied ROI from this ROI.clone()Returns a clone of thisROI.booleanbooleandraw(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.voiddrawInOrthoView(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.booleanexclusiveOr(ROI roi, IndeterminateProgressMonitor progressMonitor) Performs an exclusive OR operation on the shape of this ROI with another ROI.voidflipHorizontal(Point2D flipPoint) Flip thisROIhorizontally about a given location.voidflipVertical(Point2D flipPoint) Flip thisROIvertically about a given location.getBoundingRectangle(int nCols, int nRows, float pixelXSize, float pixelYSize) Returns a high-precision rectangle (in image pixel coordinates) that just bounds thisROI.static IconReturns an Icon that can be used for a button to create this type of ROI.org.jogamp.vecmath.Point2dReturns the centroid (centre of area) of thisROI.getCopy()Returns a copy of thisROI.static ROICreateDialoggetCreateDialog(CanAddROIToFrame listener) Returns a JDialog that can be used to create Marker ROIs.static InteractionTypeReturns the type of interaction needed to create a Marker.Return a description of this type ofROI.getFeret()Returns the minimum and maximum Feret's diameter for thisROI, in mm.static ROIgetInstance(Point2D point, boolean pixelSnap, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state) Create a Marker at a point on an image.static StringgetName()Returns a descriptive name for this type of ROI.doubleReturns the perimeter length of thisROI.doubleReturns the area of this regular ROI in square mm.getStats(Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, MaskAction maskAction, MaskMode maskMode, double maskValue, PrintStream intensityOutputStream, boolean isUnitsMM, ComplexMode complexMode) Returns statistics about thisROI, and (optionally) performs a masking operation.doublegetX()Returns the x-coordinate of this Marker.doublegetY()Returns the y-coordinate of this Marker.inthashCode()Returns a hash code value for thisMarkerROI.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.booleanselectDeselect(Point point, boolean editMode, boolean showDeleted, int nAlreadySelected) Selects or deselects anROIafter a user click at the point.voidset(double x, double y) Sets the location of thisMarkerto the given location.voidtoString()union(ROI roi, IndeterminateProgressMonitor progressMonitor) Logically add (forms the union) an ROI to this ROI to create a newjava.util.List<ROI>of ROIs that is the result of adding the shapes of the two ROIs.Methods inherited from class com.xinapse.multisliceimage.roi.ROI
andNot, andNot, clearDeletionHistory, dilate, exclusiveOr, getAnnotation, getBoundingRectangle, getCentroid, getClasses, getColor, 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
-
Marker
Creates a new Marker at the given point.- Parameters:
pt- the location of the marker.
-
Marker
public Marker(double x, double y) Creates a new Marker at the given (x, y) coordinate.- Parameters:
x- the x location of the marker.y- the y location of the marker.
-
Marker
Creates a new Marker at the given (x, y) coordinate, and sets the state of the ROI.- Parameters:
x- the x location of the marker.y- the y location of the marker.state- the ROIState of the Marker.
-
-
Method Details
-
getX
public double getX()Returns the x-coordinate of this Marker.- Returns:
- the x-coordinate of this Marker.
-
getY
public double getY()Returns the y-coordinate of this Marker.- Returns:
- the y-coordinate of this Marker.
-
getSquareArea
public double getSquareArea()Description copied from interface:RegularROIReturns the area of this regular ROI in square mm.- Specified by:
getSquareAreain interfaceRegularROI- Returns:
- the area of this Marker, which is always zero.
-
getCreateInteractionType
Returns the type of interaction needed to create a Marker.- Returns:
- type of interaction needed to create a Marker - InteractionType.CLICK.
-
move
public void move(double dx, double dy) Description copied from class:ROIMove thisROIby specified distances (in mm) in the x and y directions. -
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.
-
getInstance
public static ROI getInstance(Point2D point, boolean pixelSnap, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state) Create a Marker 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 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 this ROI on creation.- Returns:
- a new Marker ROI.
-
union
Description copied from class:ROILogically add (forms the union) an ROI to this ROI to create a newjava.util.List<ROI>of ROIs that is the result of adding the shapes of the two ROIs. -
andNot
Description copied from class:ROILogically AND NOTs (subtracts) an ROI from this ROI to create a newjava.util.List<ROI>of ROIs that is the result of subtracting the shape of the supplied ROI from this ROI. -
intersect
Description copied from class:ROIPerforms an intersection operation on the shape of this ROI with another ROI. -
exclusiveOr
Description copied from class:ROIPerforms an exclusive OR operation on the shape of this ROI with another ROI.- Overrides:
exclusiveOrin classROI- Parameters:
roi- the ROI with which to perform the XOR 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.
-
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) 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:
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 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: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.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).
-
getBoundingRectangle
Description copied from class:ROIReturns a high-precision rectangle (in image pixel coordinates) that just bounds thisROI.- Overrides:
getBoundingRectanglein classROI- Parameters:
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.- Returns:
- a
Rectangle2Dthat just bounds thisROI.
-
getStats
public ROIStats getStats(Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, MaskAction maskAction, MaskMode maskMode, double maskValue, PrintStream intensityOutputStream, boolean isUnitsMM, ComplexMode complexMode) Description copied from class:ROIReturns statistics about thisROI, and (optionally) performs a masking operation.- Overrides:
getStatsin classROI- Parameters:
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 thisROIis defined.pixelXSize- the size of image pixels in the horizontal direction.pixelYSize- the size of image pixels in the vertical direction.maskAction- one of:MaskAction.NONEfor no masking;MaskAction.MASK_INSIDEto set pixel values to maskValue inside the shape; orMaskAction.MASK_OUTSIDEto set the pixel values to maskValue outside the shape.MaskAction.MASK_INSIDE_SOFTto perform soft masking inside the shape;MaskAction.MASK_OUTSIDE_SOFTto perform soft masking outside the shape.
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 thisPrintStream.isUnitsMM-trueif the (x,y) coordinates of the pixel intensities are to be written in mm,falseif the coordinates are to be writtn in pixel units.complexMode- the calculation mode forPixelDataType.COMPLEXimages. The statistics returned will correspond to the mode: the real part, imaginary part, magnitude or phase.- Returns:
- statistics about the ROI.
-
getFeret
Description copied from class:ROIReturns the minimum and maximum Feret's diameter for thisROI, in mm. -
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.
-
selectDeselect
public boolean selectDeselect(Point point, boolean editMode, boolean showDeleted, int nAlreadySelected) Description copied from class:ROISelects or deselects anROIafter a user click at the point.- Overrides:
selectDeselectin classROI- Parameters:
point- thePointat which the user has clicked.editMode-trueif the tool working with ROIs is in edit mode;falseif it is in view mode.showDeleted-trueif the tool working with ROIs is set to show deleted ROIs;falseif it is not.nAlreadySelected- the number of ROIs already selected. This determines the exact selection/deselection behaviour.- Returns:
trueif the selection was changed.
-
getCreateDialog
Returns a JDialog that can be used to create Marker 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 Marker ROIs.
-
contains
-
equals
Description copied from class:ROI -
hashCode
public int hashCode()Returns a hash code value for thisMarkerROI. -
set
public void set(double x, double y) Sets the location of thisMarkerto the given location.- Parameters:
x- the x-location.y- the y-location.
-
set
Description copied from class:ROI- Specified by:
setin classROI- Parameters:
roi- the ROI from which the shape is set.- Throws:
ClassCastException- if the sub-class of the argumentROIis not the same as thisROI.
-
getCopy
Description copied from class:ROIReturns 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. -
toString
Description copied from class:ROI -
getDescription
Description copied from class:ROIReturn a description of this type ofROI.- Specified by:
getDescriptionin classROI- 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
-