Class ClassificationWidgetEffect
- 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:
java.io.Serializable,WildMagic.LibGraphics.ObjectSystem.NameIdInterface,WildMagic.LibGraphics.ObjectSystem.StreamInterface
public class ClassificationWidgetEffect extends WildMagic.LibGraphics.Effects.TextureEffect implements java.io.SerializableThis 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringcomputeAlphaCircleGLSL computeAlpha function definition for the circle widgets:private static java.lang.StringcomputeAlphaSquareGLSL computeAlpha function definition for the square widgets:private static java.lang.StringcomputeAlphaTriangleGLSL computeAlpha function definition for the triangle widgets:private static java.lang.StringcomputeClosestPointGLSL support function definition for the triangle widgets:private static java.lang.StringintersectGLSL support function definition for the triangle widgets:private java.lang.Stringm_kCurrentTextCurrent GLSL code for the widget program.private WildMagic.LibGraphics.Rendering.Texturem_kLUTMapcolor look-up table Texture:private java.lang.Stringm_kLUTNamecolor look-up table name.private WildMagic.LibGraphics.Rendering.Texturem_kTextureTexture used in the histogram.private ClassificationWidgetStatem_kWidgetStateCurrent state of the widget encapsulated in the GLSL parameters needed for the Volume renderer GLSL program:private java.lang.StringmainPixelShader1First part of the GLSL code for the pixel shader program for all widgets:private java.lang.StringmainPixelShader2GLSL main code part 2 for all widget types.private java.lang.StringmainPixelShaderCircleGLSL function call for the circle widget:private java.lang.StringmainPixelShaderSquareGLSL function call for the square widget:private java.lang.StringmainPixelShaderTriangleGLSL function call for the triangle widget:private static java.lang.StringmultiHistogramFunctionscombined GLSL code for the histogram widgets:private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description ClassificationWidgetEffect(WildMagic.LibGraphics.Rendering.Texture kTexture, int type)Creates a new ClassificationWidgetEffect with the texture specified.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckProgramText()protected voidcomputeUniformVariables()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 java.lang.StringcreateProgramText()voiddispose()WildMagic.LibFoundation.Mathematics.ColorRGBAGetColor()Returns the color of the widget color transfer function.intGetLUTIndex()Returns the index of the color look-up table color map.static java.lang.StringgetMultiHistogramFunctions()Returns the combined GLSL code and support functions for the histogram widgets.ClassificationWidgetStategetState()Returns the current ClassificationWidgetState GLSL Shader program parameters.voidreadObject(java.io.ObjectInputStream in)Read this object from disk.voidSetAlpha(float fA)Sets the alpha value of the widget.voidsetBoundary(float fAlpha)Sets the contribution of the 2nd derivative to the volume rendering.voidSetCenter(float fX, float fY)Sets the Center of the widget for the GLSL program.voidSetColor(float fR, float fG, float fB, float fA)Sets the color of the widget color transfer function.voidSetLeftLine(float fX1, float fY1, float fX2, float fY2)Sets the left-line parameter to the GLSL Shader Program.voidSetLUT(WildMagic.LibGraphics.Rendering.Texture kMap, int index, boolean bReverse)voidSetMidLine(float fX1, float fY1, float fX2, float fY2)Sets the mid-line parameter to the GLSL Shader Program.voidSetRadius(float fRX, float fRY)voidSetRightLine(float fX1, float fY1, float fX2, float fY2)Sets the right-line parameter to the GLSL Shader Program.voidSetShift(float fX, float fY)voidsetState(ClassificationWidgetState kState)Sets the ClassificationWidgetState, representing the GLSL shader program parameters.voidUpdateColor()Updates the color in the GLSL shader program used to render the ClassificationWidget.voidwriteObject(java.io.ObjectOutputStream out)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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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 java.lang.String m_kLUTName
color look-up table name.
-
m_kLUTMap
private WildMagic.LibGraphics.Rendering.Texture m_kLUTMap
color look-up table Texture:
-
mainPixelShader1
private java.lang.String mainPixelShader1
First part of the GLSL code for the pixel shader program for all widgets:
-
mainPixelShaderTriangle
private java.lang.String mainPixelShaderTriangle
GLSL function call for the triangle widget:
-
mainPixelShaderSquare
private java.lang.String mainPixelShaderSquare
GLSL function call for the square widget:
-
mainPixelShaderCircle
private java.lang.String mainPixelShaderCircle
GLSL function call for the circle widget:
-
mainPixelShader2
private java.lang.String mainPixelShader2
GLSL main code part 2 for all widget types.
-
computeAlphaTriangle
private static java.lang.String computeAlphaTriangle
GLSL computeAlpha function definition for the triangle widgets:
-
computeAlphaSquare
private static java.lang.String computeAlphaSquare
GLSL computeAlpha function definition for the square widgets:
-
computeClosestPoint
private static java.lang.String computeClosestPoint
GLSL support function definition for the triangle widgets:
-
intersect
private static java.lang.String intersect
GLSL support function definition for the triangle widgets:
-
computeAlphaCircle
private static java.lang.String computeAlphaCircle
GLSL computeAlpha function definition for the circle widgets:
-
multiHistogramFunctions
private static java.lang.String multiHistogramFunctions
combined GLSL code for the histogram widgets:
-
m_kCurrentText
private java.lang.String m_kCurrentText
Current GLSL code for the widget program.
-
-
Method Detail
-
getMultiHistogramFunctions
public static java.lang.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:
disposein classWildMagic.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(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this object from disk.- Parameters:
in-- Throws:
java.io.IOExceptionjava.lang.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(java.io.ObjectOutputStream out) throws java.io.IOExceptionStream this object to disk.- Parameters:
out-- Throws:
java.io.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 java.lang.String createProgramText()
-
-