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 Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • 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

      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 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

      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:
      display in interface com.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: GPURenderBase
      memory cleanup.
      Specified by:
      dispose in interface com.jogamp.opengl.GLEventListener
      Overrides:
      dispose in class GPURenderBase
    • 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 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:
      init in interface com.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(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class GPURenderBase
    • 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 width
      frameHeight - 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:
      updateLighting in class GPURenderBase
      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.