Class TriangleClassificationWidget
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.ClassificationWidget
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.TriangleClassificationWidget
-
- All Implemented Interfaces:
java.io.Serializable
public class TriangleClassificationWidget extends ClassificationWidget
This class implements a 2D Triangle-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 floatm_fCenterXCurrent parameterized coordinates for the center control point in X (used to maintain relative position when resizing the widget).private floatm_fCenterYCurrent parameterized coordinates for the center control point in Y (used to maintain relative position when resizing the widget).protected WildMagic.LibGraphics.SceneGraph.TriMeshm_kLeftSphereprivate static longserialVersionUID-
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 TriangleClassificationWidget(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 floatareaTwice(float ptAx, float ptAy, float ptBx, float ptBy, float ptCx, float ptCy)Determines which side of the line a point lies on, used for determining if a point is inside or outside a closed loop.private WildMagic.LibFoundation.Mathematics.Vector3fcomputeIntersect(WildMagic.LibFoundation.Mathematics.Vector3f p0, WildMagic.LibFoundation.Mathematics.Vector3f v0, WildMagic.LibFoundation.Mathematics.Vector3f p1, WildMagic.LibFoundation.Mathematics.Vector3f v1, boolean onLine)Computes the intersection between two lines.protected voidCreateTriangle(int iX, int iY, WildMagic.LibGraphics.Rendering.Texture kTexture)Creates the triangle widget and control points:private booleaninsideTri(float fX, float fY)Determines if the input position is inside the triangle widget.booleanPick(WildMagic.LibGraphics.Rendering.Renderer kRenderer, int iX, int iY)Abstract picking.voidprocessMouseDrag(int iX0ld, int iYOld, int iButton, int iX, int iY)private voidreadObject(java.io.ObjectInputStream in)Read this object from disk.protected voidScaleTriangle(int iX, int iY, int position, WildMagic.LibGraphics.SceneGraph.TriMesh sphere)Resizes the triangle using the lower-control point:voidsetPicked(boolean bPicked)Clears or sets the current picked object, sets the outline color to red when picked, blue when not selected.voidsetTexture(WildMagic.LibGraphics.Rendering.Texture kTexture)Sets the histogram Texture map for the widget shader effect.voidShiftMidTriangle(int iX, int iY)Move the middle-control point which controls the transfer function in the triangle:protected voidShiftTriangle(int iX, int iY)Shifts the triangle along the bottom edge of the 2D Histogram, using the bottom control-point.private voidupdateCenterXY(float fX, float fY)voidupdateDisplay()Updates the ShaderEffect parameters for this widget.private voidwriteObject(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).
-
m_kLeftSphere
protected WildMagic.LibGraphics.SceneGraph.TriMesh m_kLeftSphere
-
-
Constructor Detail
-
TriangleClassificationWidget
public TriangleClassificationWidget(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:ClassificationWidgetAbstract picking. Returns true if this widget, or one of it's control points was picked.- Specified by:
Pickin classClassificationWidgetiX- 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:
processMouseDragin 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:
setPickedin classClassificationWidget- Parameters:
bPicked- when true the widget is selected.
-
setTexture
public void setTexture(WildMagic.LibGraphics.Rendering.Texture kTexture)
Description copied from class:ClassificationWidgetSets the histogram Texture map for the widget shader effect.- Specified by:
setTexturein classClassificationWidget
-
ShiftMidTriangle
public void ShiftMidTriangle(int iX, int iY)Move the middle-control point which controls the transfer function in the triangle:- Parameters:
e- MouseEvent
-
updateCenterXY
private void updateCenterXY(float fX, float fY)
-
updateDisplay
public void updateDisplay()
Description copied from class:ClassificationWidgetUpdates the ShaderEffect parameters for this widget.- Specified by:
updateDisplayin classClassificationWidget
-
areaTwice
protected float areaTwice(float ptAx, float ptAy, float ptBx, float ptBy, float ptCx, float ptCy)Determines which side of the line a point lies on, used for determining if a point is inside or outside a closed loop.- Parameters:
ptAx-ptAy-ptBx-ptBy-ptCx-ptCy-- Returns:
-
CreateTriangle
protected void CreateTriangle(int iX, int iY, WildMagic.LibGraphics.Rendering.Texture kTexture)Creates the triangle widget and control points:- Parameters:
iX- mouse x-position in MouseEvent coordinates.iY- mouse y-position in MouseEvent coordinates.kTexName- 2D Histogram texture name.
-
ScaleTriangle
protected void ScaleTriangle(int iX, int iY, int position, WildMagic.LibGraphics.SceneGraph.TriMesh sphere)Resizes the triangle using the lower-control point:- Parameters:
e- MouseEvent
-
ShiftTriangle
protected void ShiftTriangle(int iX, int iY)Shifts the triangle along the bottom edge of the 2D Histogram, using the bottom control-point. Shift only moves the triangle to the left or right, not up or down.- Parameters:
e- MouseEvent
-
computeIntersect
private WildMagic.LibFoundation.Mathematics.Vector3f computeIntersect(WildMagic.LibFoundation.Mathematics.Vector3f p0, WildMagic.LibFoundation.Mathematics.Vector3f v0, WildMagic.LibFoundation.Mathematics.Vector3f p1, WildMagic.LibFoundation.Mathematics.Vector3f v1, boolean onLine)Computes the intersection between two lines.- Parameters:
p0- starting position of line 0.v0- line 0 direction vector.p1- starting position of line 1.v1- line 1 direction vector.- Returns:
- intersection point.
-
insideTri
private boolean insideTri(float fX, float fY)Determines if the input position is inside the triangle widget.- Parameters:
fX- x-position.fY- y-position.- Returns:
- true if inside the triangle, false otherwise.
-
readObject
private 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
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOExceptionStream this object to disk.- Parameters:
out-- Throws:
java.io.IOException
-
-