ij.gui
Class AttributeRoi

java.lang.Object
  extended by ij.gui.AbstractRoi
      extended by ij.gui.AttributeRoi
All Implemented Interfaces:
RoiBeans, RoiConstance
Direct Known Subclasses:
Roi

public abstract class AttributeRoi
extends AbstractRoi

Title:

Description:

Copyright: Copyright (c) 2011

Company:


Field Summary
protected static java.awt.Color defaultFillColor
           
protected  java.awt.Color fillColor
           
protected  ImagePlus imp
           
protected static java.awt.Color ROIColor
           
protected  java.awt.BasicStroke stroke
           
protected  java.awt.Color strokeColor
           
protected  int type
           
protected  boolean wideLine
           
protected  int xMax
           
protected  int yMax
           
 
Fields inherited from interface ij.gui.RoiConstance
ADD_TO_ROI, ANGLE, COMPOSITE, CONSTRUCTING, FREELINE, FREEROI, HANDLE_SIZE, LINE, MOVING, MOVING_HANDLE, NO_MODS, NORMAL, NOT_PASTING, OVAL, POINT, POLYGON, POLYLINE, RECTANGLE, RESIZING, SUBTRACT_FROM_ROI, TRACED_ROI
 
Constructor Summary
AttributeRoi()
           
 
Method Summary
 void copyAttributes(Roi roi2)
          Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection.
 double getAngle(int x1, int y1, int x2, int y2)
          Returns the angle in degrees between the specified line and a horizontal line.
static java.awt.Color getColor()
          Returns the default (global) color used for drawing ROI outlines.
 java.awt.Polygon getConvexHull()
           
 int getCornerDiameter()
          Returns the rounded rectangle corner diameter (pixels).
 int getCPosition()
          Returns the channel position of this ROI, or zero if this ROI is not associated with a particular channel.
static java.awt.Color getDefaultFillColor()
           
 double getFeretsDiameter()
          Returns Feret's diameter, the greatest distance between any two points along the ROI boundary.
 double[] getFeretValues()
          Caculates "Feret" (maximum caliper width), "FeretAngle" and "MinFeret" (minimum caliper width), "FeretX" and "FeretY".
 java.awt.Color getFillColor()
          Returns the color used to fill this ROI, or null if it is not filled.
 ImagePlus getImage()
          Returns the ImagePlus associated with this ROI, or null.
 int getImageID()
          Returns the ID of the image associated with this ROI.
 java.lang.String getName()
          Returns the name of this ROI, or null.
 int getPosition()
          Returns the stack position (image number) of this ROI, or zero if the ROI is not associated with a particular stack image.
 int getRoundRectArcSize()
          Obsolete; replaced by getCornerDiameter().
 java.awt.BasicStroke getStroke()
          Returns the Stroke used to draw this ROI, or null if no Stroke is used.
 java.awt.Color getStrokeColor()
          Returns the the color used to draw the ROI outline or null if the default color is being used.
 float getStrokeWidth()
          Returns the lineWidth.
 int getTPosition()
          Returns the frame position of this ROI, or zero if this ROI is not associated with a particular frame.
 int getType()
           
 int getZPosition()
          Returns the slice position of this ROI, or zero if this ROI is not associated with a particular slice.
static void setColor(java.awt.Color c)
          Sets the default (global) color used for ROI outlines.
 void setCornerDiameter(int cornerDiameter)
          Sets the rounded rectangle corner diameter (pixels).
static void setDefaultFillColor(java.awt.Color color)
           
 void setFillColor(java.awt.Color color)
          Sets the color used to fill ROIs when they are in an overlay.
 void setName(java.lang.String name)
          Sets the name of this ROI.
 void setPosition(int n)
          Sets the stack position (image number) of this ROI.
 void setPosition(int channel, int slice, int frame)
          Sets the hyperstack position of this ROI.
 void setRoundRectArcSize(int cornerDiameter)
          Obsolete; replaced by setCornerDiameter().
 void setStroke(java.awt.BasicStroke stroke)
          Sets the Stroke used to draw this ROI.
 void setStrokeColor(java.awt.Color c)
          Sets the color used by this ROI to draw its outline.
 void setStrokeWidth(double width)
          This is a version of setStrokeWidth() that accepts a double argument.
 void setStrokeWidth(float width)
          Sets the width of the line used to draw this ROI.
 
Methods inherited from class ij.gui.AbstractRoi
clipRectMargin, clone, getCurrentPasteMode, getMagnification, getScaledStroke, grow, handleMouseDown, handleMouseDrag, handleMouseUp, mouseDownInHandle, moveHandle, screenX, screenXD, screenY, screenYD, setPasteMode, showStatus, toFloat, toInt, toInt, toIntR, updateClipRect
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ij.gui.RoiBeans
abortPaste, contains, draw, drawHandle, drawOverlay, drawPixels, drawPixels, endPaste, equals, getBoundingRect, getBounds, getDrawOffset, getFloatBounds, getFloatPolygon, getHandleSize, getLength, getMask, getPasteMode, getPolygon, getPrototypeOverlay, getState, getTypeAsString, isArea, isDrawingTool, isHandle, isLine, isVisible, nudge, nudgeCorner, setDrawOffset, setImage, setInstanceColor, setLineWidth, setLocation, setNonScalable, setPrototypeOverlay, startPaste, subPixelResolution, toString, update, updateWideLine
 

