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 classAlgorithmWatershed.SeedSimple class to hold seed point and basin (object label) value.
-
Field Summary
Fields Modifier and Type Field Description private static shortBOUNDARYDOCUMENT ME!private ModelImageenergyImageDOCUMENT ME!private booleanentireImageIf true, ignore VOIs and process entire imageprivate static shortINITIALDOCUMENT ME!private static shortMASKDOCUMENT ME!private java.util.Vector<AlgorithmWatershed.Seed>seedVectorDOCUMENT ME!private float[]sigmasDOCUMENT ME!private static shortWSHEDDOCUMENT 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 voidcalc2D()Calculates the watershed intialized by the VOI regions.private voidcalc3D()Calculates the watershed intialized by the VOI regions.voidfinalize()Prepares this class for destruction.voidrunAlgorithm()Starts the program.voidsetEnergyImage(ModelImage _energyImage)This image is typically the gradient magnitude.voidsetSeedVector(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:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithmin 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.
-
-