Module ij
Package ij.gui

Class PointRoi

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.awt.Point>

    public class PointRoi
    extends PolygonRoi
    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:
    PointProperties.js, Serialized Form
    • Constructor Detail

      • 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

        public PointRoi​(float[] ox,
                        float[] oy,
                        java.lang.String options)
        Creates a new PointRoi using the specified coordinate arrays and options.
      • PointRoi

        public PointRoi​(FloatPolygon poly)
        Creates a new PointRoi from a FloatPolygon.
      • PointRoi

        public PointRoi​(java.awt.Polygon poly)
        Creates a new PointRoi from a Polygon.
      • PointRoi

        public PointRoi​(double ox,
                        double oy,
                        java.lang.String options)
        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

        public PointRoi​(int sx,
                        int sy,
                        ImagePlus imp)
        Creates a new PointRoi using the specified screen coordinates.
    • Method Detail

      • setOptions

        public void setOptions​(java.lang.String options)
      • handleMouseUp

        protected void handleMouseUp​(int sx,
                                     int sy)
        Description copied from class: PolygonRoi
        With segmented selections, ignore first mouse up and finalize when user double-clicks, control-clicks or clicks in start box.
        Overrides:
        handleMouseUp in class PolygonRoi
      • draw

        public void draw​(java.awt.Graphics g)
        Draws the points on the image.
        Overrides:
        draw in class PolygonRoi
      • addPoint

        public void addPoint​(ImagePlus imp,
                             double ox,
                             double oy)
        Adds a point to this PointRoi.
      • addUserPoint

        public void addUserPoint​(ImagePlus imp,
                                 double ox,
                                 double oy)
      • addPoint

        public PointRoi addPoint​(double x,
                                 double y)
        Adds a point to this PointRoi.
      • addPoint

        public void addPoint​(double x,
                             double y,
                             int position)
        Adds a point at the specified stack position.
      • getCounter

        public int getCounter()
        Returns the index of the current counter.
      • 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()
      • subtractPoints

        public PointRoi subtractPoints​(Roi roi)
        Returns the points of this Roi that are not contained in the specified area ROI. Returns null if there are no resulting points or Roi is not an area roi.
      • containedPoints

        public PointRoi containedPoints​(Roi roi)
        Returns the points of this Roi that are contained in the specified area ROI. Returns null if there are no resulting points or Roi is not an area roi.
      • contains

        public boolean contains​(int x,
                                int y)
        Returns true if (x,y) is one of the points in this collection.
        Overrides:
        contains in class PolygonRoi
      • 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

        public boolean subPixelResolution()
        Always returns true.
        Overrides:
        subPixelResolution in class Roi
      • setCounter

        public void setCounter​(int counter)
      • promptBeforeDeleting

        public boolean promptBeforeDeleting()
      • promptBeforeDeleting

        public void promptBeforeDeleting​(java.lang.Boolean prompt)
      • 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 fromfile (RoiDecoder).
      • updateCounts

        public void updateCounts()
        Updates the counts for each category in 'counters'
      • 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
      • displayCounts

        public void displayCounts()
      • getCounterChoices

        public static java.lang.String[] 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:
        isHandle in class PolygonRoi
      • clone

        public java.lang.Object clone()
        Returns a copy of this PointRoi.
        Overrides:
        clone in class PolygonRoi
      • copyAttributes

        public void copyAttributes​(Roi roi2)
        Description copied from class: Roi
        Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection.
        Overrides:
        copyAttributes in class Roi
      • setCounterInfo

        public void setCounterInfo​(int[] info)
      • getCounterInfo

        public int[] getCounterInfo()
      • addToOverlay

        public boolean addToOverlay()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Roi
      • setHideLabels

        public void setHideLabels​(boolean hideLabels)
        Deprecated.
      • setDefaultMarkerSize

        public static void setDefaultMarkerSize​(java.lang.String size)
        Deprecated.
      • getDefaultMarkerSize

        public static java.lang.String getDefaultMarkerSize()
        Deprecated.
      • setDefaultCrossColor

        public static void setDefaultCrossColor​(java.awt.Color color)
        Deprecated
      • getDefaultCrossColor

        public static java.awt.Color getDefaultCrossColor()
        Deprecated