com.pearsoneduc.ip.op
Class RegionGrower

java.lang.Object
  |
  +--com.pearsoneduc.ip.op.RegionGrower

public class RegionGrower
extends java.lang.Object

A class that segments greyscale or colour images using a region growing algorithm.

Version:
1.1 [1999/08/25]
Author:
Nick Efford

Constructor Summary
RegionGrower(java.awt.image.BufferedImage image, java.util.List seeds, int conn, int thresh)
          Constructs a RegionGrower that will grow regions in an image from the specified set of seed pixels.
RegionGrower(java.awt.image.BufferedImage image, java.util.List seeds, int conn, int thresh, boolean monitor)
          Constructs a RegionGrower that will grow regions in an image from the specified set of seed pixels.
 
Method Summary
 int getNumIterations()
           
 int getNumRegions()
           
 java.awt.image.BufferedImage getRegionImage()
          Gives an image containing the regions grown thus far.
 int getRegionSize(int i)
          Gives the number of pixels in the specified region.
 java.awt.image.BufferedImage getStatusImage()
          If status monitoring is enabled, this method gives a colour image that indicates the current status of the region growing process.
 void grow()
          Performs a single iteration of the region growing algorithm.
 void growToCompletion()
          Grows regions to their maximum extent.
 boolean isFinished()
          Indicates whether region growing is complete.
 boolean isNotFinished()
          Indicates whether region growing is complete.
 void setAssignedColour(java.awt.Color colour)
          Sets the colour used to indicate pixels assigned to a region in the image returned by getStatusImage().
 void setBorderColour(java.awt.Color colour)
          Sets the colour used to indicate pixels on the border of a region in the image returned by getStatusImage().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegionGrower

public RegionGrower(java.awt.image.BufferedImage image,
                    java.util.List seeds,
                    int conn,
                    int thresh)
Constructs a RegionGrower that will grow regions in an image from the specified set of seed pixels. Status monitoring is disabled.
Parameters:
image - Image to be segmented
seeds - list of seed pixels (each a Point object)
conn - connectivity (4 or 8)
thresh - threshold on the difference between a pixel's grey level and the mean grey level of a region

RegionGrower

public RegionGrower(java.awt.image.BufferedImage image,
                    java.util.List seeds,
                    int conn,
                    int thresh,
                    boolean monitor)
Constructs a RegionGrower that will grow regions in an image from the specified set of seed pixels.
Parameters:
image - Image to be segmented
seeds - list of seed pixels (each a Point object)
conn - connectivity (4 or 8)
thresh - threshold on the difference between a pixel's grey level and the mean grey level of a region
monitor - flag indicating whether status should be monitored
Method Detail

getNumRegions

public int getNumRegions()
Returns:
number of regions that will be created.

getRegionSize

public int getRegionSize(int i)
Gives the number of pixels in the specified region.
Parameters:
i - index of region (between 0 and N-1, where N is number of regions)
Returns:
region size, or 0 if index is invalid.

getRegionImage

public java.awt.image.BufferedImage getRegionImage()
Gives an image containing the regions grown thus far. Each pixel's grey level indicates the region to which it belongs. A value of 0 indicates that the pixel has not been assigned to any region.
Returns:
a reference to a greyscale BufferedImage.

getStatusImage

public java.awt.image.BufferedImage getStatusImage()
If status monitoring is enabled, this method gives a colour image that indicates the current status of the region growing process. Pixels unassigned to any region are transparent. Assigned pixels are opaque and are given one of two different colours, depending on the status of the pixel (internal to a region or 'active' and on the border of a region).
Returns:
a reference to a colour BufferedImage (RGB with alpha), or null if status monitoring is disabled.

setAssignedColour

public void setAssignedColour(java.awt.Color colour)
Sets the colour used to indicate pixels assigned to a region in the image returned by getStatusImage().
Parameters:
colour - new colour for assigned pixels

setBorderColour

public void setBorderColour(java.awt.Color colour)
Sets the colour used to indicate pixels on the border of a region in the image returned by getStatusImage().
Parameters:
colour - new colour for border pixels

getNumIterations

public int getNumIterations()
Returns:
number of iterations performed thus far.

isFinished

public boolean isFinished()
Indicates whether region growing is complete.
Returns:
true if regions have grown to the maximum extent possible, false otherwise.

isNotFinished

public boolean isNotFinished()
Indicates whether region growing is complete.
Returns:
true if regions have not yet grown to the maximum extent possible, false otherwise.

grow

public void grow()
Performs a single iteration of the region growing algorithm.

growToCompletion

public void growToCompletion()
Grows regions to their maximum extent.