Class OpenCLAlgorithmBase

java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.OpenCLAlgorithmBase
All Implemented Interfaces:
ActionListener, WindowListener, Runnable, EventListener
Direct Known Subclasses:
OpenCLAlgorithmDeconvolution, OpenCLAlgorithmFFT, OpenCLAlgorithmGaussianBlur, OpenCLAlgorithmGradientMagnitude, OpenCLAlgorithmLaplacian, OpenCLAlgorithmMarchingCubes, OpenCLAlgorithmVolumeCrop, OpenCLAlgorithmVolumeNormals

public abstract class OpenCLAlgorithmBase extends AlgorithmBase
Abstract base class for implementing Algorithms in OpenCL. Extends AlgorithmBase.
  • Field Details

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

      private static final int platformIndex
      See Also:
    • 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 Details

    • OpenCLAlgorithmBase

      public OpenCLAlgorithmBase()
    • OpenCLAlgorithmBase

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

    • initCL

      protected void initCL(long iType, com.jogamp.opengl.GL3 gl)
    • 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)
    • 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 String readKernelFile(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:
    • fillBuffer

      public static void fillBuffer(FloatBuffer buffer, ModelImage img)
    • fillBuffer

      public static void fillBuffer(IntBuffer buffer, int[] img)
    • fillBuffer

      public static void fillBuffer(FloatBuffer buffer, ModelImage img, int offset)
    • fillBuffer

      public static void fillBuffer(FloatBuffer buffer, float[] img)
    • readBuffer

      public static void readBuffer(FloatBuffer buffer, ModelImage img)
    • readBuffer

      public static void readBuffer(FloatBuffer buffer, ModelImage img, int offset)
    • roundUp

      public static int roundUp(int groupSize, int globalSize)