com.vistech.roi
Class ROI2D

java.lang.Object
  |
  +--com.vistech.roi.ROI2D
All Implemented Interfaces:
java.io.Serializable

public class ROI2D
extends java.lang.Object
implements java.io.Serializable

Represents an ROI. Properties in this class represent attributes of the ROI. The properties include shape of the ROI, mask value for thresholding, and statistics of the ROI. Whenever a new shape is set, this class computes the threshold values and statistics. Statistics computed in this class are: minimum, maximumn mean, standard deviation, and area. If your application needs to compute other types of statistics, extend this class. and override relevant methods.

Version:
1.0 3 Oct 2000
Author:
Lawrence Rodrigues
See Also:
Serialized Form

Field Summary
protected  java.awt.Point[] curPoints
           
protected  java.awt.Shape currentShape
           
protected  java.awt.image.BufferedImage displayImage
           
protected  java.awt.Color drawingColor
           
protected  java.awt.Color fillColor
           
protected  int maskValue
           
protected  java.awt.image.BufferedImage origImage
           
protected  java.lang.String[] roiColNames
           
protected  ROIContext roiContext
           
protected  java.lang.String[][] roiData
           
protected  int roiNumber
           
protected  ROIStatistics[] roiStats
           
protected  int[][] stats
           
protected  int threshold
           
 
Constructor Summary
ROI2D()
           
 
Method Summary
 void clearMask()
          Clear the ROI.
 void drawShape(java.awt.Shape shape, java.awt.Color color)
          Draws the ROI shape over the iamge.
 java.lang.String[] getColumnNames()
          This is a convenient method that returns the names of the statistics that is computed in this class.
 java.awt.Color getDrawingColor()
          Reurns the color of the ROI outline.
 java.awt.Color getFillColor()
          Reurns the color of the thresholded pixels.
 int getID()
          Reurns the identification number of this ROI.
 int getMaskValue()
          Reurns the mask value.
 ROIContext getROIContext()
          Gets the roi context property.
 java.awt.Shape getShape()
          Reurns the shape of the ROI.
 ROIStatistics[] getStats()
          Returns the statistics values of each sample in an ROIStatistics object.
 java.lang.String[][] getStatsAsString()
          This is a convenient method that returns the statistics values as text so that they can be immediately displayed on a table.
 int getThreshold()
          Returns the threshold value.
 void setDrawingColor(java.awt.Color color)
          Sets the color of the ROI outline.
 void setFillColor(java.awt.Color color)
          Sets the color of the thresholded pixels.
 void setID(int number)
          Sets the identification number for this ROI.
 void setMask(java.awt.Point[] points, int maskValue)
          Sets the mask value of the thresholded pixels and highlights them.
 void setMaskValue(int number)
          Sets the mask value.
 void setROIContext(ROIContext roiContext)
          Sets the roi context property.
 void setShape(java.awt.Shape sh)
          Sets the shape property.
 void setThreshold(int thresh)
          Sets the threshold value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentShape

protected java.awt.Shape currentShape

roiContext

protected transient ROIContext roiContext

roiColNames

protected java.lang.String[] roiColNames

stats

protected int[][] stats

roiData

protected java.lang.String[][] roiData

roiNumber

protected int roiNumber

roiStats

protected ROIStatistics[] roiStats

threshold

protected int threshold

maskValue

protected int maskValue

origImage

protected transient java.awt.image.BufferedImage origImage

displayImage

protected transient java.awt.image.BufferedImage displayImage

curPoints

protected java.awt.Point[] curPoints

drawingColor

protected java.awt.Color drawingColor

fillColor

protected java.awt.Color fillColor
Constructor Detail

ROI2D

public ROI2D()
Method Detail

setROIContext

public void setROIContext(ROIContext roiContext)
Sets the roi context property.
Parameters:
roiContext - the ROI context.

getROIContext

public ROIContext getROIContext()
Gets the roi context property.
Returns:
the ROI context.

setShape

public void setShape(java.awt.Shape sh)
Sets the shape property. Invocation of this method results in computation of ROI statistics.
Parameters:
sh - the ROI shape.

drawShape

public void drawShape(java.awt.Shape shape,
                      java.awt.Color color)
Draws the ROI shape over the iamge.
Parameters:
sh - the ROI shape.
color - the color of the ROI outline.

getShape

public java.awt.Shape getShape()
Reurns the shape of the ROI.
Returns:
the ROI shape.

setID

public void setID(int number)
Sets the identification number for this ROI. This property is useful for distinguishing ROIs when multiple ROIs deposited on an image. It is tge responsibity of the calling object to ensure that no duplicate numbers exist.
Parameters:
number - the identification number of the ROI.

getID

public int getID()
Reurns the identification number of this ROI.
Returns:
the identification number.

setMaskValue

public void setMaskValue(int number)
Sets the mask value.
Parameters:
number - the value of the mask.

getMaskValue

public int getMaskValue()
Reurns the mask value.
Returns:
the mask value.

setFillColor

public void setFillColor(java.awt.Color color)
Sets the color of the thresholded pixels.
Parameters:
the - color of the thresholded pixels.

getFillColor

public java.awt.Color getFillColor()
Reurns the color of the thresholded pixels.
Returns:
the color of the thresholded pixels.

setDrawingColor

public void setDrawingColor(java.awt.Color color)
Sets the color of the ROI outline.
Parameters:
the - color of ROI outlne.

getDrawingColor

public java.awt.Color getDrawingColor()
Reurns the color of the ROI outline.
Returns:
the color of the ROI outline.

getColumnNames

public java.lang.String[] getColumnNames()
This is a convenient method that returns the names of the statistics that is computed in this class.
Returns:
an array with each element representing a type of statistics (e.g., min, max, mean).

getStatsAsString

public java.lang.String[][] getStatsAsString()
This is a convenient method that returns the statistics values as text so that they can be immediately displayed on a table.
Returns:
a two dimensional array with first subscript representing the pixel sample, and the second the correpsonding statistics.

getStats

public ROIStatistics[] getStats()
Returns the statistics values of each sample in an ROIStatistics object.
Returns:
an array of ROIStatiscs objects. Each element of this array is populated with statistics of a sample (i.e., pixel component).

getThreshold

public int getThreshold()
Returns the threshold value.
Returns:
the threshold value.

setThreshold

public void setThreshold(int thresh)
Sets the threshold value. This value is the same for all the bands. Calls setMask(points, maskValue) to highlight the thresholded pixels.
Parameters:
thresh - the threshold value.
See Also:
com.vistech.roi.ROIUtil.

setMask

public void setMask(java.awt.Point[] points,
                    int maskValue)
Sets the mask value of the thresholded pixels and highlights them.
Parameters:
points - an arry of points within the ROI.
maskValue - the mask value.

clearMask

public void clearMask()
Clear the ROI. This is done evertime a new threshold is set.