com.vistech.roi
Class ROIUtil

java.lang.Object
  |
  +--com.vistech.roi.ROIUtil

public class ROIUtil
extends java.lang.Object

A utility class that provides several static methods for computing ROI-related data.

Version:
1.0 10 March 2000
Author:
Lawrence Rodrigues

Constructor Summary
ROIUtil()
           
 
Method Summary
static double[][] computeStats(int[][] pixel)
          Computes different types of statistics from an array of pixel values.
static double computeStdDev(int[] data, double mean)
          Computes standard deviation.
static java.awt.Point[] getBoundaryPoints(java.awt.Shape shape, int viewerWid, int viewerHt)
          Returns all the positions of pixels that lie on the boundary of a specified shape.
static int[][] getPixelSamples(java.awt.image.BufferedImage img)
          Returns the values of the pixel samples of the entire image in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
static int[][] getPixelSamples(java.awt.image.SampleModel sm, java.awt.image.DataBuffer db, java.awt.Dimension imageSize)
          Returns the values of the pixel samples of the entire image in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
static int[][] getROIPixelSamples(java.awt.image.BufferedImage img, java.awt.geom.Point2D[] points)
          Returns the values of the pixel samples from specified positions in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
static int[][] getROIPixelSamples(java.awt.image.BufferedImage img, java.awt.Shape shape)
          Returns the values of the pixel samples within a specified shape in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
static int[][] getROIPixelSamples(java.awt.image.SampleModel sm, java.awt.image.DataBuffer db, java.awt.geom.Point2D[] points)
          Returns the values of the pixel samples from specified positions in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
static int[][] getROIPixelSamples(java.awt.image.SampleModel sm, java.awt.image.DataBuffer db, java.awt.Shape shape)
          Returns the values of the pixel samples within a specified shape in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
static java.awt.Point[] getROIPoints(java.awt.image.BufferedImage img, java.awt.Shape shape)
          Returns all the positions of pixels within a specified shape.
static double[][] getROIStats(java.awt.image.BufferedImage img, java.awt.geom.Point2D[] points)
          Returns ROI statistics of all the pixel samples in a two dimensional array.
static double[][] getROIStats(java.awt.image.BufferedImage img, java.awt.Shape shape)
          Returns ROI statistics o all the pixel samples in a two dimensional array.
static double[][] getROIStats(java.awt.image.SampleModel sm, java.awt.image.DataBuffer db, java.awt.geom.Point2D[] points)
          Returns ROI statistics for all the pixel samples in a two dimensional array.
static double[][] getROIStats(java.awt.image.SampleModel sm, java.awt.image.DataBuffer db, java.awt.Shape shape)
          Returns ROI statistics for all the pixel samples in a two dimensional array.
static java.awt.Point[] getThresholdPoints(java.awt.image.BufferedImage img, java.awt.Shape shape, int threshold)
          Returns the positions of pixels within a specified shape that are above the specified threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ROIUtil

public ROIUtil()
Method Detail

getROIStats

public static double[][] getROIStats(java.awt.image.BufferedImage img,
                                     java.awt.geom.Point2D[] points)
Returns ROI statistics of all the pixel samples in a two dimensional array.
Parameters:
img - the image from which statistics are computed.
points - an array of positions of pixels, values of which are used for computing statistics.
Returns:
the two dimensional array containing statistics of all the samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the type of statistics. The size of the first dimension equals the number of bands. The size of the second dimension equals the number of types of statistics computations, which is 5. The order of types of computations in the second dimension are: minimum, maximum, mean, area, and standard deviation. Example: double[][] stats = ROIUtil.getStats(img,points); stats[2][1] represents the maximum value of the second sample. In an ARGB image, this represents the maximum value of the green sample.

getROIStats

public static double[][] getROIStats(java.awt.image.BufferedImage img,
                                     java.awt.Shape shape)
Returns ROI statistics o all the pixel samples in a two dimensional array.
Parameters:
img - the image from which statistics are computed.
shape - the shape drawn over image. Pixels that lie inside this shape are used for computing statistics.
Returns:
the two dimensional array containing statistics of all the samples.

getROIStats

public static double[][] getROIStats(java.awt.image.SampleModel sm,
                                     java.awt.image.DataBuffer db,
                                     java.awt.geom.Point2D[] points)
Returns ROI statistics for all the pixel samples in a two dimensional array.
Parameters:
sm - the sample model of the image.
db - the data buffer object that contains the image data.
points - an array of positions of pixels, values of which are used for computing statistics.
Returns:
the two dimensional array containing statistics of all the samples.

getROIStats

public static double[][] getROIStats(java.awt.image.SampleModel sm,
                                     java.awt.image.DataBuffer db,
                                     java.awt.Shape shape)
