Class AlgorithmRegionGrow

java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmRegionGrow
All Implemented Interfaces:
ActionListener, WindowListener, Runnable, EventListener

public class AlgorithmRegionGrow extends AlgorithmBase
Fills a region based on average intensity +or- standard deviation. A VOI is used to calc an intensity within the region. The region grows if the intensity is bounded by average +/- the standard deviation. The a new VOI should be generated but for now the image is filled with with a flood value.

If variableThresholds is true, upperDelta = initialValue of upperBound - value of seed point lowerDelta = Value of seed point - initialValue of lowerBound Each time a new pixel is added to the region recalculate the mean and standard deviation of the region mean = (sum of the pixel values)/(pixel number) standard deviation = ((Sum of the squared values - (sum of values)*(sum of values)/(pixel number))/(pixel number) Then recalculate upperBound and lowBound as: upperBound = initialValue + (1.0 - Math.min(0.8, stdDev/mean)) * upperDelta lowBound = initialValue - (1.0 - Math.min(0.8, stdDev/mean)) * lowerDelta upperBound cannot become higher than its initial value, but it can become lower than its initial value. lowBound cannot become lower than its initial value, but it can become higher than its initial value. That is, upperBound - lowBound cannot exceed its initial value, but it can become lower than its initial value. Adaptive thresholding is useful in preventing bleeding across smooth image gradients. Reference: Automatic Image-To-Map-Registration of Remote Sensing Data by Heiner Hild, Photogrammetric Week '01', D. Fritsch invalid input: '&' R. Spiller, Eds., Wichmann Verlag, Heidelberg, 2001.

Version:
0.5 Jan, 2000
Author:
Matthew J. McAuliffe, Ph.D.
  • Field Details

    • blueBuffer

      private float[] blueBuffer
      DOCUMENT ME!
    • c

      private double c
      DOCUMENT ME!
    • greenBuffer

      private float[] greenBuffer
      DOCUMENT ME!
    • growDialog

      private RegionGrowDialog growDialog
      DOCUMENT ME!
    • imageFrame

      private ViewJFrameImage imageFrame
    • mMean

      private double mMean
      DOCUMENT ME!
    • mRMean

      private double mRMean
      DOCUMENT ME!
    • mGMean

      private double mGMean
      DOCUMENT ME!
    • mBMean

      private double mBMean
      DOCUMENT ME!
    • paintMask

      private BitSet paintMask
      DOCUMENT ME!
    • redBuffer

      private float[] redBuffer
      DOCUMENT ME!
    • srcImage

      private ModelImage srcImage
      DOCUMENT ME!
    • varInverse

      private double[][] varInverse
      DOCUMENT ME!
  • Constructor Details

    • AlgorithmRegionGrow

      public AlgorithmRegionGrow(ModelImage srcImg, float _multiplier, float _floodValue)
      Creates a new AlgorithmRegionGrow object.
      Parameters:
      srcImg - source image model
      _multiplier - aaaaa
      _floodValue - aaaaa
    • AlgorithmRegionGrow

      public AlgorithmRegionGrow(ModelImage destImg, ModelImage srcImg, float _multiplier, float _floodValue)
      Creates a new AlgorithmRegionGrow object.
      Parameters:
      destImg - image model where result image is to stored
      srcImg - source image model
      _multiplier - placeholder
      _floodValue - placeholder
  • Method Details

    • finalize

      public void finalize()
      Prepares this class for destruction.
      Overrides:
      finalize in class AlgorithmBase
    • regionGrow2D

      public int regionGrow2D(BitSet paintMask, Point seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBound, float upperBound, int sizeLimit, float maxDistance, boolean variableThresholds)
      2D flood fill that forms a bitset(boolean) mask.
      Parameters:
      paintMask - mask used to indicated where region has grown
      seedPt - seed point for flood fill
      th -
      useVOI - use selected VOI for initial variance
      dp -
      growDialog - the RegionGrowDialog
      lowBound - lower bound of values which are included in the region
      upperBound - upper bound of values which are included in the region
      sizeLimit - stop region grow when objects exceeds size limit in pixels
      maxDistance - max distance from the seed point (in pixels) that the region is allowed to grow.
      variableThresholds - If true vary thresholds as region grows
      Returns:
      returns the area region
    • regionGrow2D

      public int regionGrow2D(BitSet paintMask, Point seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBoundR, float upperBoundR, float lowBoundG, float upperBoundG, float lowBoundB, float upperBoundB, int sizeLimit, float maxDistance)
      2D flood fill for color images that forms a bitset(boolean) mask.
      Parameters:
      paintMask - mask used to indicated where region has grown
      seedPt - seed point for flood fill
      th -
      useVOI - use selected VOI for initial variance
      dp -
      growDialog - the RegionGrowDialog
      lowBoundR - lower bound of red values which are included in the region
      upperBoundR - upper bound of red values which are included in the region
      lowBoundG - lower bound of green values which are included in the region
      upperBoundG - upper bound of green values which are included in the region
      lowBoundB - lower bound of blue values which are included in the region
      upperBoundB - upper bound of blue values which are included in the region
      sizeLimit - stop region grow when objects exceeds size limit in pixels
      maxDistance - max distance from the seed point (in pixels) that the region is allowed to grow.
      Returns:
      returns the area region
    • regionGrow3D

      public int regionGrow3D(BitSet paintMask, Point3D seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBound, float upperBound, int sizeLimit, float maxDistance, boolean variableThresholds, int timeSlice, CubeBounds regionBounds)
      3D flood fill that forms a bitset(boolean) mask.
      Parameters:
      paintMask - mask used to indicated where region has grown
      seedPt - seed point for flood fill
      th -
      useVOI - use selected VOI for initial variance
      dp -
      growDialog - the RegionGrowDialog
      lowBound - lower bound of values which are included in the region
      upperBound - upper bound of values which are included in the region
      sizeLimit - stop region grow when objects exceeds size limit in pixels
      maxDistance - max distance from the seed point (in pixels) that the region is allowed to grow.
      variableThresholds - If true vary thresholds as region grows
      timeSlice - timeSlice that will be used in a 4D image
      regionBounds - DOCUMENT ME!
      Returns:
      returns the volume region
    • regionGrow3D

      public int regionGrow3D(BitSet paintMask, Point3D seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBoundR, float upperBoundR, float lowBoundG, float upperBoundG, float lowBoundB, float upperBoundB, int sizeLimit, float maxDistance, int timeSlice, CubeBounds regionBounds)
      3D flood fill for color images that forms a bitset(boolean) mask.
      Parameters:
      paintMask - mask used to indicated where region has grown
      seedPt - seed point for flood fill
      th -
      useVOI - use selected VOI for initial variance
      dp -
      growDialog - the RegionGrowDialog
      lowBoundR - lower bound of red values which are included in the region
      upperBoundR - upper bound of red values which are included in the region
      lowBoundG - lower bound of green values which are included in the region
      upperBoundG - upper bound of green values which are included in the region
      lowBoundB - lower bound of blue values which are included in the region
      upperBoundB - upper bound of blue values which are included in the region
      sizeLimit - stop region grow when objects exceeds size limit in pixels
      maxDistance - max distance from the seed point (in pixels) that the region is allowed to grow.
      timeSlice - timeSlice that will be used in a 4D image
      regionBounds - DOCUMENT ME!
      Returns:
      returns the volume region
    • runAlgorithm

      public void runAlgorithm()
      Starts the program.
      Specified by:
      runAlgorithm in class AlgorithmBase
    • setNewThreshold

      public void setNewThreshold(float threshold, PaintGrowListener compImage, boolean dp)
      DOCUMENT ME!
      Parameters:
      threshold - DOCUMENT ME!
      compImage - DOCUMENT ME!
      dp -