Class SquareClassificationWidget
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.ClassificationWidget
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.SquareClassificationWidget
-
- All Implemented Interfaces:
java.io.Serializable
public class SquareClassificationWidget extends ClassificationWidget
This class implements a 2D Square-shaped ClassficiationWidget. The code implements the rendering of the widget in the 2D Multi-histogram panel, as well as the user mouse-interaction with the widget. The parameters that define the widget are then passed to the Volume Renderer GLSL shader program and determine how the Volume is displayed. *- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private float
m_fCenterX
Current parameterized coordinates for the center control point in X (used to maintain relative position when resizing the widget).private float
m_fCenterY
Current parameterized coordinates for the center control point in Y (used to maintain relative position when resizing the widget).private static long
serialVersionUID
-
Fields inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.ClassificationWidget
BOTTOM_EDGE, LEFT_EDGE, m_iHeight, m_iWidth, m_kLowerSphere, m_kMiddleSphere, m_kMouseOffset, m_kOutline, m_kPicked, m_kTMax, m_kTMin, m_kUpperSphere, m_kWidget, m_kWidgetEfect, m_kWidgetMesh, m_kWidgetState, RIGHT_EDGE, SPHERE_RADIUS, TOP_EDGE
-
-
Constructor Summary
Constructors Constructor Description SquareClassificationWidget(int iX, int iY, WildMagic.LibFoundation.Mathematics.Vector2f kTMin, WildMagic.LibFoundation.Mathematics.Vector2f kTMax, WildMagic.LibGraphics.Rendering.Texture kTexture, int iWidth, int iHeight)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
CreateSquare(int iX, int iY, WildMagic.LibGraphics.Rendering.Texture kTexture)
Creates the square widget and control points:boolean
Pick(WildMagic.LibGraphics.Rendering.Renderer kRenderer, int iX, int iY)
Abstract picking.void
processMouseDrag(int iX0ld, int iYOld, int iButton, int iX, int iY)
private void
readObject(java.io.ObjectInputStream in)
Read this object from disk:protected void
ScaleRectangle(int iX, int iY, boolean bLower)
Scale the rectangle, based on the control pointsvoid
setPicked(boolean bPicked)
Clears or sets the current picked object, sets the outline color to red when picked, blue when not selected.void
setTexture(WildMagic.LibGraphics.Rendering.Texture kTexture)
Sets the histogram Texture map for the widget shader effect.private void
ShiftMid(int iX, int iY)
Moves the mid-line control-point.protected void
ShiftSquare(int iX, int iY)
Translate the square in the 2D Histogram panel.void
updateDisplay()
Updates the ShaderEffect parameters for this widget.private void
writeObject(java.io.ObjectOutputStream out)
Stream this object to disk.-
Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.ClassificationWidget
calcObjX, calcObjY, calcScreenX, calcScreenY, calcTCoordX, calcTCoordY, clearPicked, dispose, getCenter, getColor, getLUTIndex, getSavedWidgetState, getState, getType, getWidget, Pick, setAlpha, setBoundary, setColor, setLUT, setState
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_fCenterX
private float m_fCenterX
Current parameterized coordinates for the center control point in X (used to maintain relative position when resizing the widget).
-
m_fCenterY
private float m_fCenterY
Current parameterized coordinates for the center control point in Y (used to maintain relative position when resizing the widget).
-
-
Constructor Detail
-
SquareClassificationWidget
public SquareClassificationWidget(int iX, int iY, WildMagic.LibFoundation.Mathematics.Vector2f kTMin, WildMagic.LibFoundation.Mathematics.Vector2f kTMax, WildMagic.LibGraphics.Rendering.Texture kTexture, int iWidth, int iHeight)
- Parameters:
iX
- location in MouseEvent Coordinates.iY
- location in MouseEvent Coordinates.kTMin
- minimum texture coordinates for the 2D histogram, used for the image background. (Defaults 0-1)kTMax
- maximum texture coordinates for the 2D histogram, used for the image background. (Defaults 0-1)kTexName
- 2D Histogram texture name.iWidth
- canvas width (default 256)iHeight
- canvas height (default 256)
-
-
Method Detail
-
Pick
public boolean Pick(WildMagic.LibGraphics.Rendering.Renderer kRenderer, int iX, int iY)
Description copied from class:ClassificationWidget
Abstract picking. Returns true if this widget, or one of it's control points was picked.- Specified by:
Pick
in classClassificationWidget
iX
- current mouse x position (MouseEvent coordinates).iY
- current mouse y position (MouseEvent coordinates).- Returns:
- true if this widget or one of it's control points was picked.
-
processMouseDrag
public void processMouseDrag(int iX0ld, int iYOld, int iButton, int iX, int iY)
- Specified by:
processMouseDrag
in classClassificationWidget
- Parameters:
iX0ld
- old mouse x-position in MouseEvent coordinates.iYOld
- old mouse y-position in MouseEvent coordinates.iButton
- old mouse button.
-
setPicked
public void setPicked(boolean bPicked)
Clears or sets the current picked object, sets the outline color to red when picked, blue when not selected.- Overrides:
setPicked
in classClassificationWidget
- Parameters:
bPicked
- when true the widget is selected.
-
setTexture
public void setTexture(WildMagic.LibGraphics.Rendering.Texture kTexture)
Description copied from class:ClassificationWidget
Sets the histogram Texture map for the widget shader effect.- Specified by:
setTexture
in classClassificationWidget
-
updateDisplay
public void updateDisplay()
Description copied from class:ClassificationWidget
Updates the ShaderEffect parameters for this widget.- Specified by:
updateDisplay
in classClassificationWidget
-
CreateSquare
protected void CreateSquare(int iX, int iY, WildMagic.LibGraphics.Rendering.Texture kTexture)
Creates the square widget and control points:- Parameters:
iX
- mouse x-position in MouseEvent coordinates.iY
- mouse y-position in MouseEvent coordinates.kTexName
- 2D Histogram texture name.
-
ScaleRectangle
protected void ScaleRectangle(int iX, int iY, boolean bLower)
Scale the rectangle, based on the control points- Parameters:
e
- MouseEvent positionbLower
- when true the lower control point is being dragged, false when the upper control-point is dragged.
-
ShiftSquare
protected void ShiftSquare(int iX, int iY)
Translate the square in the 2D Histogram panel.- Parameters:
e
- MouseEvent
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
Read this object from disk:- Parameters:
in
-- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
ShiftMid
private void ShiftMid(int iX, int iY)
Moves the mid-line control-point. Repositions the mid-line of the transfer function inside this widget.- Parameters:
e
- MouseEvent
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
Stream this object to disk.- Parameters:
out
-- Throws:
java.io.IOException
-
-