Class AlgorithmFloodFill

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

public class AlgorithmFloodFill extends AlgorithmBase
Stack based flood-fill for 2D and 3D images. The input is a binary (BitSet) object and produces a BitSet or short mask. A short mask allows for different label values for disconnected objects in a BitSet image. For example, in a binarized image of cells, each cell could be labeled(filled) with a separate value. However, a short mask uses 16X more memory than does the BitSet mask.
Version:
0.1 Jan 5, 1998
Author:
Matthew J. McAuliffe, Ph.D.
  • Field Details

    • BITSET

      public static final short BITSET
      DOCUMENT ME!
      See Also:
    • SHORT

      public static final short SHORT
      DOCUMENT ME!
      See Also:
    • dims

      private int[] dims
      Dimensionality of the data.
    • floodValue

      private short floodValue
      Flood value. Default in 1.
    • mask

      private BitSet mask
      DOCUMENT ME!
    • mode

      private int mode
      Indicates the type of result mask: BITSET or SHORT.
    • nDims

      private int nDims
      The number of dimensions.
    • newMask

      private BitSet newMask
      DOCUMENT ME!
    • newShortMask

      private short[] newShortMask
      Reference to short mask.
    • seed2DPt

      private Point seed2DPt
      Seed point for 2D datasets.
    • seed3DPt

      private Point3D seed3DPt
      Seed point for 3D datasets.
  • Constructor Details

    • AlgorithmFloodFill

      public AlgorithmFloodFill(BitSet mask, int[] dims, int mode, Point pt)
      Stack based flood-fill for 2D and 3D images.
      Parameters:
      mask - BitSet object that has the binary object(s) that needs to be filled
      dims - dimensionality of mask
      mode - BITSET or SHORT mode for result mask
      pt - seed point for the flood fill to begin for 2D image
    • AlgorithmFloodFill

      public AlgorithmFloodFill(BitSet mask, int[] dims, int mode, Point3D pt)
      Stack based flood-fill for 2D and 3D images.
      Parameters:
      mask - BitSet object that has the binary object(s) that needs to be filled
      dims - dimensionality of mask
      mode - BITSET or SHORT mode for result mask
      pt - seed point for the flood fill to begin for 3D image
  • Method Details

    • finalize

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

      public BitSet floodFill2DBitSet()
      2D flood fill that forms a binary(BitSet) mask.
      Returns:
      mask of flooded image
    • floodFill2DShort

      public short[] floodFill2DShort()
      2D flood fill that forms a short mask.
      Returns:
      mask of flooded image
    • floodFill3DBitSet

      public BitSet floodFill3DBitSet()
      3D flood fill that forms a binary(BitSet) mask.
      Returns:
      mask of flooded image
    • floodFill3DShort

      public short[] floodFill3DShort()
      3D flood fill that forms a short mask.
      Returns:
      mask of flooded image
    • getBitSetMask

      public BitSet getBitSetMask()
      Gets the Mask image returned as a Java Bitset object.
      Returns:
      BitSet mask of flooded image
    • getShortMask

      public short[] getShortMask()
      Gets the mask image (array of short values).
      Returns:
      short mask of flooded image
    • runAlgorithm

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

      public void setBitSetMask(BitSet mask)
      Sets this classes BitSet mask to new mask.
      Parameters:
      mask - sets BitSet mask
    • setFloodValue

      public void setFloodValue(short floodValue)
      Sets the value to be placed in the flood region.
      Parameters:
      floodValue - sets the flood-fill value used when generating a short type mask
    • setSeed2DPt

      public void setSeed2DPt(Point seedPt)
      Sets the seed point for the flood fill for a 2D image region grow.
      Parameters:
      seedPt - sets 2D seed point for beginning of flood fill
    • setSeed3DPt

      public void setSeed3DPt(Point3D seedPt)
      Sets the point at which a the flood filling begins.
      Parameters:
      seedPt - sets 3D seed point for beginning of flood fill
    • setShortMask

      public void setShortMask(short[] mask)
      Sets this classes short mask to the new mask.
      Parameters:
      mask - sets short mask