Class AlgorithmRegionGrow
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmRegionGrow
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmRegionGrow extends AlgorithmBase
Fills a region based on average intensity +or- standard deviation. A VOI is used to calc an intensity within the region. The region grows if the intensity is bounded by average +/- the standard deviation. The a new VOI should be generated but for now the image is filled with with a flood value.If variableThresholds is true, upperDelta = initialValue of upperBound - value of seed point lowerDelta = Value of seed point - initialValue of lowerBound Each time a new pixel is added to the region recalculate the mean and standard deviation of the region mean = (sum of the pixel values)/(pixel number) standard deviation = ((Sum of the squared values - (sum of values)*(sum of values)/(pixel number))/(pixel number) Then recalculate upperBound and lowBound as: upperBound = initialValue + (1.0 - Math.min(0.8, stdDev/mean)) * upperDelta lowBound = initialValue - (1.0 - Math.min(0.8, stdDev/mean)) * lowerDelta upperBound cannot become higher than its initial value, but it can become lower than its initial value. lowBound cannot become lower than its initial value, but it can become higher than its initial value. That is, upperBound - lowBound cannot exceed its initial value, but it can become lower than its initial value. Adaptive thresholding is useful in preventing bleeding across smooth image gradients. Reference: Automatic Image-To-Map-Registration of Remote Sensing Data by Heiner Hild, Photogrammetric Week '01', D. Fritsch & R. Spiller, Eds., Wichmann Verlag, Heidelberg, 2001.
- Version:
- 0.5 Jan, 2000
- Author:
- Matthew J. McAuliffe, Ph.D.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
blueBuffer
DOCUMENT ME!private double
c
DOCUMENT ME!private float[]
greenBuffer
DOCUMENT ME!private RegionGrowDialog
growDialog
DOCUMENT ME!private ViewJFrameImage
imageFrame
private double
mBMean
DOCUMENT ME!private double
mGMean
DOCUMENT ME!private double
mMean
DOCUMENT ME!private double
mRMean
DOCUMENT ME!private java.util.BitSet
paintMask
DOCUMENT ME!private float[]
redBuffer
DOCUMENT ME!private ModelImage
srcImage
DOCUMENT ME!private double[][]
varInverse
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, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmRegionGrow(ModelImage srcImg, float _multiplier, float _floodValue)
Creates a new AlgorithmRegionGrow object.AlgorithmRegionGrow(ModelImage destImg, ModelImage srcImg, float _multiplier, float _floodValue)
Creates a new AlgorithmRegionGrow object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for destruction.int
regionGrow2D(java.util.BitSet paintMask, java.awt.Point seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBoundR, float upperBoundR, float lowBoundG, float upperBoundG, float lowBoundB, float upperBoundB, int sizeLimit, float maxDistance)
2D flood fill for color images that forms a bitset(boolean) mask.int
regionGrow2D(java.util.BitSet paintMask, java.awt.Point seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBound, float upperBound, int sizeLimit, float maxDistance, boolean variableThresholds)
2D flood fill that forms a bitset(boolean) mask.int
regionGrow3D(java.util.BitSet paintMask, Point3D seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBoundR, float upperBoundR, float lowBoundG, float upperBoundG, float lowBoundB, float upperBoundB, int sizeLimit, float maxDistance, int timeSlice, CubeBounds regionBounds)
3D flood fill for color images that forms a bitset(boolean) mask.int
regionGrow3D(java.util.BitSet paintMask, Point3D seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBound, float upperBound, int sizeLimit, float maxDistance, boolean variableThresholds, int timeSlice, CubeBounds regionBounds)
3D flood fill that forms a bitset(boolean) mask.void
runAlgorithm()
Starts the program.void
setNewThreshold(float threshold, PaintGrowListener compImage, boolean dp)
DOCUMENT ME!-
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
-
blueBuffer
private float[] blueBuffer
DOCUMENT ME!
-
c
private double c
DOCUMENT ME!
-
greenBuffer
private float[] greenBuffer
DOCUMENT ME!
-
growDialog
private RegionGrowDialog growDialog
DOCUMENT ME!
-
imageFrame
private ViewJFrameImage imageFrame
-
mMean
private double mMean
DOCUMENT ME!
-
mRMean
private double mRMean
DOCUMENT ME!
-
mGMean
private double mGMean
DOCUMENT ME!
-
mBMean
private double mBMean
DOCUMENT ME!
-
paintMask
private java.util.BitSet paintMask
DOCUMENT ME!
-
redBuffer
private float[] redBuffer
DOCUMENT ME!
-
srcImage
private ModelImage srcImage
DOCUMENT ME!
-
varInverse
private double[][] varInverse
DOCUMENT ME!
-
-
Constructor Detail
-
AlgorithmRegionGrow
public AlgorithmRegionGrow(ModelImage srcImg, float _multiplier, float _floodValue)
Creates a new AlgorithmRegionGrow object.- Parameters:
srcImg
- source image model_multiplier
- aaaaa_floodValue
- aaaaa
-
AlgorithmRegionGrow
public AlgorithmRegionGrow(ModelImage destImg, ModelImage srcImg, float _multiplier, float _floodValue)
Creates a new AlgorithmRegionGrow object.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image model_multiplier
- placeholder_floodValue
- placeholder
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
regionGrow2D
public int regionGrow2D(java.util.BitSet paintMask, java.awt.Point seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBound, float upperBound, int sizeLimit, float maxDistance, boolean variableThresholds)
2D flood fill that forms a bitset(boolean) mask.- Parameters:
paintMask
- mask used to indicated where region has grownseedPt
- seed point for flood fillth
-useVOI
- use selected VOI for initial variancedp
-growDialog
- the RegionGrowDialoglowBound
- lower bound of values which are included in the regionupperBound
- upper bound of values which are included in the regionsizeLimit
- stop region grow when objects exceeds size limit in pixelsmaxDistance
- max distance from the seed point (in pixels) that the region is allowed to grow.variableThresholds
- If true vary thresholds as region grows- Returns:
- returns the area region
-
regionGrow2D
public int regionGrow2D(java.util.BitSet paintMask, java.awt.Point seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBoundR, float upperBoundR, float lowBoundG, float upperBoundG, float lowBoundB, float upperBoundB, int sizeLimit, float maxDistance)
2D flood fill for color images that forms a bitset(boolean) mask.- Parameters:
paintMask
- mask used to indicated where region has grownseedPt
- seed point for flood fillth
-useVOI
- use selected VOI for initial variancedp
-growDialog
- the RegionGrowDialoglowBoundR
- lower bound of red values which are included in the regionupperBoundR
- upper bound of red values which are included in the regionlowBoundG
- lower bound of green values which are included in the regionupperBoundG
- upper bound of green values which are included in the regionlowBoundB
- lower bound of blue values which are included in the regionupperBoundB
- upper bound of blue values which are included in the regionsizeLimit
- stop region grow when objects exceeds size limit in pixelsmaxDistance
- max distance from the seed point (in pixels) that the region is allowed to grow.- Returns:
- returns the area region
-
regionGrow3D
public int regionGrow3D(java.util.BitSet paintMask, Point3D seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBound, float upperBound, int sizeLimit, float maxDistance, boolean variableThresholds, int timeSlice, CubeBounds regionBounds)
3D flood fill that forms a bitset(boolean) mask.- Parameters:
paintMask
- mask used to indicated where region has grownseedPt
- seed point for flood fillth
-useVOI
- use selected VOI for initial variancedp
-growDialog
- the RegionGrowDialoglowBound
- lower bound of values which are included in the regionupperBound
- upper bound of values which are included in the regionsizeLimit
- stop region grow when objects exceeds size limit in pixelsmaxDistance
- max distance from the seed point (in pixels) that the region is allowed to grow.variableThresholds
- If true vary thresholds as region growstimeSlice
- timeSlice that will be used in a 4D imageregionBounds
- DOCUMENT ME!- Returns:
- returns the volume region
-
regionGrow3D
public int regionGrow3D(java.util.BitSet paintMask, Point3D seedPt, float th, boolean useVOI, boolean dp, RegionGrowDialog growDialog, float lowBoundR, float upperBoundR, float lowBoundG, float upperBoundG, float lowBoundB, float upperBoundB, int sizeLimit, float maxDistance, int timeSlice, CubeBounds regionBounds)
3D flood fill for color images that forms a bitset(boolean) mask.- Parameters:
paintMask
- mask used to indicated where region has grownseedPt
- seed point for flood fillth
-useVOI
- use selected VOI for initial variancedp
-growDialog
- the RegionGrowDialoglowBoundR
- lower bound of red values which are included in the regionupperBoundR
- upper bound of red values which are included in the regionlowBoundG
- lower bound of green values which are included in the regionupperBoundG
- upper bound of green values which are included in the regionlowBoundB
- lower bound of blue values which are included in the regionupperBoundB
- upper bound of blue values which are included in the regionsizeLimit
- stop region grow when objects exceeds size limit in pixelsmaxDistance
- max distance from the seed point (in pixels) that the region is allowed to grow.timeSlice
- timeSlice that will be used in a 4D imageregionBounds
- DOCUMENT ME!- Returns:
- returns the volume region
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
setNewThreshold
public void setNewThreshold(float threshold, PaintGrowListener compImage, boolean dp)
DOCUMENT ME!- Parameters:
threshold
- DOCUMENT ME!compImage
- DOCUMENT ME!dp
-
-
-