Class AlgorithmFloodFill

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.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 Detail

      • dims

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

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

        private java.util.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 java.util.BitSet newMask
        DOCUMENT ME!
      • newShortMask

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

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

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

      • AlgorithmFloodFill

        public AlgorithmFloodFill​(java.util.BitSet mask,
                                  int[] dims,
                                  int mode,
                                  java.awt.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​(java.util.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 Detail

      • finalize

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

        public java.util.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 java.util.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 java.util.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
      • setBitSetMask

        public void setBitSetMask​(java.util.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​(java.awt.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