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:
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
FieldsModifier and TypeFieldDescriptionprivate static StringGLSL computeAlpha function definition for the circle widgets:private static StringGLSL computeAlpha function definition for the square widgets:private static StringGLSL computeAlpha function definition for the triangle widgets:private static StringGLSL support function definition for the triangle widgets:private static StringGLSL support function definition for the triangle widgets:private StringCurrent GLSL code for the widget program.private WildMagic.LibGraphics.Rendering.Texturecolor look-up table Texture:private Stringcolor look-up table name.private WildMagic.LibGraphics.Rendering.TextureTexture used in the histogram.private ClassificationWidgetStateCurrent state of the widget encapsulated in the GLSL parameters needed for the Volume renderer GLSL program:private StringFirst part of the GLSL code for the pixel shader program for all widgets:private StringGLSL main code part 2 for all widget types.private StringGLSL function call for the circle widget:private StringGLSL function call for the square widget:private StringGLSL function call for the triangle widget:private static Stringcombined GLSL code for the histogram widgets:private static final longFields inherited from class WildMagic.LibGraphics.Effects.ShaderEffect
m_iPassQuantity, m_kAlphaState, m_kCompiledPrograms, m_kPShader, m_kVShader -
Constructor Summary
ConstructorsConstructorDescriptionClassificationWidgetEffect(WildMagic.LibGraphics.Rendering.Texture kTexture, int type) Creates a new ClassificationWidgetEffect with the texture specified. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprotected voidComputes 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 Stringvoiddispose()WildMagic.LibFoundation.Mathematics.ColorRGBAGetColor()Returns the color of the widget color transfer function.intReturns the index of the color look-up table color map.static StringReturns the combined GLSL code and support functions for the histogram widgets.getState()Returns the current ClassificationWidgetState GLSL Shader program parameters.voidRead 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.voidUpdates the color in the GLSL shader program used to render the ClassificationWidget.voidStream this object to disk.Methods inherited from class WildMagic.LibGraphics.Effects.TextureEffect
GetDiskUsed, Link, Load, Register, Save, SaveStringsMethods 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, SetVShaderMethods inherited from class WildMagic.LibGraphics.Effects.Effect
DrawMethods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
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_kTextureTexture used in the histogram. -
m_kLUTName
color look-up table name. -
m_kLUTMap
private WildMagic.LibGraphics.Rendering.Texture m_kLUTMapcolor look-up table Texture: -
mainPixelShader1
First part of the GLSL code for the pixel shader program for all widgets: -
mainPixelShaderTriangle
GLSL function call for the triangle widget: -
mainPixelShaderSquare
GLSL function call for the square widget: -
mainPixelShaderCircle
GLSL function call for the circle widget: -
mainPixelShader2
GLSL main code part 2 for all widget types. -
computeAlphaTriangle
GLSL computeAlpha function definition for the triangle widgets: -
computeAlphaSquare
GLSL computeAlpha function definition for the square widgets: -
computeClosestPoint
GLSL support function definition for the triangle widgets: -
intersect
GLSL support function definition for the triangle widgets: -
computeAlphaCircle
GLSL computeAlpha function definition for the circle widgets: -
multiHistogramFunctions
combined GLSL code for the histogram widgets: -
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
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
Returns the current ClassificationWidgetState GLSL Shader program parameters.- Returns:
- the current ClassificationWidgetState GLSL Shader program parameters.
-
readObject
Read this object from disk.- Parameters:
in-- Throws:
IOExceptionClassNotFoundException
-
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
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
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
-