Class CorticalAnalysisRender
- 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.brainflattenerview_WM.CorticalAnalysisRender
-
- All Implemented Interfaces:
com.jogamp.opengl.GLEventListener,SpaceNavigatorListener,java.awt.event.KeyListener,java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.awt.event.MouseWheelListener,java.io.Serializable,java.util.EventListener
public class CorticalAnalysisRender extends GPURenderBase implements com.jogamp.opengl.GLEventListener
Cortical analysis applet and viewer. This class contains the static 'main' method to launch the application. This class is an Applet which means that it can be embedded in a browser or it can be attached to a MainFrame when executed as an application.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int[]m_aiTriIndexPoint indices of the puncture triangle.private WildMagic.LibFoundation.Mathematics.ColorRGB[]m_akPickColorsColors for the picked points:.private WildMagic.LibFoundation.Mathematics.ColorRGBA[]m_akTriColorspuncture triangle colorprivate booleanm_bCurvatureColorsFlag set to indicate whether curvature colors are rendered on the mesh surface.private booleanm_bDisplayLinesToggle latitude/longitude display on/off.private booleanm_bFirstFirst time the scene is rendered.private booleanm_bInflationInitializedFlag set once inflation processing has been initialized.private booleanm_bPickCorrespondenceEnabledTurned on when picking with the mouse is enabled:.private booleanm_bPickPunctureEnabledEnable/disable picking puncture triangleprivate intm_iNumLatprivate intm_iNumLonprivate intm_iNumPickednumber of picked points displayed.private intm_iRunningNumPickedCycle through the number of correspondence points.private MjCorticalMesh_WMm_kCorticalCortical mesh to be used in rendering scene.private VolumeSurfacem_kCylinderCylinder rendererprivate VolumeNodem_kCylinderLinesCylinder longitude/latitude lines.private VolumeNodem_kCylinderPointsScene-graph node for displaying correspondence points on the cylinder.private ModelLUTm_kLUTConvexityLUT for the triangle mesh convexity colors.private ModelLUTm_kLUTCurvaturelocal reference to ModelLUT.private WildMagic.LibGraphics.SceneGraph.Nodem_kMeshLinesTriMesh longitude/latitude lines.private WildMagic.LibGraphics.SceneGraph.Nodem_kMeshPointsScene-graph node for displaying correspondence points on the TriMesh surface.private JPanelBrainSurfaceFlattener_WMm_kPanelBrainSurfaceFlattener User-Interface panelprotected VolumeTriPlanarInterfacem_kParentParent user-interface and display frame.private VolumeSurfacem_kSphereSphere renderer.private VolumeNodem_kSphereLinesSphere longitude/latitude lines.private VolumeNodem_kSpherePointsScene-graph node for displaying correspondence points on the sphere.private intMAX_POINTSMaximum number of correspondence points.private static longserialVersionUIDUse 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, updateBoundingCube
-
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_iMouseButton, m_iTimer, m_kSaveRotate, m_mouseRotSpeed, m_spkCamera, m_spkMotionObject, pitchRotationAngle, rollRotationAngle, xCameraMove, xCameraTurn, yawRotationAngle, yCameraMove, yCameraTurn, zCameraMove
-
-
Constructor Summary
Constructors Constructor Description CorticalAnalysisRender(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB)CorticalAnalysisRender(VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB)Construct the BrainSurfaceFlattener renderer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VolumeSurfaceaddSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kSurfaces)Add a surface to the display list.voidcalculateConformal()Called on setup, when a new triangle mesh is loaded, or when the puncture triangle is selected and the "recalculate conformal" button is pressed by the user:private floatclosestPlanePointIndex(WildMagic.LibGraphics.Collision.PickRecord kPickPoint)For the plane, all vertices have z-value set to zero.private voidCreateScene()Called by the init() function.voiddisplay(com.jogamp.opengl.GLAutoDrawable arg0)voiddisplayConvexityColors()toggle between display of mean curvature-based colors and average convexity-based colors.voiddisplayCurvatureColors()toggle between display of mean curvature-based colors and average convexity-based colors.voiddisplayPlane()Switch to displaying the plane:voiddisplaySphere()Switch to displaying the sphere:voiddispose(com.jogamp.opengl.GLAutoDrawable kDrawable)memory cleanup.voiddrawPicked(int iV0, int iV1, int iV2)Draw the user-selected point, either as a sphere on the triangle mesh, or as a black triangle, depending on which picking is enabled:private voiddrawPoint(int iIndex)Draw the user-selected point as a sphere on the triangle mesh:private voiddrawTriangle(int iV0, int iV1, int iV2)Draw the user-selected triangle as a black triangle, save the original color so it can be restored:javax.swing.JPanelgetMainPanel()Return the main panel display.floatgetMaxCurvature()return the max mean curvature:WildMagic.LibGraphics.SceneGraph.NodegetMeshLines()floatgetMinCurvature()return the min mean curvature:JPanelBrainSurfaceFlattener_WMgetPanel()voidinflation()perform inflation step and then render shapes using the average convexity colors.voidinit(com.jogamp.opengl.GLAutoDrawable arg0)booleanisCorrespondencePickEnabled()Return whether or not picking correspondence points is enabled:booleanisPuncturePickEnabled()Return whether or not picking the puncture triangle is enabled:voidmouseDragged(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)protected voidPick()Picking.voidremovePoints()Remove all points drawn on the mesh, sphere, and plane:private voidRender()Render the scene.voidresizePanel(int panelWidth, int frameHeight)Resizing the control panel with ViewJFrameVolumeView's frame width and height.private voidrestoreTriColor()Resets the previously picked triangle to it's original color:private voidsetColorsLUT()Update the colormap based on the LUT:voidsetLUTConvexity(ModelLUT kLUT)Update the colormap based on the LUT:voidsetLUTCurvature(ModelLUT kLUT)Update the colormap based on the LUT:booleansetup(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kCenter)Perform all initialization prior to executing.voidsetupLatLon(int iNumLat, int iNumLon)Called when the mesh is created, or when the number of latitude or longitude lines is changed by the user.voidtoggleLatLonLines(boolean bDisplay)Toggle between displaying the latitude and longitude lines:voidtogglePickCorrespondence()Enables picking with the mouse and drawing the curve on the mesh.voidtogglePickPuncture()Enables picking with the mouse and drawing the curve on the mesh.voidupdateLighting(WildMagic.LibGraphics.Rendering.Light[] akGLights)Called from JPanelLight.-
Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.GPURenderBase
AddNode, checkIfSpaceNavNeedsCalibration, 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, keyPressed, Move, 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, 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, mouseMoved, mouseReleased, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
m_kParent
protected VolumeTriPlanarInterface m_kParent
Parent user-interface and display frame.
-
m_aiTriIndex
private int[] m_aiTriIndex
Point indices of the puncture triangle.
-
m_akTriColors
private WildMagic.LibFoundation.Mathematics.ColorRGBA[] m_akTriColors
puncture triangle color
-
m_akPickColors
private WildMagic.LibFoundation.Mathematics.ColorRGB[] m_akPickColors
Colors for the picked points:.
-
m_bCurvatureColors
private boolean m_bCurvatureColors
Flag set to indicate whether curvature colors are rendered on the mesh surface. If not, then average convexity colors are rendered.
-
m_bInflationInitialized
private boolean m_bInflationInitialized
Flag set once inflation processing has been initialized.
-
m_bPickCorrespondenceEnabled
private boolean m_bPickCorrespondenceEnabled
Turned on when picking with the mouse is enabled:.
-
m_bPickPunctureEnabled
private boolean m_bPickPunctureEnabled
Enable/disable picking puncture triangle
-
m_iNumPicked
private int m_iNumPicked
number of picked points displayed.
-
m_iRunningNumPicked
private int m_iRunningNumPicked
Cycle through the number of correspondence points.
-
m_kCortical
private MjCorticalMesh_WM m_kCortical
Cortical mesh to be used in rendering scene.
-
m_kLUTConvexity
private ModelLUT m_kLUTConvexity
LUT for the triangle mesh convexity colors.
-
m_kLUTCurvature
private ModelLUT m_kLUTCurvature
local reference to ModelLUT.
-
m_kPanel
private JPanelBrainSurfaceFlattener_WM m_kPanel
BrainSurfaceFlattener User-Interface panel
-
MAX_POINTS
private int MAX_POINTS
Maximum number of correspondence points.
-
m_bFirst
private boolean m_bFirst
First time the scene is rendered.
-
m_kSphere
private VolumeSurface m_kSphere
Sphere renderer.
-
m_kCylinder
private VolumeSurface m_kCylinder
Cylinder renderer
-
m_kSphereLines
private VolumeNode m_kSphereLines
Sphere longitude/latitude lines.
-
m_kCylinderLines
private VolumeNode m_kCylinderLines
Cylinder longitude/latitude lines.
-
m_kMeshLines
private WildMagic.LibGraphics.SceneGraph.Node m_kMeshLines
TriMesh longitude/latitude lines.
-
m_bDisplayLines
private boolean m_bDisplayLines
Toggle latitude/longitude display on/off.
-
m_kSpherePoints
private VolumeNode m_kSpherePoints
Scene-graph node for displaying correspondence points on the sphere.
-
m_kCylinderPoints
private VolumeNode m_kCylinderPoints
Scene-graph node for displaying correspondence points on the cylinder.
-
m_kMeshPoints
private WildMagic.LibGraphics.SceneGraph.Node m_kMeshPoints
Scene-graph node for displaying correspondence points on the TriMesh surface.
-
m_iNumLat
private int m_iNumLat
-
m_iNumLon
private int m_iNumLon
-
-
Constructor Detail
-
CorticalAnalysisRender
public CorticalAnalysisRender(VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB)
Construct the BrainSurfaceFlattener renderer.- 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.
-
CorticalAnalysisRender
public CorticalAnalysisRender(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB)
-
-
Method Detail
-
addSurface
public VolumeSurface addSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kSurfaces)
Add a surface to the display list.- Parameters:
kSurfaces-- Returns:
- VolumeSurface representation.
-
calculateConformal
public void calculateConformal()
Called on setup, when a new triangle mesh is loaded, or when the puncture triangle is selected and the "recalculate conformal" button is pressed by the user:
-
display
public void display(com.jogamp.opengl.GLAutoDrawable arg0)
- Specified by:
displayin interfacecom.jogamp.opengl.GLEventListener
-
displayConvexityColors
public void displayConvexityColors()
toggle between display of mean curvature-based colors and average convexity-based colors.
-
displayCurvatureColors
public void displayCurvatureColors()
toggle between display of mean curvature-based colors and average convexity-based colors.
-
displayPlane
public void displayPlane()
Switch to displaying the plane:
-
displaySphere
public void displaySphere()
Switch to displaying the sphere:
-
dispose
public void dispose(com.jogamp.opengl.GLAutoDrawable kDrawable)
Description copied from class:GPURenderBasememory cleanup.- Specified by:
disposein interfacecom.jogamp.opengl.GLEventListener- Overrides:
disposein classGPURenderBase
-
drawPicked
public void drawPicked(int iV0, int iV1, int iV2)Draw the user-selected point, either as a sphere on the triangle mesh, or as a black triangle, depending on which picking is enabled:- Parameters:
iV0- index 0 of the picked triangle.iV1- index 1 of the picked triangle.iV2- index 2 of the picked triangle.
-
getMainPanel
public javax.swing.JPanel getMainPanel()
Return the main panel display.- Returns:
- main panel display.
-
getMaxCurvature
public float getMaxCurvature()
return the max mean curvature:- Returns:
- max mean curvature.
-
getMeshLines
public WildMagic.LibGraphics.SceneGraph.Node getMeshLines()
- Returns:
- scene-graph Node containing the TriMesh latitude/longitude lines.
-
getMinCurvature
public float getMinCurvature()
return the min mean curvature:- Returns:
- min mean curvature.
-
getPanel
public JPanelBrainSurfaceFlattener_WM getPanel()
-
inflation
public void inflation()
perform inflation step and then render shapes using the average convexity colors.
-
init
public void init(com.jogamp.opengl.GLAutoDrawable arg0)
- Specified by:
initin interfacecom.jogamp.opengl.GLEventListener
-
isCorrespondencePickEnabled
public boolean isCorrespondencePickEnabled()
Return whether or not picking correspondence points is enabled:- Returns:
- true when picking correspondence points in enabled, false otherwise.
-
isPuncturePickEnabled
public boolean isPuncturePickEnabled()
Return whether or not picking the puncture triangle is enabled:- Returns:
- true when picking the puncture triangle is enabled, false otherwise.
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseDraggedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener- Overrides:
mousePressedin classGPURenderBase
-
removePoints
public void removePoints()
Remove all points drawn on the mesh, sphere, and plane:
-
resizePanel
public void resizePanel(int panelWidth, int frameHeight)Resizing the control panel with ViewJFrameVolumeView's frame width and height.- Parameters:
panelWidth- int widthframeHeight- int height
-
setLUTConvexity
public void setLUTConvexity(ModelLUT kLUT)
Update the colormap based on the LUT:- Parameters:
kLUT- new LUT.
-
setLUTCurvature
public void setLUTCurvature(ModelLUT kLUT)
Update the colormap based on the LUT:- Parameters:
kLUT- new LUT.
-
setup
public boolean setup(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kCenter)Perform all initialization prior to executing. Loads the sample mesh surface and sets up the rendering of the scene.- Parameters:
kMesh- , TriMesh.
-
setupLatLon
public void setupLatLon(int iNumLat, int iNumLon)Called when the mesh is created, or when the number of latitude or longitude lines is changed by the user. When the user changes the number of latitude or longitude lines, the meshes are removed from the scene and recreated.- Parameters:
iNumLat- number of latitude lines to display.iNumLon- number of longitude lines to display.
-
toggleLatLonLines
public void toggleLatLonLines(boolean bDisplay)
Toggle between displaying the latitude and longitude lines:- Parameters:
bDisplay- display on/off.
-
togglePickCorrespondence
public void togglePickCorrespondence()
Enables picking with the mouse and drawing the curve on the mesh.
-
togglePickPuncture
public void togglePickPuncture()
Enables picking with the mouse and drawing the curve on the mesh.
-
updateLighting
public void updateLighting(WildMagic.LibGraphics.Rendering.Light[] akGLights)
Called from JPanelLight. Updates the lighting parameters.- Overrides:
updateLightingin classGPURenderBase- Parameters:
akGLights- the set of GeneralLight objects.
-
closestPlanePointIndex
private float closestPlanePointIndex(WildMagic.LibGraphics.Collision.PickRecord kPickPoint)
For the plane, all vertices have z-value set to zero. Because the mesh is closed, even for the plane, the edge triangles wrap around the back of the mesh, and are co-planar with the forward-facing triangles (the ones that display the data) -- when picking is done, the pickClosest sometimes returns the back-facing triangle. This function returns the correct, visible triangle for the plane:- Parameters:
kPickPoint- , the PickRecord containing information about the picked triangle.- Returns:
- the minimum distance to the plane.
-
CreateScene
private void CreateScene()
Called by the init() function. Creates and initialized the scene-graph.
-
drawPoint
private void drawPoint(int iIndex)
Draw the user-selected point as a sphere on the triangle mesh:- Parameters:
iIndex- the index of the TriMesh vertex at which to draw the sphere.
-
drawTriangle
private void drawTriangle(int iV0, int iV1, int iV2)Draw the user-selected triangle as a black triangle, save the original color so it can be restored:- Parameters:
iV0- triangle index 0.iV1- triangle index 1.iV2- triangle index 2.
-
Render
private void Render()
Render the scene.
-
restoreTriColor
private void restoreTriColor()
Resets the previously picked triangle to it's original color:
-
setColorsLUT
private void setColorsLUT()
Update the colormap based on the LUT:
-
Pick
protected void Pick()
Picking.
-
-