ij.gui
Class Line
- java.lang.Object
-
- ij.gui.Roi
-
- ij.gui.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classLine.PointIteratorDedicated point iterator for thin lines.
-
Field Summary
Fields Modifier and Type Field and Description intx1doublex1dintx2doublex2dinty1doubley1dinty2doubley2d-
Fields inherited from class ij.gui.Roi
ANGLE, COMPOSITE, CONSTRUCTING, FREELINE, FREEROI, HANDLE_SIZE, LINE, MOVING, MOVING_HANDLE, NORMAL, NOT_PASTING, onePixelWide, OVAL, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, TRACED_ROI
-
-
Constructor Summary
Constructors Constructor and Description 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(int sx, int sy, ImagePlus imp)Starts the process of creating a new user-generated straight line selection.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(int ox1, int oy1, int ox2, int oy2, ImagePlus imp)Deprecated.replaced by Line(int, int, int, int)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancontains(int x, int y)voiddraw(java.awt.Graphics g)Draws this line on the image.voiddrawPixels(ImageProcessor ip)Draws the selection outline on the specified ImageProcessor.doublegetAngle()Overridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle).java.awt.RectanglegetBounds()Return the bounding rectangle of this line.booleangetDrawOffset()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..FloatPolygongetFloatPoints()Returns, as a FloatPolygon, the two points that define this line.FloatPolygongetFloatPolygon()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.doublegetLength()Returns the length of this line.double[]getPixels()Returns the pixel values along this line.java.awt.PolygongetPoints()Returns, as a Polygon, the two points that define this line.java.awt.PolygongetPolygon()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.doublegetRawLength()Returns the length of this line in pixels.FloatPolygongetRotationCenter()static intgetWidth()intisHandle(int sx, int sy)Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.java.util.Iterator<java.awt.Point>iterator()Required by theIterableinterface.voidmouseMoved(java.awt.event.MouseEvent e)voidnudgeCorner(int key)Nudge end point of line by one pixel.voidsetDrawOffset(boolean drawOffset)voidsetLocation(int x, int y)Set the location of the ROI in image coordinates.voidsetStrokeWidth(float width)Sets the width of the line used to draw this ROI.static voidsetWidth(int w)booleansubPixelResolution()Always returns true.-
Methods inherited from class ij.gui.Roi
abortPaste, addRoiListener, clone, copyAttributes, drawOverlay, drawPixels, enableSubPixelResolution, endPaste, equals, getAngle, getBoundingRect, getColor, getContainedFloatPoints, getContainedPoints, getContourCentroid, getConvexHull, getCornerDiameter, getCPosition, getCurrentPasteMode, getDebugInfo, getDefaultFillColor, getFeretsDiameter, getFeretValues, getFillColor, getFloatAngle, getFloatBounds, getFloatHeight, getFloatWidth, getHashCode, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getMask, getName, getPasteMode, getPosition, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRoundRectArcSize, getState, getStatistics, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, hasHyperStackPosition, isActiveOverlayRoi, isArea, isCursor, isDrawingTool, isLine, isVisible, lineCircleIntersection, mouseDragged, mouseReleased, notifyListeners, nudge, removeRoiListener, setColor, setCornerDiameter, setDefaultFillColor, setFillColor, setFlattenScale, setIgnoreClipRect, setImage, setInstanceColor, setIsCursor, setLineWidth, setLocation, setName, setNonScalable, setPasteMode, setPosition, setPosition, setPosition, setProperties, setProperty, setPrototypeOverlay, setRotationCenter, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, startPaste, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, update, updateWideLine
-
-
-
-
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:
mouseMovedin classRoi
-
draw
public void draw(java.awt.Graphics g)
Draws this line on the image.
-
getAngle
public double getAngle()
Description copied from class:RoiOverridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle).
-
getLength
public double getLength()
Returns the length of this line.
-
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:
getPolygonin classRoi- 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:
getFloatPolygonin classRoi- See Also:
getFloatPoints()
-
drawPixels
public void drawPixels(ImageProcessor ip)
Description copied from class:RoiDraws the selection outline on the specified ImageProcessor.- Overrides:
drawPixelsin classRoi- See Also:
ImageProcessor.setColor(java.awt.Color),ImageProcessor.setLineWidth(int)
-
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.
-
getWidth
public static int getWidth()
-
setWidth
public static void setWidth(int w)
-
setStrokeWidth
public void setStrokeWidth(float width)
Description copied from class:RoiSets the width of the line used to draw this ROI. Set the width to 0.0 and the ROI will be drawn using a a 1 pixel stroke width regardless of the magnification.- Overrides:
setStrokeWidthin classRoi- See Also:
Roi.setStrokeColor(Color),ImagePlus.setOverlay(ij.gui.Overlay)
-
getBounds
public java.awt.Rectangle getBounds()
Return the bounding rectangle of this line.
-
nudgeCorner
public void nudgeCorner(int key)
Nudge end point of line by one pixel.- Overrides:
nudgeCornerin classRoi
-
getDrawOffset
public boolean getDrawOffset()
Description copied from class:RoiReturns 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:
getDrawOffsetin classRoi
-
setDrawOffset
public void setDrawOffset(boolean drawOffset)
- Overrides:
setDrawOffsetin classRoi
-
subPixelResolution
public boolean subPixelResolution()
Always returns true.- Overrides:
subPixelResolutionin classRoi
-
setLocation
public void setLocation(int x, int y)Description copied from class:RoiSet the location of the ROI in image coordinates.- Overrides:
setLocationin classRoi
-
getRotationCenter
public FloatPolygon getRotationCenter()
- Overrides:
getRotationCenterin classRoi
-
iterator
public java.util.Iterator<java.awt.Point> iterator()
Description copied from class:RoiRequired by theIterableinterface. Use to iterate over the contained coordinates. Usage example:for (Point p : roi) { // process p }Author: Wilhelm Burger- Specified by:
iteratorin interfacejava.lang.Iterable<java.awt.Point>- Overrides:
iteratorin classRoi- See Also:
Roi.getContainedPoints(),Roi.getContainedFloatPoints()
-
-
DMelt 3.0 © DataMelt by jWork.ORG