java.lang.Object
WildMagic.LibGraphics.ObjectSystem.GraphicsObject
WildMagic.LibGraphics.Effects.Effect
WildMagic.LibGraphics.Effects.ShaderEffect
WildMagic.LibGraphics.Effects.TextureEffect
gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.ClassificationWidgetEffect
All Implemented Interfaces:
Serializable, WildMagic.LibGraphics.ObjectSystem.NameIdInterface, WildMagic.LibGraphics.ObjectSystem.StreamInterface

public class ClassificationWidgetEffect extends WildMagic.LibGraphics.Effects.TextureEffect implements Serializable
This class sets up and communicates with the GLSL shader program used to render the interior of the widget in the multi-histogram panel. The parameters that control how the widget is rendered in the multi-histogram panel are also used to determine how the widget is applied to the volume rendered data in the GLSL volume renderer shader program. Those parameters are encapsulated in the ClassificationWidgetState class which is used to pass the information on to the volume render GLSL program. This class sets up the histogram tool GLSL shader programs for rendering the widgets directly.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static String
    GLSL computeAlpha function definition for the circle widgets:
    private static String
    GLSL computeAlpha function definition for the square widgets:
    private static String
    GLSL computeAlpha function definition for the triangle widgets:
    private static String
    GLSL support function definition for the triangle widgets:
    private static String
    GLSL support function definition for the triangle widgets:
    private String
    Current GLSL code for the widget program.
    private WildMagic.LibGraphics.Rendering.Texture
    color look-up table Texture:
    private String
    color look-up table name.
    private WildMagic.LibGraphics.Rendering.Texture
    Texture used in the histogram.
    Current state of the widget encapsulated in the GLSL parameters needed for the Volume renderer GLSL program:
    private String
    First part of the GLSL code for the pixel shader program for all widgets:
    private String
    GLSL main code part 2 for all widget types.
    private String
    GLSL function call for the circle widget:
    private String
    GLSL function call for the square widget:
    private String
    GLSL function call for the triangle widget:
    private static String
    combined GLSL code for the histogram widgets:
    private static final long
     

    Fields inherited from class WildMagic.LibGraphics.Effects.ShaderEffect

    m_iPassQuantity, m_kAlphaState, m_kCompiledPrograms, m_kPShader, m_kVShader
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClassificationWidgetEffect(WildMagic.LibGraphics.Rendering.Texture kTexture, int type)
    Creates a new ClassificationWidgetEffect with the texture specified.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
     
    protected void
    Computes the input parameters to the GLSL shader program based on the ClassificationWidgetState and passes them to the program to render the widget in the multi-histogram panel.
    private String
     
    void
     
    WildMagic.LibFoundation.Mathematics.ColorRGBA
    Returns the color of the widget color transfer function.
    int
    Returns the index of the color look-up table color map.
    static String
    Returns the combined GLSL code and support functions for the histogram widgets.
    Returns the current ClassificationWidgetState GLSL Shader program parameters.
    void
    Read this object from disk.
    void
    SetAlpha(float fA)
    Sets the alpha value of the widget.
    void
    setBoundary(float fAlpha)
    Sets the contribution of the 2nd derivative to the volume rendering.
    void
    SetCenter(float fX, float fY)
    Sets the Center of the widget for the GLSL program.
    void
    SetColor(float fR, float fG, float fB, float fA)
    Sets the color of the widget color transfer function.
    void
    SetLeftLine(float fX1, float fY1, float fX2, float fY2)
    Sets the left-line parameter to the GLSL Shader Program.
    void
    SetLUT(WildMagic.LibGraphics.Rendering.Texture kMap, int index, boolean bReverse)
     
    void
    SetMidLine(float fX1, float fY1, float fX2, float fY2)
    Sets the mid-line parameter to the GLSL Shader Program.
    void
    SetRadius(float fRX, float fRY)
     
    void
    SetRightLine(float fX1, float fY1, float fX2, float fY2)
    Sets the right-line parameter to the GLSL Shader Program.
    void
    SetShift(float fX, float fY)
     
    void
    Sets the ClassificationWidgetState, representing the GLSL shader program parameters.
    void
    Updates the color in the GLSL shader program used to render the ClassificationWidget.
    void
    Stream this object to disk.

    Methods inherited from class WildMagic.LibGraphics.Effects.TextureEffect

    GetDiskUsed, Link, Load, Register, Save, SaveStrings

    Methods inherited from class WildMagic.LibGraphics.Effects.ShaderEffect

    GetAllObjectsByName, GetBlending, GetCProgram, GetObjectByID, GetObjectByName, GetPassQuantity, GetPProgram, GetSamplerInformation, GetTexture, GetTexture, GetTextureQuantity, GetVProgram, LoadPrograms, LoadResources, OnLoadPrograms, OnReleasePrograms, ReleasePrograms, ReleaseResources, RestoreGlobalState, SetCProgram, SetDefaultAlphaState, SetGlobalState, SetPassQuantity, SetPShader, SetVShader

    Methods inherited from class WildMagic.LibGraphics.Effects.Effect

    Draw

    Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject

    GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • m_kWidgetState

      private ClassificationWidgetState m_kWidgetState
      Current state of the widget encapsulated in the GLSL parameters needed for the Volume renderer GLSL program:
    • m_kTexture

      private WildMagic.LibGraphics.Rendering.Texture m_kTexture
      Texture used in the histogram.
    • m_kLUTName

      private String m_kLUTName
      color look-up table name.
    • m_kLUTMap

      private WildMagic.LibGraphics.Rendering.Texture m_kLUTMap
      color look-up table Texture:
    • mainPixelShader1

      private String mainPixelShader1
      First part of the GLSL code for the pixel shader program for all widgets:
    • mainPixelShaderTriangle

      private String mainPixelShaderTriangle
      GLSL function call for the triangle widget:
    • mainPixelShaderSquare

      private String mainPixelShaderSquare
      GLSL function call for the square widget:
    • mainPixelShaderCircle

      private String mainPixelShaderCircle
      GLSL function call for the circle widget:
    • mainPixelShader2

      private String mainPixelShader2
      GLSL main code part 2 for all widget types.
    • computeAlphaTriangle

      private static String computeAlphaTriangle
      GLSL computeAlpha function definition for the triangle widgets:
    • computeAlphaSquare

      private static String computeAlphaSquare
      GLSL computeAlpha function definition for the square widgets:
    • computeClosestPoint

      private static String computeClosestPoint
      GLSL support function definition for the triangle widgets:
    • intersect

      private static String intersect
      GLSL support function definition for the triangle widgets:
    • computeAlphaCircle

      private static String computeAlphaCircle
      GLSL computeAlpha function definition for the circle widgets:
    • multiHistogramFunctions

      private static String multiHistogramFunctions
      combined GLSL code for the histogram widgets:
    • m_kCurrentText

      private String m_kCurrentText
      Current GLSL code for the widget program.
  • Constructor Details

    • ClassificationWidgetEffect

      public ClassificationWidgetEffect(WildMagic.LibGraphics.Rendering.Texture kTexture, int type)
      Creates a new ClassificationWidgetEffect with the texture specified.
      Parameters:
      kTexture - input histogram Texture.
      type - Classification widget type.
  • Method Details

    • getMultiHistogramFunctions

      public static String getMultiHistogramFunctions()
      Returns the combined GLSL code and support functions for the histogram widgets. This code is also used in the GLSL programs for the volume renderer.
      Returns:
    • dispose

      public void dispose()
      Overrides:
      dispose in class WildMagic.LibGraphics.Effects.ShaderEffect
    • GetColor

      public WildMagic.LibFoundation.Mathematics.ColorRGBA GetColor()
      Returns the color of the widget color transfer function.
      Returns:
      the color of the widget color transfer function.
    • GetLUTIndex

      public int GetLUTIndex()
      Returns the index of the color look-up table color map.
      Returns:
      the index of the color look-up table color map.
    • getState

      public ClassificationWidgetState getState()
      Returns the current ClassificationWidgetState GLSL Shader program parameters.
      Returns:
      the current ClassificationWidgetState GLSL Shader program parameters.
    • readObject

      public void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
      Read this object from disk.
      Parameters:
      in -
      Throws:
      IOException
      ClassNotFoundException
    • SetAlpha

      public void SetAlpha(float fA)
      Sets the alpha value of the widget.
      Parameters:
      fAlpha -
    • setBoundary

      public void setBoundary(float fAlpha)
      Sets the contribution of the 2nd derivative to the volume rendering.
      Parameters:
      fAlpha - the contribution of the 2nd derivative to the volume rendering.
    • SetCenter

      public void SetCenter(float fX, float fY)
      Sets the Center of the widget for the GLSL program.
      Parameters:
      fX -
      fY -
    • SetColor

      public void SetColor(float fR, float fG, float fB, float fA)
      Sets the color of the widget color transfer function.
      Parameters:
      the - color of the widget color transfer function.
    • SetLeftLine

      public void SetLeftLine(float fX1, float fY1, float fX2, float fY2)
      Sets the left-line parameter to the GLSL Shader Program.
      Parameters:
      fX1 - bottom x-coordinate in Texture Coordinates.
      fY1 - bottom y-coordinate in Texture Coordinates.
      fX2 - top x-coordinate in Texture Coordinates.
      fY2 - top y-coordinate in Texture Coordinates.
    • SetLUT

      public void SetLUT(WildMagic.LibGraphics.Rendering.Texture kMap, int index, boolean bReverse)
    • SetMidLine

      public void SetMidLine(float fX1, float fY1, float fX2, float fY2)
      Sets the mid-line parameter to the GLSL Shader Program.
      Parameters:
      fX1 - bottom x-coordinate in Texture Coordinates.
      fY1 - bottom y-coordinate in Texture Coordinates.
      fX2 - top x-coordinate in Texture Coordinates.
      fY2 - top y-coordinate in Texture Coordinates.
    • SetRadius

      public void SetRadius(float fRX, float fRY)
    • SetRightLine

      public void SetRightLine(float fX1, float fY1, float fX2, float fY2)
      Sets the right-line parameter to the GLSL Shader Program.
      Parameters:
      fX1 - bottom x-coordinate in Texture Coordinates.
      fY1 - bottom y-coordinate in Texture Coordinates.
      fX2 - top x-coordinate in Texture Coordinates.
      fY2 - top y-coordinate in Texture Coordinates.
    • SetShift

      public void SetShift(float fX, float fY)
    • setState

      public void setState(ClassificationWidgetState kState)
      Sets the ClassificationWidgetState, representing the GLSL shader program parameters.
      Parameters:
      kState - ClassificationWidgetState, representing the GLSL shader program parameters.
    • UpdateColor

      public void UpdateColor()
      Updates the color in the GLSL shader program used to render the ClassificationWidget.
    • writeObject

      public void writeObject(ObjectOutputStream out) throws IOException
      Stream this object to disk.
      Parameters:
      out -
      Throws:
      IOException
    • computeUniformVariables

      protected void computeUniformVariables()
      Computes the input parameters to the GLSL shader program based on the ClassificationWidgetState and passes them to the program to render the widget in the multi-histogram panel.
    • checkProgramText

      private void checkProgramText()
    • createProgramText

      private String createProgramText()