Class 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 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.
      • 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

      • 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: