Package gov.nih.mipav.model.algorithms
Class AlgorithmAutoSeedWatershed
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmAutoSeedWatershed
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmAutoSeedWatershed extends AlgorithmBase
This is a port of the file AutoSeedWatershed.cpp which calls openCV written by Ravimal Bandara. His web site is titled Image Segmentation using Unsupervised Watershed Algorithm with an Over-segmentation Reduction Technique. This code is written for 2D color images. In response to the question: Would it be possible to modify your code for use on black and white images? What changes would be necessary? Ravimal Bandara responded: Yes you can by creating a gray histogram instead of Hues Saturation histogram. But I am not sure about the accuracy due to the grayscale histograms are less discriminative compared to the colour histogram. His code is licensed under the Code Project Open License (CPOL). The formula for the Bhattacharyya distance for multivariate gaussian distributions is taken from "The Divergence and Bhattacharyya Distance Measures in Signal Selection" by Thomas Kailath, IEEE Transactions on Communication Technology" Vol. COM-15, No. 1, February, 1967, pp. 52-60.- Author:
- ilb
-
-
Field Summary
Fields Modifier and Type Field Description private ModelImage
distTransformed
private boolean
error
private ModelImage
grayImage
private double
maxDistance
private boolean
mergeSimilar
private float
scaleX
private float
scaleY
private int
segmentNumber
private ModelImage
thresholdImage
private ViewUserInterface
UI
-
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 AlgorithmAutoSeedWatershed(ModelImage destImg, ModelImage srcImg, float scaleX, float scaleY, boolean mergeSimilar, double maxDistance)
Constructs new watershed algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for destruction.private void
mergeSegments()
void
runAlgorithm()
Starts the program.private void
watershedSegment()
-
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
-
segmentNumber
private int segmentNumber
-
grayImage
private ModelImage grayImage
-
thresholdImage
private ModelImage thresholdImage
-
distTransformed
private ModelImage distTransformed
-
scaleX
private float scaleX
-
scaleY
private float scaleY
-
mergeSimilar
private boolean mergeSimilar
-
maxDistance
private double maxDistance
-
error
private boolean error
-
UI
private ViewUserInterface UI
-
-
Constructor Detail
-
AlgorithmAutoSeedWatershed
public AlgorithmAutoSeedWatershed(ModelImage destImg, ModelImage srcImg, float scaleX, float scaleY, boolean mergeSimilar, double maxDistance)
Constructs new watershed algorithm.- Parameters:
destImg
- Image model where result image is to storedsrcImg
- Source image modelscaleX
-scaleY
-mergeSimilar
-maxDistance
-
-
-
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
-
watershedSegment
private void watershedSegment()
-
mergeSegments
private void mergeSegments()
-
-