Class AlgorithmFastMarching
- All Implemented Interfaces:
AlgorithmInterface,ActionListener,WindowListener,Runnable,EventListener
- Version:
- 0.1 March 6, 1998
- Author:
- Matthew J. McAuliffe, Ph.D.
This algorithm iteratively expands a contour to a boundary.
This version of the anisotropic diffusion equation is: dI/dt = div[g(normalized grad magnitude(image))* grad I], where g() is the edge stopping function. The original edge stopping function used was the Perona and Malik function: g(x) = 1/(1 + (x**2/k**2)). However, as outlined in "Robust Anisotropic Diffusion" by Michael J. Black, Guillermo Sapiro, David H. Marimont, and David Heeger, IEEE Transactions on Image Processing, Vol. 7, No. 3, March 1998, pp. 421-432, the Perona and Malik function gives outliers(large values of grad(image)) too much influence. Thus, the Perona and Malik function was replaced with the Tukey's biweight function: g(x) = 0.5 * [1 - (x/k)**2]**2 for abs(x) invalid input: '<'= k = 0 otherwise.
The normalized gradient magnitude of the image goes from 0 to 100. In the above equation I is a VOI intensity, where initially all the VOI area is assigned 100 and the rest of the image is assigned 0. The equation is discretized as: I(x,y,z,t+1) = I(x,y,z,t) + 0.25*g(normalized grad magnitude(image(x,y,z)))* (I(x+gradX,y+gradY,z+gradZ,t) - I(x,y,z,t)), where gradX, gradY, and gradZ are the normalized gradient measurements of I. The value of I is clamped to a maximum value of 100 and the value of I is not changed if either its value has fallen to be invalid input: '<'= 3 or the values of all 4 of its nearest neighbors are invalid input: '<'= 3. Note that the name AlgorithmLevelSet is misleading because the equation used is a version of the anisotropic diffusion equation and not a version of the level set equation given by Osher and Sethian: d(phi)/dt + F*|grad(phi)| = 0, given phi(x,y,z,t=0). For more information on the Anisotropic diffusion equation see: Geometry-Driven Diffusion in Computer Vision edited by Bart M. ter Haar Romeny, Chapter 3 on Anisotropic Diffusion by Pietro Perona, Takahiro Shiota, and Jitendra Malik, pages 73-92, Kluwer Academic Publishers, 1994.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate float[]DOCUMENT ME!private float[]Storage location of the first derivative of the Gaussian in the X direction.private float[]Storage location of the first derivative of the Gaussian in the Y direction.private float[]Storage location of the first derivative of the Gaussian in the Z direction.private intNumber of iterations of the diffusion.private int[]Dimensionality of the kernel.private floatControls the diffusion rate.private float[]DOCUMENT ME!private float[]Stores result of AlgorithmConvolverprivate float[]Standard deviations of the gaussian used to calculate the kernels.Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmFastMarching(ModelImage srcImg, float[] sigmas, int iter, float kValue) AnisotropicDiffusion. -
Method Summary
Modifier and TypeMethodDescriptionvoidalgorithmPerformed(AlgorithmBase algorithm) Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).private voidcalc2D()calc2D - calculates the diffused image and creates the new VOI for the original image.private voidcalc3D()calc3D - calculates the diffused image and creates the new VOI for the original image.voidcleanUp()DOCUMENT ME!voidfinalize()finalize - sets class storages arrays to null so that System.gc() can free the memory.private floatgetBiLinear(float[] imageBuffer, int xDim, float x, float y) getBiLinear - version of get that performs bi-linear interpoloation.private floatgetTriLinear(float[] imageBuffer, int xDim, int imageSliceSize, float x, float y, float z) getTriLinear - version of get that performs trilinear interpoloation.private voidmakeKernals2D - creates the derivative kernels used to calculate the gradient magnitude and kernel for the diffusion process.private voidmakeKernals3D - creates the derivative kernels used to calculate the gradient magnitude and kernel for the diffusion process.voidStarts the algorithm.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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
edgeImage
private float[] edgeImageDOCUMENT ME! -
GxData
private float[] GxDataStorage location of the first derivative of the Gaussian in the X direction. -
GyData
private float[] GyDataStorage location of the first derivative of the Gaussian in the Y direction. -
GzData
private float[] GzDataStorage location of the first derivative of the Gaussian in the Z direction. -
iterations
private int iterationsNumber of iterations of the diffusion. -
kExtents
private int[] kExtentsDimensionality of the kernel. -
kValue
private float kValueControls the diffusion rate. A large value causes this algorithms to act like gaussian smoothing and therefore diffuses across edges. K = small reduces blur across edges. Typical K = 10. -
levelImage
private float[] levelImageDOCUMENT ME! -
sigmas
private float[] sigmasStandard deviations of the gaussian used to calculate the kernels. -
outputBuffer
private float[] outputBufferStores result of AlgorithmConvolver
-
-
Constructor Details
-
AlgorithmFastMarching
AnisotropicDiffusion.- Parameters:
srcImg- reference to the source imagesigmas- sigmas used to describe the gaussian that is used in the calculation of the gradient magnitudeiter- number of iterations (t) of the diffusion equationkValue- K is a factor that controls the diffusion rate. A large value causes this algorithms to act like gaussian smoothing and therefore diffuses across edges. K = small reduces blur across edges. Typical K = 10;
-
-
Method Details
-
cleanUp
public void cleanUp()DOCUMENT ME! -
finalize
public void finalize()finalize - sets class storages arrays to null so that System.gc() can free the memory.- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()Starts the algorithm.- Specified by:
runAlgorithmin classAlgorithmBase
-
calc2D
private void calc2D()calc2D - calculates the diffused image and creates the new VOI for the original image. -
calc3D
private void calc3D()calc3D - calculates the diffused image and creates the new VOI for the original image. -
getBiLinear
private float getBiLinear(float[] imageBuffer, int xDim, float x, float y) getBiLinear - version of get that performs bi-linear interpoloation. Note - does NOT perform bounds checking- Parameters:
imageBuffer- buffer containing pixel dataxDim- x dimension offsetx- x coordinatey- y coordinate- Returns:
- DOCUMENT ME!
-
getTriLinear
private float getTriLinear(float[] imageBuffer, int xDim, int imageSliceSize, float x, float y, float z) getTriLinear - version of get that performs trilinear interpoloation.- Parameters:
imageBuffer- buffer containing pixel dataxDim- x dimension offsetimageSliceSize- DOCUMENT ME!x- x coordinatey- y coordinatez- z coordinate- Returns:
- DOCUMENT ME!
-
makeKernels2D
private void makeKernels2D()makeKernals2D - creates the derivative kernels used to calculate the gradient magnitude and kernel for the diffusion process. -
makeKernels3D
private void makeKernels3D()makeKernals3D - creates the derivative kernels used to calculate the gradient magnitude and kernel for the diffusion process. -
algorithmPerformed
Description copied from interface:AlgorithmInterfaceCalled after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.- Specified by:
algorithmPerformedin interfaceAlgorithmInterface- Parameters:
algorithm- the algorithm which has just completed
-