Package gov.nih.mipav.model.algorithms
Class AlgorithmFloodFill
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.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 Summary
Fields Modifier and Type Field Description static short
BITSET
DOCUMENT ME!private int[]
dims
Dimensionality of the data.private short
floodValue
Flood value.private java.util.BitSet
mask
DOCUMENT ME!private int
mode
Indicates the type of result mask: BITSET or SHORT.private int
nDims
The number of dimensions.private java.util.BitSet
newMask
DOCUMENT ME!private short[]
newShortMask
Reference to short mask.private java.awt.Point
seed2DPt
Seed point for 2D datasets.private Point3D
seed3DPt
Seed point for 3D datasets.static short
SHORT
DOCUMENT ME!-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmFloodFill(java.util.BitSet mask, int[] dims, int mode, Point3D pt)
Stack based flood-fill for 2D and 3D images.AlgorithmFloodFill(java.util.BitSet mask, int[] dims, int mode, java.awt.Point pt)
Stack based flood-fill for 2D and 3D images.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for destruction.java.util.BitSet
floodFill2DBitSet()
2D flood fill that forms a binary(BitSet) mask.short[]
floodFill2DShort()
2D flood fill that forms a short mask.java.util.BitSet
floodFill3DBitSet()
3D flood fill that forms a binary(BitSet) mask.short[]
floodFill3DShort()
3D flood fill that forms a short mask.java.util.BitSet
getBitSetMask()
Gets the Mask image returned as a Java Bitset object.short[]
getShortMask()
Gets the mask image (array of short values).void
runAlgorithm()
Starts the program.void
setBitSetMask(java.util.BitSet mask)
Sets this classes BitSet mask to new mask.void
setFloodValue(short floodValue)
Sets the value to be placed in the flood region.void
setSeed2DPt(java.awt.Point seedPt)
Sets the seed point for the flood fill for a 2D image region grow.void
setSeed3DPt(Point3D seedPt)
Sets the point at which a the flood filling begins.void
setShortMask(short[] mask)
Sets this classes short mask to the new mask.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
BITSET
public static final short BITSET
DOCUMENT ME!- See Also:
- Constant Field Values
-
SHORT
public static final short SHORT
DOCUMENT ME!- See Also:
- Constant Field Values
-
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 filleddims
- dimensionality of maskmode
- BITSET or SHORT mode for result maskpt
- 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 filleddims
- dimensionality of maskmode
- BITSET or SHORT mode for result maskpt
- 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 classAlgorithmBase
-
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
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
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
-
-