Class OpenCLAlgorithmBase

    • Field Detail

      • contextLibrary

        protected static java.util.Vector<org.jocl.cl_context> contextLibrary
      • openCLTypeLibrary

        protected static java.util.Vector<java.lang.Long> openCLTypeLibrary
      • cl

        protected org.jocl.cl_context cl
      • device

        protected org.jocl.cl_device_id device
      • isOCLAvailable

        private static boolean isOCLAvailable
      • isOCL_CPU_Available

        private static boolean isOCL_CPU_Available
      • isOCL_GPU_Available

        private static boolean isOCL_GPU_Available
      • wasOCLChecked

        private static boolean wasOCLChecked
      • width

        protected int width
      • height

        protected int height
      • depth

        protected int depth
      • time

        protected int time
      • color

        protected int color
      • colorMask

        protected int[] colorMask
        Color flags.
      • m_iDeviceType

        protected long m_iDeviceType
      • m_kGL

        protected com.jogamp.opengl.GL3 m_kGL
      • entireImage

        protected boolean entireImage
        Flag, if true, indicates that the whole image should be processed. If false only process the image over the mask areas.
    • Constructor Detail

      • OpenCLAlgorithmBase

        public OpenCLAlgorithmBase()
      • OpenCLAlgorithmBase

        public OpenCLAlgorithmBase​(ModelImage destImg,
                                   ModelImage srcImg,
                                   boolean entireImage,
                                   long type)
    • Method Detail

      • initCL

        protected void initCL​(long iType,
                              com.jogamp.opengl.GL3 gl)
      • initContextProperties

        private static void initContextProperties​(org.jocl.cl_context_properties contextProperties,
                                                  com.jogamp.opengl.GL gl)
        Initializes the given context properties so that they may be used to create an OpenCL context for the given GL object.
        Parameters:
        contextProperties - The context properties
        gl - The GL object
      • checkError

        protected void checkError​(int errcode)
        Checks the OpenCL error status.
        Parameters:
        errcode -
      • finalize

        public void finalize()
        Prepare this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • saveImage

        public void saveImage​(float[] data,
                              int time,
                              int zSlice,
                              boolean calcMinMax)
      • saveImage

        public void saveImage​(float[] data,
                              int time,
                              boolean calcMinMax)
      • isOCLAvailable

        public static boolean isOCLAvailable()
      • roundUp

        protected static long roundUp​(long groupSize,
                                      long globalSize)
      • getInt

        public static int getInt​(org.jocl.cl_device_id device,
                                 int paramName)
        Returns the value of the device info parameter with the given name
        Parameters:
        device - The device
        paramName - The parameter name
        Returns:
        The value
      • getInts

        public static int[] getInts​(org.jocl.cl_device_id device,
                                    int paramName,
                                    int numValues)
        Returns the values of the device info parameter with the given name
        Parameters:
        device - The device
        paramName - The parameter name
        numValues - The number of values
        Returns:
        The value
      • getLong

        public static long getLong​(org.jocl.cl_device_id device,
                                   int paramName)
        Returns the value of the device info parameter with the given name
        Parameters:
        device - The device
        paramName - The parameter name
        Returns:
        The value
      • getLongs

        public static long[] getLongs​(org.jocl.cl_device_id device,
                                      int paramName,
                                      int numValues)
        Returns the values of the device info parameter with the given name
        Parameters:
        device - The device
        paramName - The parameter name
        numValues - The number of values
        Returns:
        The value
      • getString

        public static java.lang.String getString​(org.jocl.cl_device_id device,
                                                 int paramName)
        Returns the value of the device info parameter with the given name
        Parameters:
        device - The device
        paramName - The parameter name
        Returns:
        The value
      • getString

        public static java.lang.String getString​(org.jocl.cl_platform_id platform,
                                                 int paramName)
        Returns the value of the platform info parameter with the given name
        Parameters:
        platform - The platform
        paramName - The parameter name
        Returns:
        The value
      • setBlue

        public void setBlue​(boolean flag)
        Sets the flag for the blue channel.
        Parameters:
        flag - if set to true then the blue channel is processed.
      • setGreen

        public void setGreen​(boolean flag)
        Sets the flag for the green channel.
        Parameters:
        flag - if set to true then the green channel is processed.
      • setRed

        public void setRed​(boolean flag)
        Sets the flag for the red channel.
        Parameters:
        flag - if set to true then the red channel is processed.
      • setTime

        public void setTime​(int timeSlice)
      • readKernelFile

        public static java.lang.String readKernelFile​(java.lang.String fileName)
        Helper function which reads the file with the given name and returns the contents of this file as a String. Will exit the application if the file can not be read.
        Parameters:
        fileName - The name of the file to read.
        Returns:
        The contents of the file
      • getMaxMemoryUsed

        protected long getMaxMemoryUsed​(int nBuffers,
                                        int elementCount,
                                        float[] sigmas)
        Determines the amount of memory used for the OpenCL buffers required for the gaussian kernels for the given sigmas. Plus the memory used for the nBuffers OpenCL buffers, each elementCount in size.
        Parameters:
        nBuffers - number of buffers
        elementCount - buffer size
        sigmas -
        Returns: