ij.gui
Class Roi

java.lang.Object
  extended by 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
protected  ImagePlus clipboard
           
protected  int clipHeight
           
protected  int clipWidth
           
protected  int clipX
           
protected  int clipY
           
protected  boolean constrain
           
static int CONSTRUCTING
           
static int FREELINE
           
static int FREEROI
           
static int HANDLE_SIZE
           
protected  ImageCanvas ic
           
protected  ImagePlus imp
           
static int LINE
           
static int MOVING
           
static int NORMAL
           
protected  int oldHeight
           
protected  int oldWidth
           
protected  int oldX
           
protected  int oldY
           
static int OVAL
           
protected static int pasteMode
           
static int POLYGON
           
static int POLYLINE
           
static Roi previousRoi
           
static int RECTANGLE
           
static int RESIZING
           
protected static java.awt.Color ROIColor
           
static int TRACED_ROI
           
protected  int type
           
protected  boolean updateFullWindow
           
protected  int xMax
           
protected  int yMax
           
 
Constructor Summary
Roi(int x, int y, ImagePlus imp)
           
Roi(int x, int y, int width, int height, ImagePlus imp)
           
 
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()
           
protected  void grow(int xNew, int yNew)
           
protected  void handleMouseDown(int sx, int sy)
           
protected  void handleMouseDrag(int sx, int sy, boolean constrain)
           
protected  void handleMouseUp(int screenX, int screenY)
           
 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.
protected  void showStatus()
           
 java.lang.String toString()
           
protected  void updateClipRect()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTRUCTING

public static final int CONSTRUCTING
See Also:
Constant Field Values

MOVING

public static final int MOVING
See Also:
Constant Field Values

RESIZING

public static final int RESIZING
See Also:
Constant Field Values

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

OVAL

public static final int OVAL
See Also:
Constant Field Values

POLYGON

public static final int POLYGON
See Also:
Constant Field Values

FREEROI

public static final int FREEROI
See Also:
Constant Field Values

TRACED_ROI

public static final int TRACED_ROI
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

POLYLINE

public static final int POLYLINE
See Also:
Constant Field Values

FREELINE

public static final int FREELINE
See Also:
Constant Field Values

HANDLE_SIZE

public static final int HANDLE_SIZE
See Also:
Constant Field Values

previousRoi

public static Roi previousRoi

ROIColor

protected static java.awt.Color ROIColor

pasteMode

protected static int pasteMode

type

protected int type

xMax

protected int xMax

yMax

protected int yMax

imp

protected ImagePlus imp

ic

protected ImageCanvas ic

oldX

protected int oldX

oldY

protected int oldY

oldWidth

protected int oldWidth

oldHeight

protected int oldHeight

clipX

protected int clipX

clipY

protected int clipY

clipWidth

protected int clipWidth

clipHeight

protected int clipHeight

clipboard

protected ImagePlus clipboard

constrain

protected boolean constrain

updateFullWindow

protected boolean updateFullWindow
Constructor Detail

Roi

public Roi(int x,
           int y,
           int width,
           int height,
           ImagePlus imp)

Roi

public Roi(int x,
           int y,
           ImagePlus imp)
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.

Overrides:
clone in class java.lang.Object

grow

protected void grow(int xNew,
                    int yNew)

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.


updateClipRect

protected void updateClipRect()

handleMouseDrag

protected void handleMouseDrag(int sx,
                               int sy,
                               boolean constrain)

draw

public void draw(java.awt.Graphics g)

drawPixels

public void drawPixels()

contains

public boolean contains(int x,
                        int y)

handleMouseDown

protected void handleMouseDown(int sx,
                               int sy)

handleMouseUp

protected void handleMouseUp(int screenX,
                             int screenY)

showStatus

protected void showStatus()

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