Class AlgorithmLaplacian
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmLaplacian
-
- All Implemented Interfaces:
AlgorithmInterface
,java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmLaplacian extends AlgorithmBase implements AlgorithmInterface
Calculates the Laplacian of the gaussian of an image at a scale defined by the user.- Version:
- 0.1 Feb 11, 1998
- Author:
- Matthew J. McAuliffe, Ph.D. Reference for nonlinear Laplacian operator: "A Nonlinear Laplace Operator as Edge Detector in Noisy Edges" by Lucas J. Van Vliet and Ian T. Young, Computer Vision, Graphics, and Image Processing, Vol. 45, 1989, pp. 167-195.
-
-
Field Summary
Fields Modifier and Type Field Description private float
amplificationFactor
An amplification factor greater than 1.0 causes this filter to act like a highpass filter.private boolean
edgeImage
If true an edge map image should be produced.private boolean
entireImage
Flag, if true, indicates that the whole image should be processed.private float[]
GxxData
Storage location of the second derivative of the Gaussian in the X direction.private float[]
GyyData
Storage location of the second derivative of the Gaussian in the Y direction.private float[]
GzzData
Storage location of the second derivative of the Gaussian in the Z direction.private float
hiThres
Lower and upper threshold values used in the generation of the edge map.private int
kernelSize
private int[]
kExtents
Dimensionality of the kernel.private float
loThres
Lower and upper threshold values used in the generation of the edge map.private boolean
nonLinear
private int
operationType
private float[]
outputBufferX
private float[]
outputBufferY
private float[]
outputBufferZ
private float[]
sigmas
Standard deviations of the gaussian used to calculate the kernels.private static int
xOp
private static int
yOp
private static int
zOp
private ModelImage
zXMask
Mask(unsigned byte) of the zero-crossings of the Laplacian of the gaussian.-
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 AlgorithmLaplacian(ModelImage srcImg, boolean nonLinear, int kernelSize, float[] sigmas, boolean maskFlag, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.AlgorithmLaplacian(ModelImage srcImg, float[] sigmas, boolean[] objectBuffer, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.AlgorithmLaplacian(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.AlgorithmLaplacian(ModelImage destImg, ModelImage srcImg, boolean nonLinear, int kernelSize, float[] sigmas, boolean maskFlag, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
algorithmPerformed(AlgorithmBase algorithm)
Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).private void
calcInPlace2D(int nImages)
Calculates the Laplacian image and replaces the source image with the new image.private void
calcInPlace3D()
Calculates the Laplacian and replaces the source image with the new image.private void
calcStoreInDest2D(int nImages)
This function produces the Laplacian of input image.private void
calcStoreInDest3D()
This function produces the Laplacian of input image.void
finalize()
Prepares this class for destruction.static void
genLevelMask(int xDim, int yDim, float[] buffer, java.util.BitSet edgeImage, float level)
Generates a zero crossing mask for a 2D function sets a Bitset object to 1 is a zero crossing is detected.private void
genZeroXMask(float[] buffer)
Generates a zero crossing mask for a 2D function sets a ModelImage to 1 if a zero crossing is detected.ModelImage
getZeroXMask()
Accessor to return mask indicating zero crossings.private void
makeKernels2D()
Creates Gaussian derivative kernels.private void
makeKernels3D()
Creates Gaussian derivative kernels.void
runAlgorithm()
Starts the program.private void
runNonLinear()
void
setEdgeOptions(float loThres, float hiThres)
Call from dialog if you wish to produce edge image.-
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
-
xOp
private static final int xOp
- See Also:
- Constant Field Values
-
yOp
private static final int yOp
- See Also:
- Constant Field Values
-
zOp
private static final int zOp
- See Also:
- Constant Field Values
-
amplificationFactor
private float amplificationFactor
An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
-
edgeImage
private boolean edgeImage
If true an edge map image should be produced.
-
entireImage
private boolean entireImage
Flag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas.
-
nonLinear
private boolean nonLinear
-
kernelSize
private int kernelSize
-
GxxData
private float[] GxxData
Storage location of the second derivative of the Gaussian in the X direction.
-
GyyData
private float[] GyyData
Storage location of the second derivative of the Gaussian in the Y direction.
-
GzzData
private float[] GzzData
Storage location of the second derivative of the Gaussian in the Z direction.
-
kExtents
private int[] kExtents
Dimensionality of the kernel.
-
loThres
private float loThres
Lower and upper threshold values used in the generation of the edge map.
-
hiThres
private float hiThres
Lower and upper threshold values used in the generation of the edge map.
-
sigmas
private float[] sigmas
Standard deviations of the gaussian used to calculate the kernels.
-
zXMask
private ModelImage zXMask
Mask(unsigned byte) of the zero-crossings of the Laplacian of the gaussian. Non-zero value indicates edge. Zero in the mask image is background.
-
outputBufferX
private float[] outputBufferX
-
outputBufferY
private float[] outputBufferY
-
outputBufferZ
private float[] outputBufferZ
-
operationType
private int operationType
-
-
Constructor Detail
-
AlgorithmLaplacian
public AlgorithmLaplacian(ModelImage srcImg, float[] sigmas, boolean[] objectBuffer, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.- Parameters:
srcImg
- source image modelsigmas
- Gaussian's standard deviations in the each dimensionobjectBuffer
- array with true for object, false for backgroundimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.ampFactor
- An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
-
AlgorithmLaplacian
public AlgorithmLaplacian(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.- Parameters:
srcImg
- source image modelsigmas
- Gaussian's standard deviations in the each dimensionmaskFlag
- Flag that indicates that the Laplacian will be calculated for the whole image if equal to trueimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.ampFactor
- An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
-
AlgorithmLaplacian
public AlgorithmLaplacian(ModelImage srcImg, boolean nonLinear, int kernelSize, float[] sigmas, boolean maskFlag, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.- Parameters:
srcImg
- source image modelnonLinear
- If true, use nonlinear LaplaciankernelSize
- Used only with nonlinear Laplaciansigmas
- Gaussian's standard deviations in the each dimensionmaskFlag
- Flag that indicates that the Laplacian will be calculated for the whole image if equal to trueimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.ampFactor
- An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
-
AlgorithmLaplacian
public AlgorithmLaplacian(ModelImage destImg, ModelImage srcImg, boolean nonLinear, int kernelSize, float[] sigmas, boolean maskFlag, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image modelnonLinear
- If true, use nonlinear LaplaciankernelSize
- Used only with nonlinear Laplaciansigmas
- Gaussian's standard deviations in the each dimensionmaskFlag
- Flag that indicates that the Laplacian will be calculated for the whole image if equal to trueimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.ampFactor
- An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
-
-
Method Detail
-
genLevelMask
public static void genLevelMask(int xDim, int yDim, float[] buffer, java.util.BitSet edgeImage, float level)
Generates a zero crossing mask for a 2D function sets a Bitset object to 1 is a zero crossing is detected.- Parameters:
xDim
- X dimension lengthyDim
- Y dimension lengthbuffer
- array of data in which to find level crossingedgeImage
- edge map of level crossingslevel
- level of crossings to find (e.g. zero crossing of the Laplacian)
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
getZeroXMask
public ModelImage getZeroXMask()
Accessor to return mask indicating zero crossings.- Returns:
- ModelImage of zero crossings ( 2D function 1 = indicates zero crossing
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
runNonLinear
private void runNonLinear()
-
setEdgeOptions
public void setEdgeOptions(float loThres, float hiThres)
Call from dialog if you wish to produce edge image.- Parameters:
loThres
- DOCUMENT ME!hiThres
- DOCUMENT ME!
-
calcInPlace2D
private void calcInPlace2D(int nImages)
Calculates the Laplacian image and replaces the source image with the new image.- Parameters:
nImages
- number of images to be blurred. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.
-
calcInPlace3D
private void calcInPlace3D()
Calculates the Laplacian and replaces the source image with the new image.
-
calcStoreInDest2D
private void calcStoreInDest2D(int nImages)
This function produces the Laplacian of input image.- Parameters:
nImages
- number of images to be blurred. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.
-
calcStoreInDest3D
private void calcStoreInDest3D()
This function produces the Laplacian of input image.
-
genZeroXMask
private void genZeroXMask(float[] buffer)
Generates a zero crossing mask for a 2D function sets a ModelImage to 1 if a zero crossing is detected.- Parameters:
buffer
- array in which to find zero crossing
-
makeKernels2D
private void makeKernels2D()
Creates Gaussian derivative kernels.
-
makeKernels3D
private void makeKernels3D()
Creates Gaussian derivative kernels.
-
algorithmPerformed
public void algorithmPerformed(AlgorithmBase algorithm)
Description copied from interface:AlgorithmInterface
Called 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:
algorithmPerformed
in interfaceAlgorithmInterface
- Parameters:
algorithm
- the algorithm which has just completed
-
-