Class OpenCLAlgorithmLaplacian
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.OpenCLAlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.OpenCL.filters.OpenCLAlgorithmLaplacian
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class OpenCLAlgorithmLaplacian extends OpenCLAlgorithmBase
OpenCL Algorithm computes the Laplacian of a 2D, 3D or 4D image.
-
-
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 float[]
GxxData
Storage location of the second derivative of the Gaussian in the X direction for the 3D kernel.private float[]
GxxData2D
Storage location of the second derivative of the Gaussian in the X direction for the 2D kernel.private float[]
GyyData
Storage location of the second derivative of the Gaussian in the Y direction for the 3D kernel.private float[]
GyyData2D
Storage location of the second derivative of the Gaussian in the Y direction for the 2D kernel.private float[]
GzzData
Storage location of the second derivative of the Gaussian in the Z direction for the 3D kernel.private int[]
kExtents_2D
Extents of the 2D kernel.private int[]
kExtents_3D
Extents of the 3D kernel.private int[]
kOrigins_2D
Origins of the 2D kernel.private int[]
kOrigins_3D
Origins of the 3D kernel.private float[]
sigmas
Standard deviations of the gaussian used to calculate the kernels.-
Fields inherited from class gov.nih.mipav.model.algorithms.OpenCLAlgorithmBase
cl, color, colorMask, contextLibrary, depth, device, entireImage, height, m_iDeviceType, m_kGL, openCLTypeLibrary, time, width
-
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 OpenCLAlgorithmLaplacian(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm object.OpenCLAlgorithmLaplacian(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, 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
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
laplacian25D()
2D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue.private void
laplacian3D(int time)
3D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue.void
laplacian4D()
Calls laplacian3D for each volume in the time series image.private void
laplacianSep25D()
private void
laplacianSep25DSlices()
private void
laplacianSep3D(int time)
private void
makeKernels2D()
Creates Gaussian derivative kernels.private void
makeKernels3D()
Creates Gaussian derivative kernels.void
runAlgorithm()
Starts the program.-
Methods inherited from class gov.nih.mipav.model.algorithms.OpenCLAlgorithmBase
checkError, getInt, getInts, getLong, getLongs, getMaxMemoryUsed, getString, getString, initCL, isOCLAvailable, readKernelFile, roundUp, saveImage, saveImage, setBlue, setGreen, setRed, setTime
-
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
-
amplificationFactor
private float amplificationFactor
An amplification factor greater than 1.0 causes this filter to act like a highpass filter.
-
GxxData2D
private float[] GxxData2D
Storage location of the second derivative of the Gaussian in the X direction for the 2D kernel.
-
GyyData2D
private float[] GyyData2D
Storage location of the second derivative of the Gaussian in the Y direction for the 2D kernel.
-
GxxData
private float[] GxxData
Storage location of the second derivative of the Gaussian in the X direction for the 3D kernel.
-
GyyData
private float[] GyyData
Storage location of the second derivative of the Gaussian in the Y direction for the 3D kernel.
-
GzzData
private float[] GzzData
Storage location of the second derivative of the Gaussian in the Z direction for the 3D kernel.
-
kExtents_2D
private int[] kExtents_2D
Extents of the 2D kernel.
-
kOrigins_2D
private int[] kOrigins_2D
Origins of the 2D kernel.
-
kExtents_3D
private int[] kExtents_3D
Extents of the 3D kernel.
-
kOrigins_3D
private int[] kOrigins_3D
Origins of the 3D kernel.
-
sigmas
private float[] sigmas
Standard deviations of the gaussian used to calculate the kernels.
-
-
Constructor Detail
-
OpenCLAlgorithmLaplacian
public OpenCLAlgorithmLaplacian(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, 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.
-
OpenCLAlgorithmLaplacian
public OpenCLAlgorithmLaplacian(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, boolean img25D, float ampFactor)
Constructs a Laplacian algorithm 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 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 classOpenCLAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
makeKernels2D
private void makeKernels2D()
Creates Gaussian derivative kernels.
-
makeKernels3D
private void makeKernels3D()
Creates Gaussian derivative kernels.
-
laplacian25D
private void laplacian25D()
2D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue. Run the Kernel and save the results into a new image.
-
laplacianSep25D
private void laplacianSep25D()
-
laplacianSep25DSlices
private void laplacianSep25DSlices()
-
laplacian3D
private void laplacian3D(int time)
3D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue. Run the Kernel and save the results into a new image.
-
laplacianSep3D
private void laplacianSep3D(int time)
-
laplacian4D
public void laplacian4D()
Calls laplacian3D for each volume in the time series image.
-
-