Class CircleClassificationWidget
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.ClassificationWidget
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.CircleClassificationWidget
-
- All Implemented Interfaces:
java.io.Serializable
public class CircleClassificationWidget extends ClassificationWidget
Creates the circle widget for the multi-histogram interface. The circle consists of two control points. One controls the radius and eccentricity of the circle/ellipse. The second control point centers the maximum color value within the circle/ellipse.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private float
m_fCenterScale
Distance scale used to position the center sphere control-point out from the center of the circle/ellipse.private float
m_fRadiusX
The radius of the circle in the x-direction.private float
m_fRadiusY
The radius of the circle in the y-direction.private WildMagic.LibFoundation.Mathematics.Vector2f
m_kCenterDir
Direction used to position the center sphere control-point out from the center of the circle/ellipse.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 CircleClassificationWidget(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
CreateCircle(int iX, int iY, WildMagic.LibGraphics.Rendering.Texture kTexture)
Creates the circle widget and control point:protected WildMagic.LibFoundation.Mathematics.Vector2f
getCenter()
Calculate and return the current center of the widget in world coordinates.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 a new CircleClassificationWidget from the input stream.private void
scaleCircle(WildMagic.LibFoundation.Mathematics.Vector2f kCurrentCenter, float diffX, float diffY)
Scale the circle based on the current center and the difference between the current center and the mouse position.protected void
ScaleCircle(int iX, int iY)
scale the circle based on the mouse position.void
setPicked(WildMagic.LibGraphics.Rendering.Renderer kRenderer, 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
shiftCircle(WildMagic.LibFoundation.Mathematics.Vector2f kCurrentCenter, float fDiffX, float fDiffY)
Translate the circle based on the current center and the difference between the current center and the mouse position.protected void
ShiftCircle(int iX, int iY)
Translate the circle in the 2D Histogram panel.private void
ShiftMid(int iX, int iY)
Moves the mid-line control-point.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, getColor, getLUTIndex, getSavedWidgetState, getState, getType, getWidget, Pick, setAlpha, setBoundary, setColor, setLUT, setPicked, setState
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_kCenterDir
private WildMagic.LibFoundation.Mathematics.Vector2f m_kCenterDir
Direction used to position the center sphere control-point out from the center of the circle/ellipse.
-
m_fCenterScale
private float m_fCenterScale
Distance scale used to position the center sphere control-point out from the center of the circle/ellipse.
-
m_fRadiusX
private float m_fRadiusX
The radius of the circle in the x-direction.
-
m_fRadiusY
private float m_fRadiusY
The radius of the circle in the y-direction.
-
-
Constructor Detail
-
CircleClassificationWidget
public CircleClassificationWidget(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)kTexture
- 2D Histogram Texture.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(WildMagic.LibGraphics.Rendering.Renderer kRenderer, boolean bPicked)
Clears or sets the current picked object, sets the outline color to red when picked, blue when not selected.- 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
-
CreateCircle
protected void CreateCircle(int iX, int iY, WildMagic.LibGraphics.Rendering.Texture kTexture)
Creates the circle widget and control point:- Parameters:
iX
- mouse x-position in MouseEvent coordinates.iY
- mouse y-position in MouseEvent coordinates.kTexName
- 2D Histogram texture name.
-
getCenter
protected WildMagic.LibFoundation.Mathematics.Vector2f getCenter()
Description copied from class:ClassificationWidget
Calculate and return the current center of the widget in world coordinates.- Overrides:
getCenter
in classClassificationWidget
- Returns:
- the current center of the widget in world coordinates.
-
ScaleCircle
protected void ScaleCircle(int iX, int iY)
scale the circle based on the mouse position.- Parameters:
e
-
-
ShiftCircle
protected void ShiftCircle(int iX, int iY)
Translate the circle in the 2D Histogram panel.- Parameters:
e
- MouseEvent
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
Read a new CircleClassificationWidget from the input stream.- Parameters:
in
- input stream- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
scaleCircle
private void scaleCircle(WildMagic.LibFoundation.Mathematics.Vector2f kCurrentCenter, float diffX, float diffY)
Scale the circle based on the current center and the difference between the current center and the mouse position.- Parameters:
kCurrentCenter
- circle current center.diffX
- difference between center and mouse position.diffY
- difference between center and mouse position.
-
shiftCircle
private void shiftCircle(WildMagic.LibFoundation.Mathematics.Vector2f kCurrentCenter, float fDiffX, float fDiffY)
Translate the circle based on the current center and the difference between the current center and the mouse position.- Parameters:
kCurrentCenter
-fDiffX
-fDiffY
-
-
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
- output stream.- Throws:
java.io.IOException
-
-