Package gov.nih.mipav.model.algorithms
Class AlgorithmEdgeLaplacianSep
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmEdgeLaplacianSep
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
Calculates the EdgeLap of an image at a scale defined by the user. This algorithm produces an edge map of the zero
crossings of the laplacian of the gaussian for 2D images and 2.5D images. This version uses the separable kernel
convolution algorithm (faster, but uses more memory).
If clearInflectionPoints is true, remove zero crossings which do not correspond to actual edges but to inflection
points instead. If a zero crossing is not a point of inflection, then in the direction perpendicular to the crossing
edge the sign of the simple central difference operator of the Gaussian of the image times the sign of the third-degree
central difference operator of the Gaussian of the image must be less than zero.
Reference: "Refining Edges Detected by a LoG Operator" by Fatih Ulupinar and Gerard Medioni, Computer Vision, Graphics,
and Image Processing, Vol. 51, 1990, pp. 275-298.
Note: From Design of FIR bilevel Laplacian-of-Gaussian filter by Soo-Chang Pei and Ji-Hwei Horng: "Wiejak showed that the LoG filter may be decomposed into the sum of two separable filters: LoG(X,Y) = -G"(x)*G(y) - G(x)*G"(y) where G and G" are the 1D Gaussian and the second derivative of the 1D Gaussian." The reference is J.S. Wiejak, H. Buxton, and B. F. Buxton, "Convolution with separable masks for early image processing", Computer Vision, Graphics, and Image Processing, 32, 1985, pp. 279-290. Results almost exactly match those of AlgorithmEdgeLaplacian.
Does not work with color images (neither does AlgorithmEdgeLaplacian).
- Version:
- 0.1 Aug 4, 2003
- Author:
- Evan McCreedy
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate booleanprivate booleanFlag, if true, indicates that the whole image should be processed.private float[]private float[]Storage location of the second derivative of the Gaussian in the X direction.private float[]Storage location of the second derivative of the Gaussian in the Y direction.private float[]Storage location of the second derivative of the Gaussian in the Z direction.private int[]Dimensionality of the kernel.static final intPerform zero crossing detection using the marching squares method.static final intMark negative areas of the laplacian image as edges (makes thicker edges - used in BSE).static final intPerform zero crossing detection using Matt's old method.private float[]Standard deviations of the gaussian used to calculate the kernels.private intThe type of zero crossing detection to use.private ModelImageMask(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, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmEdgeLaplacianSep(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D, boolean clearInflectionPoints) Creates a new AlgorithmEdgeLaplacianSep object. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcalcStoreInDest2D(int nImages, int detectionType) This function produces the EdgeLap of input image.private voidcalcStoreInDest3D(int detectionType) This function produces the EdgeLap of input image.calcZeroXMaskBitset(float[] buffer, int[] extents) Calculates the zero crossing mask of a 2D image and returns it as a BitSet buffer.voidfinalize()Prepares this class for destruction.static BitSetgenLevelMask(int xDim, int yDim, float[] buffer, float level, int detectionType) Generates a zero crossing mask for a 2D function sets a Bitset object to 1 where a zero crossing is detected.voidgenZeroXMask(int slice, float[] buffer, int detectionType) Generates a zero crossing mask for a 2D function.Accessor to return mask indicating zero crossings.private voidCreates Gaussian derivative kernels.private voidCreates Gaussian derivative kernels.voidStarts the program.voidsetZeroDetectionType(int type) Changes the type of zero crossing detection method used.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
-
MARCHING_SQUARES
public static final int MARCHING_SQUARESPerform zero crossing detection using the marching squares method.- See Also:
-
OLD_DETECTION
public static final int OLD_DETECTIONPerform zero crossing detection using Matt's old method.- See Also:
-
NEGATIVE_EDGES
public static final int NEGATIVE_EDGESMark negative areas of the laplacian image as edges (makes thicker edges - used in BSE).- See Also:
-
entireImage
private boolean entireImageFlag, if true, indicates that the whole image should be processed. If false only process the image over the mask areas. -
GxxData
private float[] GxxDataStorage location of the second derivative of the Gaussian in the X direction. -
GyyData
private float[] GyyDataStorage location of the second derivative of the Gaussian in the Y direction. -
GzzData
private float[] GzzDataStorage location of the second derivative of the Gaussian in the Z direction. -
kExtents
private int[] kExtentsDimensionality of the kernel. -
sigmas
private float[] sigmasStandard deviations of the gaussian used to calculate the kernels. -
zeroDetectionType
private int zeroDetectionTypeThe type of zero crossing detection to use. -
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. -
clearInflectionPoints
private boolean clearInflectionPoints -
clearedPoints
private int clearedPoints -
gaussBuffer
private float[] gaussBuffer
-
-
Constructor Details
-
AlgorithmEdgeLaplacianSep
public AlgorithmEdgeLaplacianSep(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D, boolean clearInflectionPoints) Creates a new AlgorithmEdgeLaplacianSep object.- Parameters:
destImg- image model where result image is to storedsrcImg- source image modelsigmas- Gaussian's standard deviations in the each dimensionmaskFlag- Flag that indicates that the EdgeLap 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.clearInflectionPoints- If true, do not set zero crossings corresponding to points of inflection
-
-
Method Details
-
genLevelMask
public static BitSet genLevelMask(int xDim, int yDim, float[] buffer, float level, int detectionType) Generates a zero crossing mask for a 2D function sets a Bitset object to 1 where a zero crossing is detected.- Parameters:
xDim- x dimension of imageyDim- y dimension of imagebuffer- array in which to find zero crossinglevel- level to generate zero crossings atdetectionType- the type of zero crossing method to use- Returns:
- Bitset representing zero crossings
-
calcZeroXMaskBitset
Calculates the zero crossing mask of a 2D image and returns it as a BitSet buffer.- Parameters:
buffer- the slice to work withextents- the extents of the image- Returns:
- BitSet buffer with mask set when a zero crossing is detected
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
genZeroXMask
public void genZeroXMask(int slice, float[] buffer, int detectionType) Generates a zero crossing mask for a 2D function. Sets a ModelImage to 255 if a zero crossing is detected.- Parameters:
slice- the slice of the volume which we are working on (0 if from 2D image)buffer- array in which to find zero crossingdetectionType- the type of zero crossing detection to perform
-
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:
runAlgorithmin classAlgorithmBase
-
setZeroDetectionType
public void setZeroDetectionType(int type) Changes the type of zero crossing detection method used.- Parameters:
type- the zero crossing method to use
-
calcStoreInDest2D
private void calcStoreInDest2D(int nImages, int detectionType) This function produces the EdgeLap of input image.- Parameters:
nImages- number of images on which to find zero crossings. 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.detectionType- the type of zero crossing detection to perform
-
calcStoreInDest3D
private void calcStoreInDest3D(int detectionType) This function produces the EdgeLap of input image.- Parameters:
detectionType- the type of zero crossing detection to perform
-
makeKernels2D
private void makeKernels2D()Creates Gaussian derivative kernels. -
makeKernels3D
private void makeKernels3D()Creates Gaussian derivative kernels.
-