Class OpenCLAlgorithmDeconvolution
- 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.OpenCLAlgorithmDeconvolution
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class OpenCLAlgorithmDeconvolution extends OpenCLAlgorithmBase
OpenCL Algorithm computes Deconvolution for a 3D or 4D image.
-
-
Field Summary
Fields Modifier and Type Field Description static int
AVERAGE_DECON
Average deconvolution is based on the arithmetical mean of the two estimates from A and B separatelyprivate com.jogamp.opencl.CLBuffer<java.nio.FloatBuffer>
brightnessBuffer
buffer for storing the original maximum of the OpenCL bufferprivate int[]
colorMask
Color flags.private int
iterations
number of iterations in the deconvolution:static int
JOINT_DECON
Default caseprivate long
maxWorkSize
Maximum number of work items in a work group on OpenCL.private int
method
static int
MULTIPLICATION_DECON
Multiplication deconvolution is based on the geometrical mean of the two estimates from A and B separatelyprivate com.jogamp.opencl.CLKernel
reductionKernel
OpenCL reduction kernel, calculates the max of and OpenCL buffer.private com.jogamp.opencl.CLKernel
scaleKernel
OpenCL scale kernel, multiplies the image by buffer1[0] / buffer2[0], where all buffers are OpenCL buffers on the GPU / CPU.private float[]
sigmas
Standard deviations of the Gaussian used to calculate the kernels.private float[]
sigmasB
second sigma values for dual-deconvolutionprivate ModelImage
srcImageB
second ModelImage for dual-deconvolutionprivate float[]
sum
private com.jogamp.opencl.CLBuffer<java.nio.FloatBuffer>
sumBuffer
buffer for storing the current max of an OpenCL bufferprivate boolean
useConversion
when true, the sigma values are multiplied by: 1.0 / (2*Math.sqrt(2*Math.log(2))) before the gaussian is generated.-
Fields inherited from class gov.nih.mipav.model.algorithms.OpenCLAlgorithmBase
color, depth, entireImage, height, m_iDeviceType, m_kGL, 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 OpenCLAlgorithmDeconvolution(ModelImage srcImg, int method, float[] sigmas, boolean maskFlag, int iterations, boolean conversion)
New Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImg, int method, float[] sigmas, boolean maskFlag, int iterations, boolean conversion)
New Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImg, int method, float[] sigmas, boolean maskFlag, int iterations, boolean conversion, long deviceType)
New Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.OpenCLAlgorithmDeconvolution(ModelImage srcImgA, ModelImage srcImgB, int method, float[] sigmasA, float[] sigmasB, boolean maskFlag, int iterations, boolean conversion)
New Dual image Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImgA, ModelImage srcImgB, int method, float[] sigmasA, float[] sigmasB, boolean maskFlag, int iterations, boolean conversion)
New Dual image Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImgA, ModelImage srcImgB, int method, float[] sigmasA, float[] sigmasB, boolean maskFlag, int iterations, boolean conversion, long deviceType)
New Dual image Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
deconvolution4D()
Calls Deconvolution for each volume in the time series image.private void
deconvolutionSep3D_2(int time)
Single - Image deconvolutionprivate void
deconvolutionSep3D_Dual(int time)
Dual image deconvolution.void
finalize()
Prepares this class for destruction.private float[]
getKernel(float sigma)
Computes a 1D Gaussian kernel for the given sigma value.private long
getMaxMemoryUsed(float[] sigmas)
Determines the amount of memory used for the OpenCL buffers required for the gaussian kernels for the given sigmas.void
runAlgorithm()
Starts the program.-
Methods inherited from class gov.nih.mipav.model.algorithms.OpenCLAlgorithmBase
fillBuffer, fillBuffer, fillBuffer, fillBuffer, getMaxMemoryUsed, initCL, isOCLAvailable, readBuffer, readBuffer, readKernelFile, roundUp, 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
-
colorMask
private int[] colorMask
Color flags.
-
sigmas
private float[] sigmas
Standard deviations of the Gaussian used to calculate the kernels.
-
iterations
private int iterations
number of iterations in the deconvolution:
-
useConversion
private boolean useConversion
when true, the sigma values are multiplied by: 1.0 / (2*Math.sqrt(2*Math.log(2))) before the gaussian is generated.
-
reductionKernel
private com.jogamp.opencl.CLKernel reductionKernel
OpenCL reduction kernel, calculates the max of and OpenCL buffer.
-
scaleKernel
private com.jogamp.opencl.CLKernel scaleKernel
OpenCL scale kernel, multiplies the image by buffer1[0] / buffer2[0], where all buffers are OpenCL buffers on the GPU / CPU.
-
sumBuffer
private com.jogamp.opencl.CLBuffer<java.nio.FloatBuffer> sumBuffer
buffer for storing the current max of an OpenCL buffer
-
brightnessBuffer
private com.jogamp.opencl.CLBuffer<java.nio.FloatBuffer> brightnessBuffer
buffer for storing the original maximum of the OpenCL buffer
-
sum
private float[] sum
-
srcImageB
private ModelImage srcImageB
second ModelImage for dual-deconvolution
-
sigmasB
private float[] sigmasB
second sigma values for dual-deconvolution
-
maxWorkSize
private long maxWorkSize
Maximum number of work items in a work group on OpenCL.
-
JOINT_DECON
public static final int JOINT_DECON
Default case- See Also:
- Constant Field Values
-
AVERAGE_DECON
public static final int AVERAGE_DECON
Average deconvolution is based on the arithmetical mean of the two estimates from A and B separately- See Also:
- Constant Field Values
-
MULTIPLICATION_DECON
public static final int MULTIPLICATION_DECON
Multiplication deconvolution is based on the geometrical mean of the two estimates from A and B separately- See Also:
- Constant Field Values
-
method
private int method
-
-
Constructor Detail
-
OpenCLAlgorithmDeconvolution
public OpenCLAlgorithmDeconvolution(ModelImage srcImg, int method, float[] sigmas, boolean maskFlag, int iterations, boolean conversion)
New Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image. Overwrites the input image.- Parameters:
srcImg
-method
-sigmas
-maskFlag
-iterations
-conversion
-
-
OpenCLAlgorithmDeconvolution
public OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImg, int method, float[] sigmas, boolean maskFlag, int iterations, boolean conversion)
New Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image. Stores the output in the destImage.- Parameters:
destImg
-srcImg
-method
-sigmas
-maskFlag
-iterations
-conversion
-
-
OpenCLAlgorithmDeconvolution
public OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImg, int method, float[] sigmas, boolean maskFlag, int iterations, boolean conversion, long deviceType)
New Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image. Stores the output in the destImage. Enables the user to specify the device type (CL.CL_DEVICE_TYPE_GPU or CL.CL_DEVICE_TYPE_CPU)- Parameters:
destImg
-srcImg
-method
-sigmas
-maskFlag
-iterations
-conversion
-deviceType
-
-
OpenCLAlgorithmDeconvolution
public OpenCLAlgorithmDeconvolution(ModelImage srcImgA, ModelImage srcImgB, int method, float[] sigmasA, float[] sigmasB, boolean maskFlag, int iterations, boolean conversion)
New Dual image Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image. Overwrites the input imageA as output.- Parameters:
srcImgA
-srcImgB
-method
-sigmasA
-sigmasB
-maskFlag
-iterations
-conversion
-
-
OpenCLAlgorithmDeconvolution
public OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImgA, ModelImage srcImgB, int method, float[] sigmasA, float[] sigmasB, boolean maskFlag, int iterations, boolean conversion)
New Dual image Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image.- Parameters:
destImg
-srcImgA
-srcImgB
-method
-sigmasA
-sigmasB
-maskFlag
-iterations
-conversion
-
-
OpenCLAlgorithmDeconvolution
public OpenCLAlgorithmDeconvolution(ModelImage destImg, ModelImage srcImgA, ModelImage srcImgB, int method, float[] sigmasA, float[] sigmasB, boolean maskFlag, int iterations, boolean conversion, long deviceType)
New Dual image Deconvolution algorithm, applies the deconvolution based on the sigma values and iterations to the input image. Stores the output in the destImage. Enables the user to specify the device type (CL.CL_DEVICE_TYPE_GPU or CL.CL_DEVICE_TYPE_CPU)- Parameters:
destImg
-srcImgA
-srcImgB
-method
-sigmasA
-sigmasB
-maskFlag
-iterations
-conversion
-deviceType
-
-
-
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
-
deconvolution4D
private void deconvolution4D()
Calls Deconvolution for each volume in the time series image.
-
deconvolutionSep3D_2
private void deconvolutionSep3D_2(int time)
Single - Image deconvolution- Parameters:
time
-
-
deconvolutionSep3D_Dual
private void deconvolutionSep3D_Dual(int time)
Dual image deconvolution.- Parameters:
time
-
-
getKernel
private float[] getKernel(float sigma)
Computes a 1D Gaussian kernel for the given sigma value.- Parameters:
sigma
-- Returns:
-
getMaxMemoryUsed
private long getMaxMemoryUsed(float[] sigmas)
Determines the amount of memory used for the OpenCL buffers required for the gaussian kernels for the given sigmas.- Parameters:
sigmas
-- Returns:
-
-