O2Plib.image
Class Roi

java.lang.Object
  extended by O2Plib.image.Roi

public class Roi
extends java.lang.Object


Field Summary
 java.awt.Color color
          color to display the ROI if enabled
 int roiCode
          code for type of ROI.
static int roiIDctr
          Unique ROI ID that is used to generate a unqiue ROI each time the constructor is called.
 java.lang.String roiName
          name of ROI if not null
 boolean showRoiFlag
          Flag indicating that the Roi is to be displayed.
 int x1
          ROI ULHC X coordinate
 int x2
          ROI LRHC X cooreinate
 int y1
          ROI ULHC Y coordinate
 int y2
          ROI LRHC Y coordinate
 
Constructor Summary
Roi()
          Roi() - Creates a new instance of Roi with null values.
Roi(int x1, int y1, int x2, int y2, java.lang.String roiName, int roiCode)
          Roi() - creates a new instance of Roi
Roi(int x1, int y1, int x2, int y2, java.lang.String roiName, int roiCode, java.awt.Color color, boolean showRoiFlag)
          Roi() - creates a new instance of Roi
Roi(java.lang.String roiName)
          Roi() - creates a new instance of Roi.
Roi(java.lang.String roiName, int roiCode)
          Roi() - creates a new instance of Roi
Roi(java.lang.String roiName, int roiCode, boolean showRoiFlag)
          Roi() - creates a new instance of Roi
 
Method Summary
 void clear()
          clear() - clear ROI by setting all coordinates to -1
 java.lang.String getROIStr()
          getROIstr() - get the ROI printable string
 boolean isValid()
          isValid() - test if the ROI is well defined such that all entries are < 0 and (x1 < = x2) and (y1 < = y2).
 boolean isValid(int x1, int y1, int x2, int y2)
          isValid() - test if these coordinates are a valid region
 boolean isXYinROI(int x, int y)
          isXYinROI() - test if XY is in the valid ROI region
 void setLRHC(int x2, int y2)
          setLRHC() - set the Lower Right Hand Corner of Region of Interest
 void setROI(int x1, int y1, int x2, int y2)
          setROI() - set the Region of Interest.
 void setROI(Roi srcRoi)
          setROI() - set the ROI from another ROI srcRoi if it exists.
 void setRoiCode(int roiCode)
          setRoiCode() - set the ROI code
 void setRoiDisplay(boolean showRoiFlag)
          setRoiDisplay() - set the ROI flag for display the Roi.
 void setRoiName(java.lang.String roiName)
          setRoiName() - set the ROI name
 void setULHC(int x1, int y1)
          setULHC() - set the Upper Left Hand Corner of Region of Interest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

roiIDctr

public static int roiIDctr
Unique ROI ID that is used to generate a unqiue ROI each time the constructor is called.


roiName

public java.lang.String roiName
name of ROI if not null


roiCode

public int roiCode
code for type of ROI. This is application specific.


color

public java.awt.Color color
color to display the ROI if enabled


showRoiFlag

public boolean showRoiFlag
Flag indicating that the Roi is to be displayed. Note this flag is tested by the user application.


x1

public int x1
ROI ULHC X coordinate


y1

public int y1
ROI ULHC Y coordinate


x2

public int x2
ROI LRHC X cooreinate


y2

public int y2
ROI LRHC Y coordinate

Constructor Detail

Roi

public Roi(int x1,
           int y1,
           int x2,
           int y2,
           java.lang.String roiName,
           int roiCode)
Roi() - creates a new instance of Roi

Parameters:
x1 - is upper left hand corner X coordinate
y1 - is upper left hand corner Y coordinate
x2 - is lower right hand corner X coordinate
y2 - is lower right hand corner X coordinate
roiName - - optional name of ROI, else null
roiCode - - type of ROI

Roi

public Roi(int x1,
           int y1,
           int x2,
           int y2,
           java.lang.String roiName,
           int roiCode,
           java.awt.Color color,
           boolean showRoiFlag)
Roi() - creates a new instance of Roi

Parameters:
x1 - is upper left hand corner X coordinate
y1 - is upper left hand corner Y coordinate
x2 - is lower right hand corner X coordinate
y2 - is lower right hand corner X coordinate
roiName - - optional name of ROI, else null
roiCode - - type of ROI
color - - color of ROI if needed
showRoiFlag - - to enable the display of this ROI

Roi

public Roi(java.lang.String roiName,
           int roiCode)
Roi() - creates a new instance of Roi

Parameters:
roiName - - optional name of ROI, else null
roiCode - - type of ROI

Roi

public Roi(java.lang.String roiName,
           int roiCode,
           boolean showRoiFlag)
Roi() - creates a new instance of Roi

Parameters:
roiName - - optional name of ROI, else null
roiCode - - type of ROI
showRoiFlag - - to enable the display of this ROI

Roi

public Roi(java.lang.String roiName)
Roi() - creates a new instance of Roi. It generates a sequential roiCode.

Parameters:
roiName - - optional name of ROI, else null

Roi

public Roi()
Roi() - Creates a new instance of Roi with null values. It generates a sequential roiCode.

Method Detail

setRoiName

public void setRoiName(java.lang.String roiName)
setRoiName() - set the ROI name


setRoiCode

public void setRoiCode(int roiCode)
setRoiCode() - set the ROI code


setRoiDisplay

public void setRoiDisplay(boolean showRoiFlag)
setRoiDisplay() - set the ROI flag for display the Roi. Note this flag is tested by the user application.


clear

public void clear()
clear() - clear ROI by setting all coordinates to -1


isValid

public boolean isValid()
isValid() - test if the ROI is well defined such that all entries are < 0 and (x1 < = x2) and (y1 < = y2).

Returns:
true if ROI is well defined

isValid

public boolean isValid(int x1,
                       int y1,
                       int x2,
                       int y2)
isValid() - test if these coordinates are a valid region

Parameters:
x1 - is upper left hand corner X coordinate
y1 - is upper left hand corner Y coordinate
x2 - is lower right hand corner X coordinate
y2 - is lower right hand corner X coordinate
Returns:
true if value

isXYinROI

public boolean isXYinROI(int x,
                         int y)
isXYinROI() - test if XY is in the valid ROI region

Parameters:
x - - to test
y - - to test
Returns:
true if inside the valid ROI

setULHC

public void setULHC(int x1,
                    int y1)
setULHC() - set the Upper Left Hand Corner of Region of Interest

Parameters:
x1 - is upper left hand corner X coordinate
y1 - is upper left hand corner Y coordinate

setLRHC

public void setLRHC(int x2,
                    int y2)
setLRHC() - set the Lower Right Hand Corner of Region of Interest

Parameters:
x2 - is lower right hand corner X coordinate
y2 - is lower right hand corner X coordinate
y -

setROI

public void setROI(int x1,
                   int y1,
                   int x2,
                   int y2)
setROI() - set the Region of Interest. Do not validate the coordinates which means you could set it to illegal values.

Parameters:
x1 - is upper left hand corner X coordinate
y1 - is upper left hand corner Y coordinate
x2 - is lower right hand corner X coordinate
y2 - is lower right hand corner X coordinate

setROI

public void setROI(Roi srcRoi)
setROI() - set the ROI from another ROI srcRoi if it exists.

Parameters:
srcRoi - source ROI to copy

getROIStr

public java.lang.String getROIStr()
getROIstr() - get the ROI printable string
 E.g.,
  "ROI(cw,1)[5:519, 40:506]"
  "ROI(wedge cw,2)[5:519, 5:36]"

Returns:
ROI string for ROI