Documentation of 'ij.gui.Line' Java class
Line
ij.gui

Class Line

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


    public class Line
    extends Roi
    This class represents a straight line selection.
    See Also:
    Serialized Form
    • Field Detail

      • x1

        public int x1
      • y1

        public int y1
      • x2

        public int x2
      • y2

        public int y2
      • x1d

        public double x1d
      • y1d

        public double y1d
      • x2d

        public double x2d
      • y2d

        public double y2d
    • Constructor Detail

      • Line

        public Line(int ox1,
                    int oy1,
                    int ox2,
                    int oy2)
        Creates a new straight line selection using the specified starting and ending offscreen integer coordinates.
      • Line

        public Line(double ox1,
                    double oy1,
                    double ox2,
                    double oy2)
        Creates a new straight line selection using the specified starting and ending offscreen double coordinates.
      • Line

        public Line(int sx,
                    int sy,
                    ImagePlus imp)
        Starts the process of creating a new user-generated straight line selection. 'sx' and 'sy' are screen coordinates that specify the start of the line. The user will determine the end of the line interactively using rubber banding.
      • Line

        public Line(int ox1,
                    int oy1,
                    int ox2,
                    int oy2,
                    ImagePlus imp)
        Deprecated. replaced by Line(int, int, int, int)
    • Method Detail

      • mouseMoved

        public void mouseMoved(java.awt.event.MouseEvent e)
        Overrides:
        mouseMoved in class Roi
      • draw

        public void draw(java.awt.Graphics g)
        Draws this line on the image.
        Overrides:
        draw in class Roi
      • getAngle

        public double getAngle()
        Description copied from class: Roi
        Overridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle).
        Overrides:
        getAngle in class Roi
      • getLength

        public double getLength()
        Returns the length of this line.
        Overrides:
        getLength in class Roi
      • getRawLength

        public double getRawLength()
        Returns the length of this line in pixels.
      • getPixels

        public double[] getPixels()
        Returns the pixel values along this line.
      • getPoints

        public java.awt.Polygon getPoints()
        Returns, as a Polygon, the two points that define this line.
      • getFloatPoints

        public FloatPolygon getFloatPoints()
        Returns, as a FloatPolygon, the two points that define this line.
      • getPolygon

        public java.awt.Polygon getPolygon()
        If the width of this line is less than or equal to one, returns the starting and ending coordinates as a 2-point Polygon, or, if the width is greater than one, returns an outline of the line as a 4-point Polygon.
        Overrides:
        getPolygon in class Roi
        See Also:
        getFloatPolygon(), getPoints()
      • getFloatPolygon

        public FloatPolygon getFloatPolygon()
        If the width of this line is less than or equal to one, returns the starting and ending coordinates as a 2-point FloatPolygon, or, if the width is greater than one, returns an outline of the line as a 4-point FloatPolygon.
        Overrides:
        getFloatPolygon in class Roi
        See Also:
        getFloatPoints()
      • contains

        public boolean contains(int x,
                                int y)
        Overrides:
        contains in class Roi
      • isHandle

        public int isHandle(int sx,
                            int sy)
        Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.
        Overrides:
        isHandle in class Roi
      • getWidth

        public static int getWidth()
      • setWidth

        public static void setWidth(int w)
      • getBounds

        public java.awt.Rectangle getBounds()
        Return the bounding rectangle of this line.
        Overrides:
        getBounds in class Roi
      • nudgeCorner

        public void nudgeCorner(int key)
        Nudge end point of line by one pixel.
        Overrides:
        nudgeCorner in class Roi
      • getDrawOffset

        public boolean getDrawOffset()
        Description copied from class: Roi
        Returns true if this is a PolygonRoi that supports sub-pixel resolution and polygons are drawn on zoomed images offset down and to the right by 0.5 pixels..
        Overrides:
        getDrawOffset in class Roi
      • setDrawOffset

        public void setDrawOffset(boolean drawOffset)
        Overrides:
        setDrawOffset in class Roi
      • subPixelResolution

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

        public void setLocation(int x,
                                int y)
        Description copied from class: Roi
        Set the location of the ROI in image coordinates.
        Overrides:
        setLocation in class Roi
      • iterator

        public java.util.Iterator<java.awt.Point> iterator()
        Description copied from class: Roi
        Required by the Iterable interface. Use to iterate over the contained coordinates. Usage example:
         for (Point p : roi) {
           // process p
         }
         
        Author: Wilhelm Burger
        Specified by:
        iterator in interface java.lang.Iterable<java.awt.Point>
        Overrides:
        iterator in class Roi
        See Also:
        Roi.getContainedPoints(), Roi.getContainedFloatPoints()

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.