Returns ROI statistics for all the pixel samples in a two dimensional array.
Parameters:
sm - the sample model of the image.
db - the data buffer object that contains the image data.
shape - the shape drawn over image. Pixels that lie inside this shape are used for computing statistics.
Returns:
the two dimensional array containing statistics of all the samples.

computeStats

public static double[][] computeStats(int[][] pixel)
Computes different types of statistics from an array of pixel values. The types of statistics computer are: minimum, maximum, mean, area, and standard deviation.
Parameters:
pixel - two dimesional array of pixel values. The first dimension represents the index of the sample and the second dimension the sample valus.
Returns:
the two dimensional array containing statistics of all the samples.

computeStdDev

public static double computeStdDev(int[] data,
                                   double mean)
Computes standard deviation.
Parameters:
data - an array of values for which the standard deviation is computed.
mean - mean of the data values.
Returns:
the standard deviation.

getPixelSamples

public static int[][] getPixelSamples(java.awt.image.BufferedImage img)
Returns the values of the pixel samples of the entire image in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
Parameters:
img - the image.
Returns:
a two dimensional array containing values of all the pixel samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the sample value.

getPixelSamples

public static int[][] getPixelSamples(java.awt.image.SampleModel sm,
                                      java.awt.image.DataBuffer db,
                                      java.awt.Dimension imageSize)
Returns the values of the pixel samples of the entire image in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
Parameters:
sm - the sample model of the image.
db - the data buffer object that contains the image data.
imageSize - the image size.
Returns:
a two dimensional array containing values of all the pixel samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the sample value.

getROIPixelSamples

public static int[][] getROIPixelSamples(java.awt.image.BufferedImage img,
                                         java.awt.geom.Point2D[] points)
Returns the values of the pixel samples from specified positions in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
Parameters:
img - the image from which the pixels values are retrieved.
points - an array of pixel positions.
Returns:
a two dimensional array containing values of all the pixel samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the sample value.

getROIPixelSamples

public static int[][] getROIPixelSamples(java.awt.image.SampleModel sm,
                                         java.awt.image.DataBuffer db,
                                         java.awt.geom.Point2D[] points)
Returns the values of the pixel samples from specified positions in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
Parameters:
sm - the sample model of the image.
db - the data buffer object that contains the image data.
points - an array of pixel positions.
Returns:
a two dimensional array containing values of all the pixel samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the sample value.

getROIPixelSamples

public static int[][] getROIPixelSamples(java.awt.image.BufferedImage img,
                                         java.awt.Shape shape)
Returns the values of the pixel samples within a specified shape in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
Parameters:
img - the image from which the pixels values are retrieved.
shape - the shape drawn over image. Pixels that lie inside this shape are returned.
Returns:
a two dimensional array containing values of all the pixel samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the sample value.

getROIPixelSamples

public static int[][] getROIPixelSamples(java.awt.image.SampleModel sm,
                                         java.awt.image.DataBuffer db,
                                         java.awt.Shape shape)
Returns the values of the pixel samples within a specified shape in a two dimensional array in which the the first dimension represents the sample index, and the second dimension represents the the sample value.
Parameters:
sm - the sample model of the image.
db - the data buffer object that contains the image data.
shape - the shape drawn over image. Pixels that lie inside this shape are returned.
Returns:
a two dimensional array containing values of all the pixel samples. The first subscript represents the position of the sample in the pixel array, and the second subscript represents the sample value.

getThresholdPoints

public static java.awt.Point[] getThresholdPoints(java.awt.image.BufferedImage img,
                                                  java.awt.Shape shape,
                                                  int threshold)
Returns the positions of pixels within a specified shape that are above the specified threshold.
Parameters:
img - the image.
shape - the shape drawn over image. Thresholded pixels that lie inside this shape are returned.
threshold - the threshold value.
Returns:
an array of pixels positions that are above the specified threshold.

getROIPoints

public static java.awt.Point[] getROIPoints(java.awt.image.BufferedImage img,
                                            java.awt.Shape shape)
Returns all the positions of pixels within a specified shape. These positions don't include pixel positions on the boundary of the shape.
Parameters:
img - the image.
shape - the shape drawn over image. Thresholded pixels that lie inside this shape are returned.
threshold - the threshold value.
Returns:
an array of pixels positions that are above the specified threshold.

getBoundaryPoints

public static java.awt.Point[] getBoundaryPoints(java.awt.Shape shape,
                                                 int viewerWid,
                                                 int viewerHt)
Returns all the positions of pixels that lie on the boundary of a specified shape.
Parameters:
img - the image.
shape - the shape drawn over image. Thresholded pixels that lie inside this shape are returned.
threshold - the threshold value.
Returns:
an array of pixels positions that are above the specified threshold.