Class VolumeImageMultiDimensionalTransfer
- java.lang.Object
-
- WildMagic.LibApplications.OpenGLApplication.Application
-
- WildMagic.LibApplications.OpenGLApplication.JavaApplication
-
- WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
- gov.nih.mipav.view.renderer.WildMagic.Render.VolumeImageViewer
-
- gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.VolumeImageMultiDimensionalTransfer
-
- All Implemented Interfaces:
com.jogamp.opengl.GLEventListener,java.awt.event.KeyListener,java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.awt.event.MouseWheelListener,java.io.Serializable,java.util.EventListener
public class VolumeImageMultiDimensionalTransfer extends VolumeImageViewer implements com.jogamp.opengl.GLEventListener, java.awt.event.KeyListener
This class implements the 2D Histogram display and user-interaction widget in the JPanelMultiDimensionalTransfer class. The widget is displayed with a GLCanvas with a screen-space polygon displaying the 2D Histogram texture as the background. The user can add ClassificationWidgets to the canvas and change their location and size as well as color and blending parameters. This class provides the display and user-interaction for those widgets. The widget parameters are then passed to the Volume Renderer GLSL program in the VolumeRayCast class where they determine how the volume is displayed.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JPanelcontainermain container for this object:private java.util.Vector<ClassificationWidget>m_akWidgetsThe list of widgets displayed on the 2D Histogram.private booleanm_bAddedWhen true a new Widget was added with the mouse.private booleanm_bFirstAddedprivate booleanm_bPickPendingWhen true there is a pending mouse pick to process.private booleanm_bUpdateLevprivate intm_iCurrentThe ID of the active and previously active widget.private intm_iLUTIndexprivate intm_iMouseButtonStores which button was pressed during mouse drag.private intm_iMouseXStores the mouse position for picking.private intm_iMouseYStores the mouse position for picking.private intm_iPickedThe ID of theprivate intm_iPreviousThe ID of the active and previously active widget.private WildMagic.LibFoundation.Mathematics.ColorRGBAm_kCurrentColorThe current color to use to create a new Widget.private JInterfaceBasem_kInterfaceReference to the containing JPanel.private WildMagic.LibFoundation.Mathematics.Vector2fm_kTMaxprivate WildMagic.LibFoundation.Mathematics.Vector2fm_kTMinThe bounds on the 2D Histogram texture coordinates used to display the 2D Histogram.private java.lang.Stringm_kWidgetTypeDefines the current selected widget type.intMAX_WIDGETSThe maximum number of widgets that can be added to the display.private static longserialVersionUID-
Fields inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.VolumeImageViewer
dpiScale, m_bDisplay, m_bDispose, m_bInit, m_iScreenCaptureCounter, m_iSlice, m_kAnimator, m_kCull, m_kCuller, m_kFrame, m_kParent, m_kVolumeImage, m_pkPlane, m_spkEffect, m_spkScene, startTime
-
Fields inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
cameraParams, m_akWorldAxis, m_bCameraMoveable, m_bDArrowPressed, m_bEndPressed, m_bHomePressed, m_bLArrowPressed, m_bLInsertPressed, m_bObjectZoomed, m_bPgDnPressed, m_bPgUpPressed, m_bRArrowPressed, m_bRDeletePressed, m_bTrackBallDown, m_bUArrowPressed, m_bUseTrackBall, m_dAccumulatedTime, m_dFrameRate, m_dLastTime, m_fRotSpeed, m_fRotSpeedFactor, m_fTrnSpeed, m_fTrnSpeedFactor, m_fXDrag0, m_fXTrack0, m_fXTrack1, m_fYDrag0, m_fYTrack0, m_fYTrack1, m_fZoomSpeed, m_iAccumulatedFrameCount, m_iDoPitch, m_iDoRoll, m_iDoYaw, m_iFrameCount, m_iMaxTimer, m_iTimer, m_kSaveRotate, m_mouseRotSpeed, m_spkCamera, m_spkMotionObject, pitchRotationAngle, rollRotationAngle, xCameraMove, xCameraTurn, yawRotationAngle, yCameraMove, yCameraTurn, zCameraMove
-
-
Constructor Summary
Constructors Constructor Description VolumeImageMultiDimensionalTransfer(com.jogamp.opengl.util.Animator animator, com.jogamp.opengl.awt.GLCanvas canvas, double dpiScale, VolumeTriPlanarInterface kParentFrame, VolumeImage kVolumeImage)Create a new VolumeImageMultiDimensionalTranfer display.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAllWidgets()private voidcreateContainer(com.jogamp.opengl.awt.GLCanvas canvas)Creates the containing JPanel that will display this object.protected voidCreatePlaneNode()protected voidCreateScene()voiddisplay()Set the display to true and call GLCanvas.display;voiddisplay(com.jogamp.opengl.GLAutoDrawable arg0)voiddispose()voiddispose(com.jogamp.opengl.GLAutoDrawable arg0)javax.swing.JPanelgetContainingPanel()Returns the container for this object.java.util.Vector<ClassificationWidget>getM_akLev()intgetPicked()Returns the ID of the currently picked Widget.java.util.Vector<ClassificationWidget>getWidgets()Returns the current Widgets.voidinit(com.jogamp.opengl.GLAutoDrawable arg0)voidkeyPressed(java.awt.event.KeyEvent kKey)keyPressed callback.voidload(java.lang.String fileName)static VolumeImageMultiDimensionalTransfermain(com.jogamp.opengl.awt.GLCanvas kCanvas, double dpiScale, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, boolean displayInSeparateFrame)Iridescence.main creates the Iridescence object and window frame to contain the GLCanvas.voidmouseDragged(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)protected voidPick(WildMagic.LibGraphics.Rendering.Renderer kRenderer)Determine which widget is selected with the mouse/voidreshape(com.jogamp.opengl.GLAutoDrawable arg0, int iX, int iY, int iWidth, int iHeight)voidsave(java.lang.String fileName)voidsetAlpha(float fAlpha)voidsetBoundary(float fAlpha)Sets the contribution of the 2nd derivative on the volume rendering for this widget.voidsetColor(WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)Sets the color of the color transfer function for this widget.voidSetInterface(JInterfaceBase kInterface)Sets the parent container panel:voidsetPicked(int value)Sets the current picked ID.voidsetWidget(java.lang.String kWidgetType)Sets the widget type for new widgets.voidsetWidgets(java.util.Vector<ClassificationWidget> kWidgetList)Sets the list of Widgets.voidupdate(java.lang.String kCommand)private voidupdateLev()Updates the scene graph after a new list of widgets is added.-
Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.VolumeImageViewer
computeElapsedTime, displayChanged, GetCanvas, main, SetAnimator, SetFrame, setStartTime, UpdateSlice, writeImage
-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
DrawFrameRate, getCameraLocation, getCameraParameters, getObjectParameters, getObjectRotation, InitializeCameraMotion, InitializeCameraMotion, InitializeObjectMotion, keyReleased, keyTyped, LookDown, LookUp, MeasureTime, mouseClicked, mouseEntered, mouseExited, mouseWheelMoved, MoveBackward, MoveCamera, MoveDown, MoveForward, MoveLeft, MoveObject, MoveRight, MoveUp, OnDisplay, OnInitialize, OnTerminate, ResetTime, RotateTrackBall, setCameraLocation, setCameraParameters, setObjectParameters, setObjectRotation, TurnLeft, TurnRight, UpdateCameraRotationSpeed, UpdateCameraTranslationSpeed, UpdateCameraZoomSpeed, UpdateFrameCount, UpdateMouseRotationSpeed
-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
GetAspectRatio, GetHeight, GetRenderer, GetWidth, GetWindowTitle, GetXPosition, GetYPosition, OnIdle, OnMove, OnPrecreate, OnResize, SetRenderer
-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.Application
reloadShaders, TestStreaming
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
MAX_WIDGETS
public int MAX_WIDGETS
The maximum number of widgets that can be added to the display. More can be added, but then the Volume Renderer GLSL program should be changed to add the new widgets.
-
container
private javax.swing.JPanel container
main container for this object:
-
m_iMouseButton
private int m_iMouseButton
Stores which button was pressed during mouse drag.
-
m_iMouseX
private int m_iMouseX
Stores the mouse position for picking.
-
m_iMouseY
private int m_iMouseY
Stores the mouse position for picking.
-
m_kTMin
private WildMagic.LibFoundation.Mathematics.Vector2f m_kTMin
The bounds on the 2D Histogram texture coordinates used to display the 2D Histogram. The texture coordinates are clamped to show only the portions of the texture that are above a threshold value.
-
m_kTMax
private WildMagic.LibFoundation.Mathematics.Vector2f m_kTMax
-
m_akWidgets
private java.util.Vector<ClassificationWidget> m_akWidgets
The list of widgets displayed on the 2D Histogram.
-
m_iCurrent
private int m_iCurrent
The ID of the active and previously active widget.
-
m_iPrevious
private int m_iPrevious
The ID of the active and previously active widget.
-
m_iPicked
private int m_iPicked
The ID of the
-
m_bPickPending
private boolean m_bPickPending
When true there is a pending mouse pick to process.
-
m_kCurrentColor
private WildMagic.LibFoundation.Mathematics.ColorRGBA m_kCurrentColor
The current color to use to create a new Widget.
-
m_bAdded
private boolean m_bAdded
When true a new Widget was added with the mouse.
-
m_kInterface
private JInterfaceBase m_kInterface
Reference to the containing JPanel.
-
m_kWidgetType
private java.lang.String m_kWidgetType
Defines the current selected widget type.
-
m_bFirstAdded
private boolean m_bFirstAdded
-
m_bUpdateLev
private boolean m_bUpdateLev
-
m_iLUTIndex
private int m_iLUTIndex
-
-
Constructor Detail
-
VolumeImageMultiDimensionalTransfer
public VolumeImageMultiDimensionalTransfer(com.jogamp.opengl.util.Animator animator, com.jogamp.opengl.awt.GLCanvas canvas, double dpiScale, VolumeTriPlanarInterface kParentFrame, VolumeImage kVolumeImage)Create a new VolumeImageMultiDimensionalTranfer display.- Parameters:
canvas- The canvas to use for the display. The canvas shares a context with the VolumeTriPlanarRenderer.kParentFrame- parent frame.kVolumeImage- the VolumeImage with the associated 2D Histogram.
-
-
Method Detail
-
main
public static VolumeImageMultiDimensionalTransfer main(com.jogamp.opengl.awt.GLCanvas kCanvas, double dpiScale, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, boolean displayInSeparateFrame)
Iridescence.main creates the Iridescence object and window frame to contain the GLCanvas. An Animator object is created with the GLCanvas as an argument. The Animator provides the same function as the glutMainLoop() function call commonly used in OpenGL applications.
-
clearAllWidgets
public void clearAllWidgets()
-
display
public void display()
Set the display to true and call GLCanvas.display;
-
display
public void display(com.jogamp.opengl.GLAutoDrawable arg0)
- Specified by:
displayin interfacecom.jogamp.opengl.GLEventListener- Overrides:
displayin classVolumeImageViewer
-
dispose
public void dispose()
- Overrides:
disposein classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
dispose
public void dispose(com.jogamp.opengl.GLAutoDrawable arg0)
- Specified by:
disposein interfacecom.jogamp.opengl.GLEventListener- Overrides:
disposein classVolumeImageViewer
-
getContainingPanel
public javax.swing.JPanel getContainingPanel()
Returns the container for this object. The container has a scroll pane and slider for the depth.- Returns:
-
getM_akLev
public java.util.Vector<ClassificationWidget> getM_akLev()
-
getPicked
public int getPicked()
Returns the ID of the currently picked Widget.- Returns:
- the ID of the currently picked Widget.
-
getWidgets
public java.util.Vector<ClassificationWidget> getWidgets()
Returns the current Widgets.- Returns:
- the current Widgets.
-
init
public void init(com.jogamp.opengl.GLAutoDrawable arg0)
- Specified by:
initin interfacecom.jogamp.opengl.GLEventListener- Overrides:
initin classVolumeImageViewer
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent kKey)
keyPressed callback.- Specified by:
keyPressedin interfacejava.awt.event.KeyListener- Overrides:
keyPressedin classVolumeImageViewer- Parameters:
kKey- the KeyEvent triggering the callback.
-
load
public void load(java.lang.String fileName)
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseDraggedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseMovedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener- Overrides:
mousePressedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener- Overrides:
mouseReleasedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
reshape
public void reshape(com.jogamp.opengl.GLAutoDrawable arg0, int iX, int iY, int iWidth, int iHeight)- Specified by:
reshapein interfacecom.jogamp.opengl.GLEventListener- Overrides:
reshapein classVolumeImageViewer
-
save
public void save(java.lang.String fileName)
-
setAlpha
public void setAlpha(float fAlpha)
-
setBoundary
public void setBoundary(float fAlpha)
Sets the contribution of the 2nd derivative on the volume rendering for this widget.- Parameters:
fAlpha- the contribution of the 2nd derivative on the volume rendering for this widget.
-
setColor
public void setColor(WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
Sets the color of the color transfer function for this widget.- Parameters:
kColor- the color of the color transfer function for this widget.
-
SetInterface
public void SetInterface(JInterfaceBase kInterface)
Sets the parent container panel:- Parameters:
kInterface-
-
setPicked
public void setPicked(int value)
Sets the current picked ID.- Parameters:
value-
-
setWidget
public void setWidget(java.lang.String kWidgetType)
Sets the widget type for new widgets.- Parameters:
kWidgetType-
-
setWidgets
public void setWidgets(java.util.Vector<ClassificationWidget> kWidgetList)
Sets the list of Widgets.- Parameters:
kWidgetList-
-
update
public void update(java.lang.String kCommand)
-
createContainer
private void createContainer(com.jogamp.opengl.awt.GLCanvas canvas)
Creates the containing JPanel that will display this object. The JPanel contains a scroll pane with both horizontal and vertical scroll bars and a horizontal slider for changing where the slice plane intersects the volume in depth.- Parameters:
imageComponent-
-
CreatePlaneNode
protected void CreatePlaneNode()
- Overrides:
CreatePlaneNodein classVolumeImageViewer
-
CreateScene
protected void CreateScene()
- Overrides:
CreateScenein classVolumeImageViewer
-
Pick
protected void Pick(WildMagic.LibGraphics.Rendering.Renderer kRenderer)
Determine which widget is selected with the mouse/
-
updateLev
private void updateLev()
Updates the scene graph after a new list of widgets is added.
-
-