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,KeyListener,MouseListener,MouseMotionListener,MouseWheelListener,Serializable,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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int[]Point indices of the puncture triangle.private WildMagic.LibFoundation.Mathematics.ColorRGB[]Colors for the picked points:.private WildMagic.LibFoundation.Mathematics.ColorRGBA[]puncture triangle colorprivate booleanFlag set to indicate whether curvature colors are rendered on the mesh surface.private booleanToggle latitude/longitude display on/off.private booleanFirst time the scene is rendered.private booleanFlag set once inflation processing has been initialized.private booleanTurned on when picking with the mouse is enabled:.private booleanEnable/disable picking puncture triangleprivate intprivate intprivate intnumber of picked points displayed.private intCycle through the number of correspondence points.private MjCorticalMesh_WMCortical mesh to be used in rendering scene.private VolumeSurfaceCylinder rendererprivate VolumeNodeCylinder longitude/latitude lines.private VolumeNodeScene-graph node for displaying correspondence points on the cylinder.private ModelLUTLUT for the triangle mesh convexity colors.private ModelLUTlocal reference to ModelLUT.private WildMagic.LibGraphics.SceneGraph.NodeTriMesh longitude/latitude lines.private WildMagic.LibGraphics.SceneGraph.NodeScene-graph node for displaying correspondence points on the TriMesh surface.private JPanelBrainSurfaceFlattener_WMBrainSurfaceFlattener User-Interface panelprotected VolumeTriPlanarInterfaceParent user-interface and display frame.private VolumeSurfaceSphere renderer.private VolumeNodeSphere longitude/latitude lines.private VolumeNodeScene-graph node for displaying correspondence points on the sphere.private intMaximum number of correspondence points.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
ConstructorsConstructorDescriptionCorticalAnalysisRender(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
Modifier and TypeMethodDescriptionaddSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kSurfaces) Add a surface to the display list.voidCalled 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 voidCalled by the init() function.voiddisplay(com.jogamp.opengl.GLAutoDrawable arg0) voidtoggle between display of mean curvature-based colors and average convexity-based colors.voidtoggle between display of mean curvature-based colors and average convexity-based colors.voidSwitch to displaying the plane:voidSwitch 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:Return the main panel display.floatreturn the max mean curvature:WildMagic.LibGraphics.SceneGraph.Nodefloatreturn the min mean curvature:getPanel()voidperform inflation step and then render shapes using the average convexity colors.voidinit(com.jogamp.opengl.GLAutoDrawable arg0) booleanReturn whether or not picking correspondence points is enabled:booleanReturn whether or not picking the puncture triangle is enabled:voidvoidprotected voidPick()Picking.voidRemove 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 voidResets the previously picked triangle to it's original color:private voidUpdate 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:voidEnables picking with the mouse and drawing the curve on the mesh.voidEnables 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, 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, 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, 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 com.jogamp.opengl.GLEventListener
reshapeMethods inherited from interface java.awt.event.KeyListener
keyReleased, keyTypedMethods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mouseReleasedMethods 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_aiTriIndex
private int[] m_aiTriIndexPoint indices of the puncture triangle. -
m_akTriColors
private WildMagic.LibFoundation.Mathematics.ColorRGBA[] m_akTriColorspuncture triangle color -
m_akPickColors
private WildMagic.LibFoundation.Mathematics.ColorRGB[] m_akPickColorsColors for the picked points:. -
m_bCurvatureColors
private boolean m_bCurvatureColorsFlag 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_bInflationInitializedFlag set once inflation processing has been initialized. -
m_bPickCorrespondenceEnabled
private boolean m_bPickCorrespondenceEnabledTurned on when picking with the mouse is enabled:. -
m_bPickPunctureEnabled
private boolean m_bPickPunctureEnabledEnable/disable picking puncture triangle -
m_iNumPicked
private int m_iNumPickednumber of picked points displayed. -
m_iRunningNumPicked
private int m_iRunningNumPickedCycle through the number of correspondence points. -
m_kCortical
Cortical mesh to be used in rendering scene. -
m_kLUTConvexity
LUT for the triangle mesh convexity colors. -
m_kLUTCurvature
local reference to ModelLUT. -
m_kPanel
BrainSurfaceFlattener User-Interface panel -
MAX_POINTS
private int MAX_POINTSMaximum number of correspondence points. -
m_bFirst
private boolean m_bFirstFirst time the scene is rendered. -
m_kSphere
Sphere renderer. -
m_kCylinder
Cylinder renderer -
m_kSphereLines
Sphere longitude/latitude lines. -
m_kCylinderLines
Cylinder longitude/latitude lines. -
m_kMeshLines
private WildMagic.LibGraphics.SceneGraph.Node m_kMeshLinesTriMesh longitude/latitude lines. -
m_bDisplayLines
private boolean m_bDisplayLinesToggle latitude/longitude display on/off. -
m_kSpherePoints
Scene-graph node for displaying correspondence points on the sphere. -
m_kCylinderPoints
Scene-graph node for displaying correspondence points on the cylinder. -
m_kMeshPoints
private WildMagic.LibGraphics.SceneGraph.Node m_kMeshPointsScene-graph node for displaying correspondence points on the TriMesh surface. -
m_iNumLat
private int m_iNumLat -
m_iNumLon
private int m_iNumLon
-
-
Constructor Details
-
CorticalAnalysisRender
public CorticalAnalysisRender(VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB) Construct the BrainSurfaceFlattener renderer.- Parameters:
kParent- parent user-interface and frame.kVolumeImageA- volume data and textures for ModelImage A.kVolumeImageB- volume data and textures for ModelImage B.kAnimator- animator used to display the canvas.
-
CorticalAnalysisRender
public CorticalAnalysisRender(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB)
-
-
Method Details
-
addSurface
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
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
-
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
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classWildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- 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
Update the colormap based on the LUT:- Parameters:
kLUT- new LUT.
-
setLUTCurvature
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.
-