Package gov.nih.mipav.model.algorithms
Class AlgorithmWatershed
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmWatershed
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmWatershed extends AlgorithmBase
This program applies the watershed algorithm to the image. It assumes that the user has identified the starting watershed regions via VOIs. Future work might be to develop a algorithm that automatically identifies initial seed points and regions or possibly an automatic method that forms watersheds - see method at end of file (does not work yet);- Version:
- 1.1 March 11, 1998
- Author:
- Matthew J. McAuliffe, Ph.D. and Ray Lert, MD
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
AlgorithmWatershed.Seed
Simple class to hold seed point and basin (object label) value.
-
Field Summary
Fields Modifier and Type Field Description private static short
BOUNDARY
DOCUMENT ME!private ModelImage
energyImage
DOCUMENT ME!private boolean
entireImage
If true, ignore VOIs and process entire imageprivate static short
INITIAL
DOCUMENT ME!private static short
MASK
DOCUMENT ME!private java.util.Vector<AlgorithmWatershed.Seed>
seedVector
DOCUMENT ME!private float[]
sigmas
DOCUMENT ME!private static short
WSHED
DOCUMENT ME!-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmWatershed(ModelImage destImg, ModelImage srcImg, ModelImage gmImg, float[] sigmas, java.util.Vector<AlgorithmWatershed.Seed> seeds)
Constructs new watershed algorithm.AlgorithmWatershed(ModelImage destImg, ModelImage srcImg, ModelImage gmImg, float[] sigmas, java.util.Vector<AlgorithmWatershed.Seed> seeds, boolean entireImage)
Constructs new watershed algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calc2D()
Calculates the watershed intialized by the VOI regions.private void
calc3D()
Calculates the watershed intialized by the VOI regions.void
finalize()
Prepares this class for destruction.void
runAlgorithm()
Starts the program.void
setEnergyImage(ModelImage _energyImage)
This image is typically the gradient magnitude.void
setSeedVector(WildMagic.LibFoundation.Mathematics.Vector3f[] seedPoints)
Sets the seed vector.-
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
-
BOUNDARY
private static final short BOUNDARY
DOCUMENT ME!- See Also:
- Constant Field Values
-
MASK
private static final short MASK
DOCUMENT ME!- See Also:
- Constant Field Values
-
INITIAL
private static final short INITIAL
DOCUMENT ME!- See Also:
- Constant Field Values
-
WSHED
private static final short WSHED
DOCUMENT ME!- See Also:
- Constant Field Values
-
energyImage
private ModelImage energyImage
DOCUMENT ME!
-
seedVector
private java.util.Vector<AlgorithmWatershed.Seed> seedVector
DOCUMENT ME!
-
sigmas
private float[] sigmas
DOCUMENT ME!
-
entireImage
private boolean entireImage
If true, ignore VOIs and process entire image
-
-
Constructor Detail
-
AlgorithmWatershed
public AlgorithmWatershed(ModelImage destImg, ModelImage srcImg, ModelImage gmImg, float[] sigmas, java.util.Vector<AlgorithmWatershed.Seed> seeds)
Constructs new watershed algorithm.- Parameters:
destImg
- Image model where result image is to storedsrcImg
- Source image modelgmImg
- Gradient magnitude image (can be null)sigmas
- Gaussian's standard deviations in the each dimensionseeds
- Seed points for starting watershed
-
AlgorithmWatershed
public AlgorithmWatershed(ModelImage destImg, ModelImage srcImg, ModelImage gmImg, float[] sigmas, java.util.Vector<AlgorithmWatershed.Seed> seeds, boolean entireImage)
Constructs new watershed algorithm.- Parameters:
destImg
- Image model where result image is to storedsrcImg
- Source image modelgmImg
- Gradient magnitude image (can be null)sigmas
- Gaussian's standard deviations in the each dimensionseeds
- Seed points for starting watershedentireImage
- If true, ignore VOIs and process entire image
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
setEnergyImage
public void setEnergyImage(ModelImage _energyImage)
This image is typically the gradient magnitude. Peaks in this image (function ) are the watersheds boundaries- Parameters:
_energyImage
- the energy image (function)
-
setSeedVector
public void setSeedVector(WildMagic.LibFoundation.Mathematics.Vector3f[] seedPoints)
Sets the seed vector.- Parameters:
seedPoints
- The seed points.
-
calc2D
private void calc2D()
Calculates the watershed intialized by the VOI regions. The resultant watershed regions(basin) are labelled with an integer value. In addition, each region is separated by connected (8-way) watershed identifier of 1.
-
calc3D
private void calc3D()
Calculates the watershed intialized by the VOI regions. The resultant watershed regions(basin) are labelled with an integer value. In addition, each region is separated by connected (8-way) watershed identifier of 1.
-
-