Package ij.gui
Class Line
java.lang.Object
ij.gui.Roi
ij.gui.Line
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
Arrow
This class represents a straight line selection.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
protected double
int
double
protected double
int
double
protected double
int
double
protected double
int
double
protected double
Fields inherited from class ij.gui.Roi
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, fillColor, 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, type, updateFullWindow, wideLine, xMax, yMax
-
Constructor Summary
ConstructorsConstructorDescriptionLine
(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 ox1, int oy1, int ox2, int oy2) Creates a new straight line selection using the specified starting and ending offscreen integer coordinates.Deprecated.replaced by Line(int, int, int, int)Starts the process of creating a new user-generated straight line selection. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
boolean
contains
(int x, int y) void
Draws this line on the image.protected void
drawLine
(int sx, int sy) void
Draws the selection outline on the specified ImageProcessor.double
getAngle()
Overridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle).Return the bounding rectangle of this line.boolean
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..Returns, as a FloatPolygon, the two points that define this line.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.double
Returns the length of this line.double[]
Returns the pixel values along this line.Returns, as a Polygon, the two points that define this line.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.double
Returns the length of this line in pixels.static int
getWidth()
protected void
grow
(int sx, int sy) protected void
handleMouseDown
(int sx, int sy) protected void
handleMouseUp
(int screenX, int screenY) int
isHandle
(int sx, int sy) Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.protected void
mouseDownInHandle
(int handle, int sx, int sy) void
protected void
moveHandle
(int sx, int sy) void
nudgeCorner
(int key) Nudge end point of line by one pixel.void
setDrawOffset
(boolean drawOffset) void
setLocation
(int x, int y) Set the location of the ROI in image coordinates.void
setStrokeWidth
(float width) Sets the width of the line used to draw this ROI.static void
setWidth
(int w) boolean
Always returns true.Methods inherited from class ij.gui.Roi
abortPaste, addRoiListener, clone, copyAttributes, drawOverlay, drawPixels, enableSubPixelResolution, endPaste, equals, getAngle, getBoundingRect, getColor, getContourCentroid, getConvexHull, getCornerDiameter, getCPosition, getCurrentPasteMode, getDebugInfo, getDefaultFillColor, getFeretsDiameter, getFeretValues, getFillColor, getFloatAngle, getFloatBounds, getFloatHeight, getFloatWidth, getHashCode, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getInterpolatedPolygon, getMagnification, getMask, getName, getPasteMode, getPosition, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRotationCenter, getRoundRectArcSize, getScaledStroke, getState, getStatistics, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, handleMouseDrag, isActiveOverlayRoi, isArea, isCursor, isDrawingTool, isLine, isVisible, lineCircleIntersection, mouseDragged, mouseReleased, notifyListeners, nudge, removeRoiListener, screenX, screenXD, screenY, screenYD, setColor, setCornerDiameter, setDefaultFillColor, setFillColor, setIgnoreClipRect, setImage, setInstanceColor, setIsCursor, setLineWidth, setLocation, setName, setNonScalable, setPasteMode, setPosition, setPosition, setProperties, setProperty, setPrototypeOverlay, setRotationCenter, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, showStatus, startPaste, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, update, updateClipRect, updateWideLine
-
Field Details
-
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 -
x1R
protected double x1R -
y1R
protected double y1R -
x2R
protected double x2R -
y2R
protected double y2R -
startxd
protected double startxd -
startyd
protected double startyd
-
-
Constructor Details
-
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
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
Deprecated.replaced by Line(int, int, int, int)
-
-
Method Details
-
grow
protected void grow(int sx, int sy) -
mouseMoved
- Overrides:
mouseMoved
in classRoi
-
handleMouseUp
protected void handleMouseUp(int screenX, int screenY) - Overrides:
handleMouseUp
in classRoi
-
drawLine
protected void drawLine(int sx, int sy) -
moveHandle
protected void moveHandle(int sx, int sy) - Overrides:
moveHandle
in classRoi
-
mouseDownInHandle
protected void mouseDownInHandle(int handle, int sx, int sy) - Overrides:
mouseDownInHandle
in classRoi
-
draw
Draws this line on the image. -
getAngle
public double getAngle()Description copied from class:Roi
Overridden 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
Returns, as a Polygon, the two points that define this line. -
getFloatPoints
Returns, as a FloatPolygon, the two points that define this line. -
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 classRoi
- See Also:
-
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 classRoi
- See Also:
-
drawPixels
Description copied from class:Roi
Draws the selection outline on the specified ImageProcessor.- Overrides:
drawPixels
in classRoi
- See Also:
-
contains
public boolean contains(int x, int y) -
handleMouseDown
protected void handleMouseDown(int sx, int sy) - Overrides:
handleMouseDown
in classRoi
-
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:Roi
Sets 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:
setStrokeWidth
in classRoi
- See Also:
-
getBounds
Return the bounding rectangle of this line. -
clipRectMargin
protected int clipRectMargin()- Overrides:
clipRectMargin
in classRoi
-
nudgeCorner
public void nudgeCorner(int key) Nudge end point of line by one pixel.- Overrides:
nudgeCorner
in classRoi
-
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 classRoi
-
setDrawOffset
public void setDrawOffset(boolean drawOffset) - Overrides:
setDrawOffset
in classRoi
-
subPixelResolution
public boolean subPixelResolution()Always returns true.- Overrides:
subPixelResolution
in classRoi
-
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 classRoi
-