Field Detail

type

protected int type

xMax

protected int xMax

yMax

protected int yMax

imp

protected ImagePlus imp

ROIColor

protected static java.awt.Color ROIColor

defaultFillColor

protected static java.awt.Color defaultFillColor

strokeColor

protected java.awt.Color strokeColor

fillColor

protected java.awt.Color fillColor

stroke

protected java.awt.BasicStroke stroke

wideLine

protected boolean wideLine
Constructor Detail

AttributeRoi

public AttributeRoi()
Method Detail

getImage

public ImagePlus getImage()
Returns the ImagePlus associated with this ROI, or null.


getImageID

public int getImageID()
Returns the ID of the image associated with this ROI.


getType

public int getType()

getFeretsDiameter

public double getFeretsDiameter()
Returns Feret's diameter, the greatest distance between any two points along the ROI boundary.


getFeretValues

public double[] getFeretValues()
Caculates "Feret" (maximum caliper width), "FeretAngle" and "MinFeret" (minimum caliper width), "FeretX" and "FeretY".


getAngle

public double getAngle(int x1,
                       int y1,
                       int x2,
                       int y2)
Returns the angle in degrees between the specified line and a horizontal line.


getConvexHull

public java.awt.Polygon getConvexHull()

setColor

public static void setColor(java.awt.Color c)
Sets the default (global) color used for ROI outlines.

See Also:
getColor(), setStrokeColor(Color)

getColor

public static java.awt.Color getColor()
Returns the default (global) color used for drawing ROI outlines.

See Also:
setColor(Color), getStrokeColor()

setStrokeColor

public void setStrokeColor(java.awt.Color c)
Sets the color used by this ROI to draw its outline. This color, if not null, overrides the global color set by the static setColor() method.

See Also:
getStrokeColor(), #setStrokeWidth(int), ImagePlus.setOverlay(ij.gui.Overlay)

getStrokeColor

public java.awt.Color getStrokeColor()
Returns the the color used to draw the ROI outline or null if the default color is being used.

See Also:
setStrokeColor(Color)

setFillColor

public void setFillColor(java.awt.Color color)
Sets the color used to fill ROIs when they are in an overlay.

See Also:
ImagePlus.setOverlay(ij.gui.Overlay)

getFillColor

public java.awt.Color getFillColor()
Returns the color used to fill this ROI, or null if it is not filled.

See Also:
getStrokeColor()

setDefaultFillColor

public static void setDefaultFillColor(java.awt.Color color)

getDefaultFillColor

public static java.awt.Color getDefaultFillColor()

setStrokeWidth

public void setStrokeWidth(float width)
Sets the width of the line used to draw this ROI.

See Also:
setStrokeColor(Color), ImagePlus.setOverlay(ij.gui.Overlay)

setStrokeWidth

public void setStrokeWidth(double width)
This is a version of setStrokeWidth() that accepts a double argument.


getStrokeWidth

public float getStrokeWidth()
Returns the lineWidth.


setStroke

public void setStroke(java.awt.BasicStroke stroke)
Sets the Stroke used to draw this ROI.


getStroke

public java.awt.BasicStroke getStroke()
Returns the Stroke used to draw this ROI, or null if no Stroke is used.


copyAttributes

public void copyAttributes(Roi roi2)
Copy the attributes (outline color, fill color, outline width) of 'roi2' to the this selection.


getName

public java.lang.String getName()
Returns the name of this ROI, or null.


setName

public void setName(java.lang.String name)
Sets the name of this ROI.


setCornerDiameter

public void setCornerDiameter(int cornerDiameter)
Sets the rounded rectangle corner diameter (pixels).


getCornerDiameter

public int getCornerDiameter()
Returns the rounded rectangle corner diameter (pixels).


setRoundRectArcSize

public void setRoundRectArcSize(int cornerDiameter)
Obsolete; replaced by setCornerDiameter().


getRoundRectArcSize

public int getRoundRectArcSize()
Obsolete; replaced by getCornerDiameter().


setPosition

public void setPosition(int n)
Sets the stack position (image number) of this ROI. In an overlay, this ROI is only displayed when the stack is at the specified position. Set to zero to have the ROI displayed on all images in the stack.

See Also:
Overlay

getPosition

public int getPosition()
Returns the stack position (image number) of this ROI, or zero if the ROI is not associated with a particular stack image.

See Also:
Overlay

setPosition

public void setPosition(int channel,
                        int slice,
                        int frame)
Sets the hyperstack position of this ROI. In an overlay, this ROI is only displayed when the hyperstack is at the specified position.

See Also:
Overlay

getCPosition

public final int getCPosition()
Returns the channel position of this ROI, or zero if this ROI is not associated with a particular channel.


getZPosition

public final int getZPosition()
Returns the slice position of this ROI, or zero if this ROI is not associated with a particular slice.


getTPosition

public final int getTPosition()
Returns the frame position of this ROI, or zero if this ROI is not associated with a particular frame.