Class PointRoi
java.lang.Object
ij.gui.Roi
ij.gui.PolygonRoi
ij.gui.PointRoi
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<Point>
This class represents a collection of points that can be associated
with counters. Use the getPolygon() or getFloatPolygon() methods
to retrieve the coordinates of the points.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intReturned by getPosition if point stack positions are differentstatic PointRoistatic final String[]static final String[]Fields inherited from class PolygonRoi
maxPoints, nPoints, splinePoints, xp, xp2, xpf, xSpline, yp, yp2, ypf, ySplineFields inherited from class Roi
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultColor, defaultFillColor, FERET_ARRAY_POINTOFFSET, FERET_ARRAYSIZE, fillColor, flattenScale, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, ignoreClipRect, imp, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, updateFullWindow, wideLine, xMax, yMax -
Constructor Summary
ConstructorsConstructorDescriptionPointRoi()PointRoi(double ox, double oy) Creates a new PointRoi using the specified offscreen double coordinates.Creates a new PointRoi using the specified coordinates and options.PointRoi(float[] ox, float[] oy) Creates a new PointRoi using the specified float arrays of offscreen coordinates.PointRoi(float[] ox, float[] oy, int points) Creates a new PointRoi using the specified float arrays of offscreen coordinates.Creates a new PointRoi using the specified coordinate arrays and options.PointRoi(int[] ox, int[] oy, int points) Creates a new PointRoi using the specified int arrays of offscreen coordinates.PointRoi(int ox, int oy) Creates a new PointRoi using the specified offscreen int coordinates.Creates a new PointRoi using the specified screen coordinates.PointRoi(FloatPolygon poly) Creates a new PointRoi from a FloatPolygon.Creates a new PointRoi from a Polygon. -
Method Summary
Modifier and TypeMethodDescriptionaddPoint(double x, double y) Adds a point to this PointRoi.voidaddPoint(double x, double y, int position) Adds a point at the specified stack position.voidAdds a point to this PointRoi.booleanvoidaddUserPoint(ImagePlus imp, double ox, double oy) clone()Returns a copy of this PointRoi.containedPoints(Roi roi) Returns the points of this Roi that are contained in the specified area ROI.booleancontains(int x, int y) Returns true if (x,y) is one of the points in this collection.voidcopyAttributes(Roi roi2) Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection.protected voiddeletePoint(int index) voidvoidDraws the points on the image.voidDraws the selection outline on the specified ImageProcessor.protected intgetClosestPoint(double x, double y, FloatPolygon points) Returns the points as a FloatPolygon.Point[]Returns the points as an array of Points.intgetCount(int counter) Returns the count associated with the specified counter index.intReturns the index of the current counter.intgetCounter(int index) Returns the counter assocated with the specified point.static String[]int[]int[]Returns an array containing for each point: The counter number (0-100) in the lower 8 bits, and the slice number (or 0, if the point appears on all slices) in the higher 24 bits.static ColorDeprecatedstatic StringDeprecated.static intReturns the default point size 0-6 (Tiny-XXXL).static intintReturns the index of the last counter.getMask()Always returns null for rectangular Roi'sintReturns the number of counters.intgetPointPosition(int index) Returns the stack slice of the point with the given index, or 0 if no slice defined for this pointintReturns the point type (0=hybrid, 1=cross, 2=dot, 3=circle).intReturns the stack position (image number) of the points in this Roi, if all points have the same position.booleanintgetSize()Returns the current point size 0-6 (Tiny-XXXL).protected voidhandleMouseUp(int sx, int sy) With segmented selections, ignore first mouse up and finalize when user double-clicks, control-clicks or clicks in start box.booleanhasPointPosition(int slice) Returns whether this Roi contains a point associated to the given stack slice.intisHandle(int sx, int sy) Returns a point index if it has been at least one second since the last point was added and the specified screen coordinates are inside or near a point, otherwise returns -1.iterator()Custom iterator for points contained in aPointRoi.booleanvoidpromptBeforeDeleting(Boolean prompt) voidDeletes all counters and stack position associationsvoidsetCounter(int counter) voidsetCounterInfo(int[] info) voidsetCounters(int[] counters) Sets the counter number and slice number for each point from an array, where the lower 8 bits are the counter number and the higher 24 bits contain the slice position of each point.static voidsetDefaultCounter(int counter) static voidsetDefaultCrossColor(Color color) Deprecatedstatic voidsetDefaultMarkerSize(String size) Deprecated.static voidsetDefaultSize(int size) Sets the default point size, where 'size' is 0-6 (Tiny-XXXL).static voidsetDefaultType(int type) voidsetHideLabels(boolean hideLabels) Deprecated.voidsetOptions(String options) voidsetPointType(int type) Sets the point type (0=hybrid, 1=cross, 2=dot, 3=circle).voidsetPosition(int n) Sets the stack position (image number) of all points in this Roi.voidsetShowLabels(boolean showLabels) voidsetSize(int size) Sets the point size, where 'size' is 0-6 (Tiny-XXXL).booleanAlways returns true.subtractPoints(Roi roi) Returns the points of this Roi that are not contained in the specified area ROI.toString()voidUpdates the counts for each category in 'counters'Methods inherited from class PolygonRoi
addOffset, clipRectMargin, containsPoint, deleteHandle, enableSubPixelResolution, exitConstructingMode, fitSpline, fitSpline, fitSplineForStraightening, getAngle, getDebugInfo, getFloatPolygon, getInterpolatedPolygon, getLength, getNCoordinates, getNonSplineCoordinates, getNonSplineFloatPolygon, getPolygon, getUncalibratedLength, getXCoordinates, getYCoordinates, grow, isSplineFit, mouseDownInHandle, mouseMoved, moveHandle, removeSplineFit, resetBoundingRect, setLocation, size, updatePolygon, wipeBackMethods inherited from class Roi
abortModification, abortPaste, addRoiListener, convertLineToArea, convertToPolygon, create, create, drawOverlay, drawPixels, endPaste, equals, getAngle, getAntiAlias, getBoundingRect, getBounds, getColor, getContourCentroid, getConvexHull, getCornerDiameter, getCPosition, getCurrentPasteMode, getDefaultFillColor, getDefaultGroup, getDefaultHandleSize, getDefaultStrokeWidth, getDrawOffset, getFeretsDiameter, getFeretValues, getFillColor, getFloatAngle, getFloatBounds, getFloatConvexHull, getFloatHeight, getFloatPolygon, getFloatWidth, getGroup, getGroupName, getGroupNames, getHandleSize, getHashCode, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getInverse, getListeners, getMagnification, getName, getPasteMode, getPositionAsString, getPreviousRoi, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRotationCenter, getRoundRectArcSize, getScaledStroke, getScaleStrokeWidth, getState, getStatistics, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, handleMouseDown, handleMouseDrag, hasHyperStackPosition, isActiveOverlayRoi, isArea, isCursor, isDrawingTool, isInteger, isLine, isLineOrPoint, isVisible, lineCircleIntersection, magnificationForSubPixel, magnificationForSubPixel, mouseDragged, mouseReleased, notifyListeners, nudge, nudgeCorner, offScreenX, offScreenXD, offScreenY, offScreenYD, removeRoiListener, resetDefaultHandleSize, saveGroupNames, screenX, screenXD, screenY, screenYD, setAntiAlias, setBounds, setColor, setCornerDiameter, setDefaultColor, setDefaultFillColor, setDefaultGroup, setDefaultStrokeWidth, setDrawOffset, setFillColor, setFlattenScale, setGroup, setGroupName, setGroupNames, setHandleSize, setIgnoreClipRect, setImage, setInstanceColor, setIsCursor, setLineWidth, setLocation, setMinStrokeWidth, setName, setNonScalable, setPasteMode, setPosition, setPosition, setPreviousRoi, setProperties, setProperty, setPrototypeOverlay, setRenderingHint, setRotationCenter, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, setStrokeWidth, setUnscalableStrokeWidth, showStatus, startPaste, temporarilyHide, toFloat, toInt, toInt, toIntR, translate, update, updateClipRect, updateWideLine, useLineSubpixelConvention, xorMethods inherited from class Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
sizes
-
types
-
HYBRID
public static final int HYBRID- See Also:
-
CROSS
public static final int CROSS- See Also:
-
CROSSHAIR
public static final int CROSSHAIR- See Also:
-
DOT
public static final int DOT- See Also:
-
CIRCLE
public static final int CIRCLE- See Also:
-
POINTWISE_POSITION
public static final int POINTWISE_POSITIONReturned by getPosition if point stack positions are different- See Also:
-
MAX_COUNTERS
public static final int MAX_COUNTERS- See Also:
-
savedPoints
-
-
Constructor Details
-
PointRoi
public PointRoi() -
PointRoi
public PointRoi(int[] ox, int[] oy, int points) Creates a new PointRoi using the specified int arrays of offscreen coordinates. -
PointRoi
public PointRoi(float[] ox, float[] oy, int points) Creates a new PointRoi using the specified float arrays of offscreen coordinates. -
PointRoi
public PointRoi(float[] ox, float[] oy) Creates a new PointRoi using the specified float arrays of offscreen coordinates. -
PointRoi
Creates a new PointRoi using the specified coordinate arrays and options. -
PointRoi
Creates a new PointRoi from a FloatPolygon. -
PointRoi
Creates a new PointRoi from a Polygon. -
PointRoi
Creates a new PointRoi using the specified coordinates and options. -
PointRoi
public PointRoi(int ox, int oy) Creates a new PointRoi using the specified offscreen int coordinates. -
PointRoi
public PointRoi(double ox, double oy) Creates a new PointRoi using the specified offscreen double coordinates. -
PointRoi
Creates a new PointRoi using the specified screen coordinates.
-
-
Method Details
-
setOptions
-
handleMouseUp
protected void handleMouseUp(int sx, int sy) Description copied from class:PolygonRoiWith segmented selections, ignore first mouse up and finalize when user double-clicks, control-clicks or clicks in start box.- Overrides:
handleMouseUpin classPolygonRoi
-
draw
-
drawPixels
Description copied from class:RoiDraws the selection outline on the specified ImageProcessor.- Overrides:
drawPixelsin classPolygonRoi- See Also:
-
addPoint
Adds a point to this PointRoi. -
addUserPoint
-
addPoint
Adds a point to this PointRoi. -
addPoint
public void addPoint(double x, double y, int position) Adds a point at the specified stack position. -
deletePoint
protected void deletePoint(int index) - Overrides:
deletePointin classPolygonRoi
-
getCounter
public int getCounter()Returns the index of the current counter. -
getCount
public int getCount(int counter) Returns the count associated with the specified counter index.- See Also:
-
getLastCounter
public int getLastCounter()Returns the index of the last counter. -
getNCounters
public int getNCounters()Returns the number of counters. -
getCounter
public int getCounter(int index) Returns the counter assocated with the specified point. -
resetCounters
public void resetCounters()Deletes all counters and stack position associations -
subtractPoints
-
containedPoints
-
getMask
Description copied from class:RoiAlways returns null for rectangular Roi's- Overrides:
getMaskin classPolygonRoi
-
contains
public boolean contains(int x, int y) Returns true if (x,y) is one of the points in this collection.- Overrides:
containsin classPolygonRoi
-
setShowLabels
public void setShowLabels(boolean showLabels) -
getShowLabels
public boolean getShowLabels() -
setDefaultType
public static void setDefaultType(int type) -
getDefaultType
public static int getDefaultType() -
setPointType
public void setPointType(int type) Sets the point type (0=hybrid, 1=cross, 2=dot, 3=circle). -
getPointType
public int getPointType()Returns the point type (0=hybrid, 1=cross, 2=dot, 3=circle). -
setDefaultSize
public static void setDefaultSize(int size) Sets the default point size, where 'size' is 0-6 (Tiny-XXXL). -
getDefaultSize
public static int getDefaultSize()Returns the default point size 0-6 (Tiny-XXXL). -
setSize
public void setSize(int size) Sets the point size, where 'size' is 0-6 (Tiny-XXXL). -
getSize
public int getSize()Returns the current point size 0-6 (Tiny-XXXL). -
subPixelResolution
-
setCounter
public void setCounter(int counter) -
promptBeforeDeleting
public boolean promptBeforeDeleting() -
promptBeforeDeleting
-
setDefaultCounter
public static void setDefaultCounter(int counter) -
getCounters
public int[] getCounters()Returns an array containing for each point: The counter number (0-100) in the lower 8 bits, and the slice number (or 0, if the point appears on all slices) in the higher 24 bits. Used when writing a Roi to file (RoiEncoder) -
setCounters
public void setCounters(int[] counters) Sets the counter number and slice number for each point from an array, where the lower 8 bits are the counter number and the higher 24 bits contain the slice position of each point. Used when reading a roi from file (RoiDecoder). -
updateCounts
public void updateCounts()Updates the counts for each category in 'counters' -
setPosition
public void setPosition(int n) Sets the stack position (image number) of all points in this Roi. The points are only displayed when the stack is at the specified position. Set to zero to have the points displayed on all images in the stack. The stack position, when set, determines the visibility of this Roi (i) if it is part of an overlay (normal overlay or the RoiManager's 'Show All' overlay), or (ii) if it is the currently active Roi and Prefs.showAllPoints ('Show an all slices' in the Point Tool Options dialog) is off. Clears any association of this Roi to a hyperstack position. Stack positions of individual points are overwritten. Note that the behavior differs from that of the other Roi types: For the other Roi types, setPosition does not restrict the visibility to stack slice 'n' if that roi is the currently active Roi; it only affects the visibility if that Roi is part of an overlay.- Overrides:
setPositionin classRoi- See Also:
-
getPosition
public int getPosition()Returns the stack position (image number) of the points in this Roi, if all points have the same position. Returns 0 if none of the points is associated with a particular stack image, and PointRoi.POINTWISE_POSITION = -2 if there are different stack positions for different points.- Overrides:
getPositionin classRoi- See Also:
-
getPointPosition
public int getPointPosition(int index) Returns the stack slice of the point with the given index, or 0 if no slice defined for this point -
hasPointPosition
public boolean hasPointPosition(int slice) Returns whether this Roi contains a point associated to the given stack slice. Returns true for (non-existant) slice 0. Does not care whether points would be shown irrespective of the slice number (as given by the Point Tool options "Show on all slices", Prefs.showAllPoints). -
displayCounts
public void displayCounts() -
getCounterChoices
-
isHandle
public int isHandle(int sx, int sy) Returns a point index if it has been at least one second since the last point was added and the specified screen coordinates are inside or near a point, otherwise returns -1.- Overrides:
isHandlein classPolygonRoi
-
getContainedPoints
Returns the points as an array of Points. Wilhelm Burger: modified to use FloatPolygon for correct point positions.- Overrides:
getContainedPointsin classRoi- See Also:
-
getContainedFloatPoints
Returns the points as a FloatPolygon.- Overrides:
getContainedFloatPointsin classRoi- See Also:
-
iterator
-
getClosestPoint
- Overrides:
getClosestPointin classPolygonRoi
-
clone
-
crop
-
copyAttributes
Description copied from class:RoiCopy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection.- Overrides:
copyAttributesin classRoi
-
setCounterInfo
public void setCounterInfo(int[] info) -
getCounterInfo
public int[] getCounterInfo() -
addToOverlay
public boolean addToOverlay() -
toString
-
setHideLabels
public void setHideLabels(boolean hideLabels) Deprecated. -
setDefaultMarkerSize
Deprecated. -
getDefaultMarkerSize
Deprecated. -
setDefaultCrossColor
Deprecated -
getDefaultCrossColor
Deprecated
-