Class OpenCLAlgorithmGradientMagnitude
- 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.OpenCLAlgorithmGradientMagnitude
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class OpenCLAlgorithmGradientMagnitude extends OpenCLAlgorithmBase
OpenCL Algorithm computes the Gradient Magnitude of a 2D, 3D or 4D image.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
Gx2Data
Storage location of the first derivative of the Gaussian in the X direction for 2D images;private float[]
GxData
Storage location of the first derivative of the Gaussian in the X direction.private float[]
Gy2Data
Storage location of the first derivative of the Gaussian in the Y direction for 2D images;private float[]
GyData
Storage location of the first derivative of the Gaussian in the Y direction.private float[]
GzData
Storage location of the first derivative of the Gaussian in the Z direction.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 OpenCLAlgorithmGradientMagnitude(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, boolean img25D)
Creates a new AlgorithmGradientMagnitude object.OpenCLAlgorithmGradientMagnitude(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, boolean img25D)
Creates a new AlgorithmGradientMagnitude object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for destruction.private void
gradientMagnitude25D()
2D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue.void
gradientMagnitude3D(int time)
3D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue.private void
gradientMagnitude4D()
Calls gradientMagnitude3D for each volume in the time series.private void
gradientMagnitudeSep25D()
25D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue.private void
gradientMagnitudeSep25DSlices()
void
gradientMagnitudeSep3D(int time)
3D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue.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
-
Gx2Data
private float[] Gx2Data
Storage location of the first derivative of the Gaussian in the X direction for 2D images;
-
GxData
private float[] GxData
Storage location of the first derivative of the Gaussian in the X direction.
-
Gy2Data
private float[] Gy2Data
Storage location of the first derivative of the Gaussian in the Y direction for 2D images;
-
GyData
private float[] GyData
Storage location of the first derivative of the Gaussian in the Y direction.
-
GzData
private float[] GzData
Storage location of the first derivative of the Gaussian in the Z direction.
-
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
-
OpenCLAlgorithmGradientMagnitude
public OpenCLAlgorithmGradientMagnitude(ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, boolean img25D)
Creates a new AlgorithmGradientMagnitude object.- Parameters:
srcImg
- source image modelsigmas
- Gaussian standard deviations in each dimensionmaskFlag
- Flag, if true, indicates that the gradient magnitude will be calculated for the whole imageimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
-
OpenCLAlgorithmGradientMagnitude
public OpenCLAlgorithmGradientMagnitude(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean separable, boolean img25D)
Creates a new AlgorithmGradientMagnitude object.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image modelsigmas
- Gaussian standard deviations in each dimensionmaskFlag
- Flag, if true, indicates that the gradient magnitude will be calculated for the whole imageimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
-
-
Method Detail
-
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.
-
gradientMagnitude25D
private void gradientMagnitude25D()
2D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue. Run the Kernel and save the results into a new image.
-
gradientMagnitude3D
public void gradientMagnitude3D(int time)
3D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue. Run the Kernel and save the results into a new image.
-
gradientMagnitudeSep25D
private void gradientMagnitudeSep25D()
25D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue. Run the Kernel and save the results into a new image.
-
gradientMagnitudeSep25DSlices
private void gradientMagnitudeSep25DSlices()
-
gradientMagnitudeSep3D
public void gradientMagnitudeSep3D(int time)
3D Implementation: Create the OpenCL Buffers, Kernel, and CommandQueue. Run the Kernel and save the results into a new image.
-
gradientMagnitude4D
private void gradientMagnitude4D()
Calls gradientMagnitude3D for each volume in the time series.
-
-