ij.gui
Class Roi

java.lang.Object
  |
  +--ij.gui.Roi
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Line, OvalRoi, PolygonRoi, TextRoi

public class Roi
extends java.lang.Object
implements java.lang.Cloneable

A rectangular region of interest and superclass for the other ROI classes.


Field Summary
static int CONSTRUCTING
           
static int FREELINE
           
static int FREEROI
           
static int HANDLE_SIZE
           
static int LINE
           
static int MOVING
           
static int NORMAL
           
static int OVAL
           
static int POLYGON
           
static int POLYLINE
           
static Roi previousRoi
           
static int RECTANGLE
           
static int RESIZING
           
static int TRACED_ROI
           
 
Constructor Summary
Roi(int x, int y, ImagePlus imp)
          Starts the process of creating a user-defined rectangular Roi.
Roi(int x, int y, int width, int height, ImagePlus imp)
          Creates a new rectangular Roi.
 
Method Summary
 void abortPaste()
           
 java.lang.Object clone()
          Returns a copy of this roi.
 boolean contains(int x, int y)
           
 void draw(java.awt.Graphics g)
           
 void drawPixels()
           
 void endPaste()
           
 double getAngle(int x1, int y1, int x2, int y2)
          Returns the angle in degrees between the specified line and a horizontal line.
 java.awt.Rectangle getBoundingRect()
           
static java.awt.Color getColor()
          Returns the color used for drawing ROI outlines.
 double getLength()
          Returns the perimeter length.
 int[] getMask()
           
 int getState()
           
 int getType()
           
 void nudge(int key)
          Nudge ROI one pixel on arrow key press.
 void nudgeCorner(int key)
          Nudge lower right corner of rectangular and oval ROIs by one pixel based on arrow key press.
static void setColor(java.awt.Color c)
          Sets the color used for ROI outline to the specified value.
 void setImage(ImagePlus imp)
           
 void setLocation(int x, int y)
           
static void setPasteMode(int transferMode)
          Sets the Paste transfer mode.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTRUCTING

public static final int CONSTRUCTING

MOVING

public static final int MOVING

RESIZING

public static final int RESIZING

NORMAL

public static final int NORMAL

RECTANGLE

public static final int RECTANGLE

OVAL

public static final int OVAL

POLYGON

public static final int POLYGON

FREEROI

public static final int FREEROI

TRACED_ROI

public static final int TRACED_ROI

LINE

public static final int LINE

POLYLINE

public static final int POLYLINE

FREELINE

public static final int FREELINE

HANDLE_SIZE

public static final int HANDLE_SIZE

previousRoi

public static Roi previousRoi
Constructor Detail

Roi

public Roi(int x,
           int y,
           int width,
           int height,
           ImagePlus imp)
Creates a new rectangular Roi. The ImagePlus argument can be null.

Roi

public Roi(int x,
           int y,
           ImagePlus imp)
Starts the process of creating a user-defined rectangular Roi.
Method Detail

setLocation

public void setLocation(int x,
                        int y)

setImage

public void setImage(ImagePlus imp)

getType

public int getType()

getState

public int getState()

getLength

public double getLength()
Returns the perimeter length.

getBoundingRect

public java.awt.Rectangle getBoundingRect()

clone

public java.lang.Object clone()
Returns a copy of this roi. See Thinking is Java by Bruce Eckel (www.eckelobjects.com) for a good description of object cloning.

nudge

public void nudge(int key)
Nudge ROI one pixel on arrow key press.

nudgeCorner

public void nudgeCorner(int key)
Nudge lower right corner of rectangular and oval ROIs by one pixel based on arrow key press.

draw

public void draw(java.awt.Graphics g)

drawPixels

public void drawPixels()

contains

public boolean contains(int x,
                        int y)

getMask

public int[] getMask()

endPaste

public void endPaste()

abortPaste

public void abortPaste()

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.

getColor

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

setColor

public static void setColor(java.awt.Color c)
Sets the color used for ROI outline to the specified value.

setPasteMode

public static void setPasteMode(int transferMode)
Sets the Paste transfer mode.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object