Class FlyThroughRender
java.lang.Object
WildMagic.LibApplications.OpenGLApplication.Application
WildMagic.LibApplications.OpenGLApplication.JavaApplication
WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
gov.nih.mipav.view.renderer.WildMagic.GPURenderBase
gov.nih.mipav.view.renderer.WildMagic.flythroughview.FlyThroughRender
- All Implemented Interfaces:
com.jogamp.opengl.GLEventListener,SpaceNavigatorListener,FlyThroughRenderInterface,FlyPathBehavior_WM.Callback,KeyListener,MouseListener,MouseMotionListener,MouseWheelListener,Serializable,EventListener
public class FlyThroughRender
extends GPURenderBase
implements FlyThroughRenderInterface, FlyPathBehavior_WM.Callback, com.jogamp.opengl.GLEventListener, MouseWheelListener
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classMouse middle button wheel roller event handler.(package private) classRightMouse press event handler.(package private) classRight mouse button press down and drag event handler.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intstatic intstatic intstatic intprivate int[]This is the range of path samples for each branch that are unvisited.private int[]This is the range of path samples for each branch that are unvisited.private WildMagic.LibFoundation.Mathematics.ColorRGB[]Original surface color for undoing the pseudo-color curvature map.private intKeep track of the last branch that was selected (at a branch point).private FlyPathAnnotateList_WMAnnotations along the fly path.private WildMagic.LibFoundation.Mathematics.Vector3fCenter of Meshprivate JPanelVirtualEndoscopySetup_WMThis is the control frame which may need to be updated as the view changes.private MjCorticalMesh_WMCalculating the mesh curvatures.private FlyPathBehavior_WMFly path behavior.private FlyPathGraphCurveFly path curve.private WildMagic.LibGraphics.Rendering.LightLighting in the scene.private SurfaceLightingEffectLighting effect.private ModelImageModelImage used to generate the fly path.private ModelLUTkMean curvature LUT.private WildMagic.LibFoundation.Mathematics.ColorRGBColor for the parts of the path that have not yet been visited (Dark Green)private WildMagic.LibFoundation.Mathematics.ColorRGBColor for the parts of the path that have been visited (Light Green)private FlyThroughRender.SetupOptionsSetup options.protected VolumeTriPlanarInterfaceParent user-interface and display frame.private WildMagic.LibGraphics.SceneGraph.NodeMouse rotation.private WildMagic.LibFoundation.Mathematics.ColorRGBColor for selecting previously-unvisited parts of the path at a branch (Dark Red)private WildMagic.LibFoundation.Mathematics.ColorRGBColor for selecting previously-visited parts of the path at a branch (Red)private Skeleton3D3D Skeleton of the ModelImage.private WildMagic.LibGraphics.SceneGraph.TriMeshThe surface to fly through.private ModelImage3DLayout3D Layout of the ModelImage.private booleanIf any of the mouse move button pressed.private static final longUse serialVersionUID for interoperability.Fields inherited from class gov.nih.mipav.view.renderer.WildMagic.GPURenderBase
dpiScale, hyperstack, hyperstackColormap, isSpaceNavCodeRunning, m_akLights, m_bDispose, m_bDoClip, m_bExtract, m_bFirstDrag, m_bInit, m_bModified, m_bMouseDrag, m_bPickPending, m_bShared, m_bSnapshot, m_bSurfaceMaskUpdate, m_bSurfaceUpdate, m_bTestFrameRate, m_bVisible, m_fMax, m_fX, m_fY, m_fZ, m_iCaptureFPS, m_iScreenCaptureCounter, m_iXPick, m_iYPick, m_kAnimator, m_kCuller, m_kDeleteList, m_kDisplayList, m_kPicker, m_kSceneToWorld, m_kTranslate, m_kVolumeImageA, m_kVolumeImageA_New, m_kVolumeImageA_Old, m_kVolumeImageB, m_kVolumeImageB_New, m_kVolumeImageB_Old, m_kWinLevel, m_kXRotate, m_kYRotate, m_kZRotate, m_spkCull, m_spkScene, nearPlane, updateBoundingCubeFields 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_iMouseButton, m_iTimer, m_kSaveRotate, m_mouseRotSpeed, m_spkCamera, m_spkMotionObject, pitchRotationAngle, rollRotationAngle, xCameraMove, xCameraTurn, yawRotationAngle, yCameraMove, yCameraTurn, zCameraMoveFields inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
m_acWindowTitle, m_eBuffering, m_eDepth, m_eFormat, m_eMultisampling, m_eStencil, m_iHeight, m_iWidth, m_iXPosition, m_iYPosition, m_kBackgroundColor, m_pkRenderer -
Constructor Summary
ConstructorsConstructorDescriptionFlyThroughRender(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, com.jogamp.opengl.util.Animator kAnimator, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibFoundation.Mathematics.Vector3f kTranslate) Construct the FlyThroughRenderer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kSurface, WildMagic.LibFoundation.Mathematics.Vector3f kCenter) Add the fly-through surface.voidautoRun()Causes the FlyPathBehavior to fly down the current path from start to finish and back again.private voidcreateAnnotatePoint(WildMagic.LibFoundation.Mathematics.Vector3f kPosition) Create a new Annotation point at the position specified.private WildMagic.LibGraphics.SceneGraph.PolylinecreateBranchConnectGeometryScaled(int iBranch) Get the geometry to be used for rendering the connection of the specified branch to its parent branch.private WildMagic.LibGraphics.SceneGraph.PolylinecreateBranchPathGeometryScaled(int iBranch) Get the geometry to be used for rendering the path of the specified branch.private voidCalled by the init() function.voiddisplay(com.jogamp.opengl.GLAutoDrawable arg0) voiddoPseudoColor(boolean bOn) Turn curvature-based color map on/off.WildMagic.LibFoundation.Mathematics.Vector3fReturn the camera direction vector.WildMagic.LibFoundation.Mathematics.Vector3fReturn the camera up vector.intWildMagic.LibFoundation.Mathematics.Vector3fgetPositionScaled(WildMagic.LibFoundation.Mathematics.Vector3f kPoint) Scaled coordinates for the current position along the path for viewing.WildMagic.LibFoundation.Mathematics.Vector3fgetPositionUnScaled(WildMagic.LibFoundation.Mathematics.Vector3f kPoint) Scaled coordinates for the current position along the path for viewing.intgetWidth()voidinit(com.jogamp.opengl.GLAutoDrawable arg0) voidPart of the KeyListener interface.static FlyThroughRendermain(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibFoundation.Mathematics.Vector3f kTranslate, boolean displayInSeparateFrame) voidPasses move command from the JPanelFlythruMove to the FlyPathBehavior class.voidmouseDragged(MouseEvent event) voidvoidvoidmouseWheelMoved(MouseWheelEvent event) Mouse wheel event invoked from the middle mouse button roller.protected voidMove()Updates the camera and displayed objects for rendering.protected voidPick()Picking support for adding Annotation points to the scene.private voidRender()Render the scene-graph.protected voidCalled any time a change has been made to a new branch so that the connection between the branch and its parent can be rendered.protected voidCalled any time the position along the current curve changes and the color of the curve needs to change to show what has been visited.private ModelImageresizeImage(ModelImage kInput) voidsetCurrentState(Object _state) Set the BranchState in the FlyPathBehavior.voidsetupRender(ModelImage kImage, FlyThroughRender.SetupOptions kOptions) Setup flythru renderer.voidSet the JPanelVirtualEndoscopySetup user-interface.voidupdate()Update the representation of the current viewpoint in the Volume Tri-Planar renderer.private voidUpdate the camera location and view direction.voidupdateLighting(WildMagic.LibGraphics.Rendering.Light[] akGLights) Called from JPanelLight.voidviewChanged(FlyPathBehavior_WM behavior, int iEvent) ViewChanged callback for flythrough renderers.Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.GPURenderBase
AddNode, checkIfSpaceNavNeedsCalibration, dispose, dispose, drawText, fineMovement, GetCanvas, getCounter, getDisplayList, getImage, GetLights, getNearPlane, GetNode, getNormalizedXDim, getNormalizedYDim, getNormalizedZDim, getRotationCutoffValue, getRotationScaleFactor, GetSceneRotation, getSceneToWorldMatrix, getTranslate, getTranslationCutoffValue, getTranslationScaleFactor, getVolumeImage, getVolumeImageB, invertRX, invertRY, invertRZ, invertTX, invertTY, invertTZ, isUseMouseRotationCutoffs, isUseMouseTranslationCutoffs, isVisible, normalMovement, pauseAnimator, processSpaceNavEvent, processSpaceNavEvent, record, reInitialize, RemoveNode, RenderFrameRate, resetAxis, resetAxisX, resetAxisXInv, resetAxisY, reshape, saveAVIMovie, saveQuickTimeMovie, setCameraNearPlane, setDefaultLighting, setOrthographicProjection, setPerspectiveProjection, setRotationCutoffValue, setRotationScaleFactor, SetSceneRotation, setTranslationCutoffValue, setTranslationScaleFactor, setUseMouseRotationCutoffs, setUseMouseTranslationCutoffs, setVisible, startAnimator, updateImageFromRotation, UpdateSceneRotation, writeImageMethods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
DrawFrameRate, getCameraLocation, getCameraParameters, getObjectParameters, getObjectRotation, InitializeCameraMotion, InitializeCameraMotion, InitializeObjectMotion, keyReleased, keyTyped, LookDown, LookUp, MeasureTime, mouseClicked, mouseEntered, mouseExited, mouseMoved, MoveBackward, MoveCamera, MoveDown, MoveForward, MoveLeft, MoveObject, MoveRight, MoveUp, OnDisplay, OnInitialize, OnTerminate, ResetTime, RotateTrackBall, setCameraLocation, setCameraParameters, setObjectParameters, setObjectRotation, TurnLeft, TurnRight, UpdateCameraRotationSpeed, UpdateCameraTranslationSpeed, UpdateCameraZoomSpeed, UpdateFrameCount, UpdateMouseRotationSpeedMethods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
GetAspectRatio, GetHeight, GetRenderer, GetWidth, GetWindowTitle, GetXPosition, GetYPosition, OnIdle, OnMove, OnPrecreate, OnResize, SetRendererMethods inherited from class WildMagic.LibApplications.OpenGLApplication.Application
reloadShaders, TestStreamingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nih.mipav.view.renderer.flythroughview.FlyThroughRenderInterface
getCounter, getImage, record, writeImageMethods inherited from interface com.jogamp.opengl.GLEventListener
dispose, reshapeMethods inherited from interface java.awt.event.KeyListener
keyReleased, keyTypedMethods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExitedMethods inherited from interface java.awt.event.MouseMotionListener
mouseMoved
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
m_kParent
Parent user-interface and display frame. -
m_kVolumeLayout
3D Layout of the ModelImage. -
m_kSkeleton
3D Skeleton of the ModelImage. -
m_kFlyPathGraphCurve
Fly path curve. -
m_kFlyPathBehavior
Fly path behavior. -
m_kAnnotateList
Annotations along the fly path. -
m_kMaskImage
ModelImage used to generate the fly path. -
m_iLastSelectedBranchIndex
private int m_iLastSelectedBranchIndexKeep track of the last branch that was selected (at a branch point). -
m_aiBranchIndexUnvisitedMax
private int[] m_aiBranchIndexUnvisitedMaxThis is the range of path samples for each branch that are unvisited. -
m_kNormalColorPathVisited
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kNormalColorPathVisitedColor for the parts of the path that have been visited (Light Green) -
m_kNormalColorPathUnvisited
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kNormalColorPathUnvisitedColor for the parts of the path that have not yet been visited (Dark Green) -
m_kSelectColorPathVisited
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kSelectColorPathVisitedColor for selecting previously-visited parts of the path at a branch (Red) -
m_kSelectColorPathUnvisited
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kSelectColorPathUnvisitedColor for selecting previously-unvisited parts of the path at a branch (Dark Red) -
m_aiBranchIndexUnvisitedMin
private int[] m_aiBranchIndexUnvisitedMinThis is the range of path samples for each branch that are unvisited. -
m_kSurface
private WildMagic.LibGraphics.SceneGraph.TriMesh m_kSurfaceThe surface to fly through. -
m_kLight
private WildMagic.LibGraphics.Rendering.Light m_kLightLighting in the scene. -
m_kOptions
Setup options. -
m_kControlFrame
This is the control frame which may need to be updated as the view changes. -
m_kRotation
private WildMagic.LibGraphics.SceneGraph.Node m_kRotationMouse rotation. -
m_kCortical
Calculating the mesh curvatures. -
m_kCenter
private WildMagic.LibFoundation.Mathematics.Vector3f m_kCenterCenter of Mesh -
m_kMeanCurvaturesLUT
kMean curvature LUT. Pseudo color look up table. -
m_kLightShader
Lighting effect. -
m_akColorBackup
private WildMagic.LibFoundation.Mathematics.ColorRGB[] m_akColorBackupOriginal surface color for undoing the pseudo-color curvature map. -
pressed
private volatile boolean pressedIf any of the mouse move button pressed. -
lookup
public static int lookup -
lookdown
public static int lookdown -
lookright
public static int lookright -
lookleft
public static int lookleft
-
-
Constructor Details
-
FlyThroughRender
public FlyThroughRender(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, com.jogamp.opengl.util.Animator kAnimator, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibFoundation.Mathematics.Vector3f kTranslate) Construct the FlyThroughRenderer.- Parameters:
kParent- parent user-interface and frame.kAnimator- animator used to display the canvas.kVolumeImageA- volume data and textures for ModelImage A.kVolumeImageB- volume data and textures for ModelImage B.
-
-
Method Details
-
main
public static FlyThroughRender main(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibFoundation.Mathematics.Vector3f kTranslate, boolean displayInSeparateFrame) -
addSurface
public void addSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kSurface, WildMagic.LibFoundation.Mathematics.Vector3f kCenter) Add the fly-through surface.- Parameters:
kSurface- the TriMesh surface to fly through.
-
autoRun
public void autoRun()Description copied from interface:FlyThroughRenderInterfaceCauses the FlyPathBehavior to fly down the current path from start to finish and back again.- Specified by:
autoRunin interfaceFlyThroughRenderInterface
-
display
public void display(com.jogamp.opengl.GLAutoDrawable arg0) - Specified by:
displayin interfacecom.jogamp.opengl.GLEventListener
-
doPseudoColor
public void doPseudoColor(boolean bOn) Turn curvature-based color map on/off.- Parameters:
bOn- turns curvature-based color map on when true and off when false.
-
getBranchState
- Specified by:
getBranchStatein interfaceFlyThroughRenderInterface- Returns:
- the current BranchState from the FlyPatheBehavior class.
-
getCameraDirection
public WildMagic.LibFoundation.Mathematics.Vector3f getCameraDirection()Return the camera direction vector.- Returns:
- camera direction vector.
-
getCameraUp
public WildMagic.LibFoundation.Mathematics.Vector3f getCameraUp()Return the camera up vector.- Returns:
- camera up vector.
-
getCanvas
- Specified by:
getCanvasin interfaceFlyThroughRenderInterface- Returns:
- the Canvas from the Fly-through renderer.
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceFlyThroughRenderInterface- Returns:
- the frame height.
-
getPositionScaled
public WildMagic.LibFoundation.Mathematics.Vector3f getPositionScaled(WildMagic.LibFoundation.Mathematics.Vector3f kPoint) Scaled coordinates for the current position along the path for viewing.- Parameters:
Point- in normalized path coordinates.- Returns:
- Point3f A new instance created which contains the path position coordinates, scaled to match the TriMesh in JPanelSurface.
-
getPositionUnScaled
public WildMagic.LibFoundation.Mathematics.Vector3f getPositionUnScaled(WildMagic.LibFoundation.Mathematics.Vector3f kPoint) Scaled coordinates for the current position along the path for viewing.- Parameters:
The- path position coordinates, scaled to match the TriMesh.- Returns:
- Point in normalized path coordinates.
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceFlyThroughRenderInterface- Returns:
- the frame width.
-
init
public void init(com.jogamp.opengl.GLAutoDrawable arg0) - Specified by:
initin interfacecom.jogamp.opengl.GLEventListener
-
keyPressed
Description copied from class:GPURenderBasePart of the KeyListener interface.- Specified by:
keyPressedin interfaceKeyListener- Overrides:
keyPressedin classGPURenderBase- Parameters:
e- the key event.
-
makeMove
Description copied from interface:FlyThroughRenderInterfacePasses move command from the JPanelFlythruMove to the FlyPathBehavior class.- Specified by:
makeMovein interfaceFlyThroughRenderInterface- Parameters:
cmd- move command.
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classGPURenderBase
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mouseWheelMoved
Mouse wheel event invoked from the middle mouse button roller. Rolling forward to track the fly-thru path in forward direction. Rolling backward to track the fly-thru path in backward direction.- Specified by:
mouseWheelMovedin interfaceMouseWheelListener- Overrides:
mouseWheelMovedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D- Parameters:
event- mouse middle mouse roller event.
-
setCurrentState
Description copied from interface:FlyThroughRenderInterfaceSet the BranchState in the FlyPathBehavior.- Specified by:
setCurrentStatein interfaceFlyThroughRenderInterface- Parameters:
_state-
-
setupRender
Setup flythru renderer.- Parameters:
kOptions- setup options reference._kImage- original model image reference.
-
setupRenderControl
Set the JPanelVirtualEndoscopySetup user-interface.- Parameters:
_control- the JPanelVirtualEndoscopySetup user-interface.
-
update
public void update()Update the representation of the current viewpoint in the Volume Tri-Planar renderer. -
updateLighting
public void updateLighting(WildMagic.LibGraphics.Rendering.Light[] akGLights) Description copied from class:GPURenderBaseCalled from JPanelLight. Updates the lighting parameters.- Overrides:
updateLightingin classGPURenderBase- Parameters:
akGLights- the set of GeneralLight objects.
-
viewChanged
Description copied from interface:FlyPathBehavior_WM.CallbackViewChanged callback for flythrough renderers.- Specified by:
viewChangedin interfaceFlyPathBehavior_WM.Callback- Parameters:
behavior- reference to this MjFlyPathBehavior in which the view changed.iEvent- Bitmask identifies the event(s) which caused the view to change. Bitmask created from OR of EVENT_* defintions.
-
createAnnotatePoint
private void createAnnotatePoint(WildMagic.LibFoundation.Mathematics.Vector3f kPosition) Create a new Annotation point at the position specified.- Parameters:
kPosition- position of new annotation point.
-
createBranchConnectGeometryScaled
private WildMagic.LibGraphics.SceneGraph.Polyline createBranchConnectGeometryScaled(int iBranch) Get the geometry to be used for rendering the connection of the specified branch to its parent branch.- Parameters:
iBranch- Index which identifies the branch.- Returns:
- Polyline instance that can be attached to a scene-graph Node for rendering
-
createBranchPathGeometryScaled
private WildMagic.LibGraphics.SceneGraph.Polyline createBranchPathGeometryScaled(int iBranch) Get the geometry to be used for rendering the path of the specified branch.- Parameters:
iBranch- Index which identifies the branch.- Returns:
- Polyline instance that can be attached to a scene-graph Node for rendering
The coordinates are scaled to match the TriMesh in JPanelSurface.
-
CreateScene
private void CreateScene()Called by the init() function. Creates and initialized the scene-graph.- Parameters:
arg0- the GLCanvas
-
Render
private void Render()Render the scene-graph. -
resizeImage
-
updateCamera
private void updateCamera()Update the camera location and view direction. Called from mouse dragged. Implements "inside looking out" object rotation. -
Move
protected void Move()Description copied from class:GPURenderBaseUpdates the camera and displayed objects for rendering.- Overrides:
Movein classGPURenderBase
-
Pick
protected void Pick()Picking support for adding Annotation points to the scene. -
resetRenderBranchConnect
protected void resetRenderBranchConnect()Called any time a change has been made to a new branch so that the connection between the branch and its parent can be rendered. -
resetRenderBranchPath
protected void resetRenderBranchPath()Called any time the position along the current curve changes and the color of the curve needs to change to show what has been visited.
-