java.lang.Object
java.awt.Component
java.awt.Canvas
javax.media.j3d.Canvas3D
gov.nih.mipav.view.renderer.J3D.VolumeCanvas3D
gov.nih.mipav.view.renderer.J3D.RenderViewBase
gov.nih.mipav.view.renderer.J3D.surfaceview.brainflattenerview.MjCorticalAnalysis
All Implemented Interfaces:
com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, ViewImageUpdateInterface, ActionListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class MjCorticalAnalysis extends RenderViewBase implements MouseListener, MouseMotionListener
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_aiTriIndex

      private int[] m_aiTriIndex
      DOCUMENT ME!
    • m_akPickColors

      private javax.vecmath.Color3f[] m_akPickColors
      Colors for the picked points:.
    • m_akTriColors

      private javax.vecmath.Color4f[] m_akTriColors
      DOCUMENT ME!
    • 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_bMousePressed

      private boolean m_bMousePressed
      Mouse events. Setting mousePressed and mouseReleased explicitly when the mouse events are received has deals with getting multiply mouse event notifications for the same mouse press.
    • m_bMouseReleased

      private boolean m_bMouseReleased
      DOCUMENT ME!
    • m_bPickCorrespondenceEnabled

      private boolean m_bPickCorrespondenceEnabled
      Turned on when picking with the mouse is enabled:.
    • m_bPickPunctureEnabled

      private boolean m_bPickPunctureEnabled
      DOCUMENT ME!
    • m_iNumPicked

      private int m_iNumPicked
      number of picked points displayed.
    • m_iRunningNumPicked

      private int m_iRunningNumPicked
      DOCUMENT ME!
    • m_kCortical

      private MjCorticalMesh m_kCortical
      Cortical mesh to be used in rendering scene.
    • m_kGeometryArrayPlane

      private javax.media.j3d.GeometryArray m_kGeometryArrayPlane
      DOCUMENT ME!
    • m_kGeometryArraySphere

      private javax.media.j3d.GeometryArray m_kGeometryArraySphere
      DOCUMENT ME!
    • m_kLUTConvexity

      private ModelLUT m_kLUTConvexity
      DOCUMENT ME!
    • m_kLUTCurvature

      private ModelLUT m_kLUTCurvature
      local reference to ModelLUT.
    • m_kMeshBranchRoot

      private javax.media.j3d.BranchGroup m_kMeshBranchRoot
      BranchGroups for the Meshlines, for deleting and recreating the meshlines when the user changes the number of latitude and longitude lines:.
    • m_kMeshLinesBranchRoot

      private javax.media.j3d.BranchGroup m_kMeshLinesBranchRoot
      DOCUMENT ME!
    • m_kMouseEvent

      private MouseEvent m_kMouseEvent
      DOCUMENT ME!
    • m_kPanel

      private JPanelBrainSurfaceFlattener m_kPanel
      DOCUMENT ME!
    • m_kPickCanvas

      private com.sun.j3d.utils.picking.PickCanvas m_kPickCanvas
      DOCUMENT ME!
    • m_kShapeMesh

      private javax.media.j3d.Shape3D m_kShapeMesh
      DOCUMENT ME!
    • m_kShapePlane

      private javax.media.j3d.Shape3D m_kShapePlane
      DOCUMENT ME!
    • m_kShapeSphere

      private javax.media.j3d.Shape3D m_kShapeSphere
      DOCUMENT ME!
    • m_kSwitchDisplay

      private javax.media.j3d.Switch m_kSwitchDisplay
      Switch between displaying the Sphere and the Plane:.
    • m_kSwitchLinesMesh

      private javax.media.j3d.Switch m_kSwitchLinesMesh
      This node contains the latitude/longitude renderings for the mesh which can be enabled/disabled.
    • m_kSwitchLinesPlane

      private javax.media.j3d.Switch m_kSwitchLinesPlane
      This node contains the latitude/longitude renderings for the plane which can be enabled/disabled.
    • m_kSwitchLinesPlaneBranch

      private javax.media.j3d.BranchGroup m_kSwitchLinesPlaneBranch
      DOCUMENT ME!
    • m_kSwitchLinesSphere

      private javax.media.j3d.Switch m_kSwitchLinesSphere
      This node contains the latitude/longitude renderings for the sphere which can be enabled/disabled.
    • m_kSwitchLinesSphereBranch

      private javax.media.j3d.BranchGroup m_kSwitchLinesSphereBranch
      DOCUMENT ME!
    • m_kTransformGroupActive

      private javax.media.j3d.TransformGroup m_kTransformGroupActive
      Currently selected transform that gets modified by the handler for the keyboard behavior.
    • m_kTransformGroupMesh

      private javax.media.j3d.TransformGroup m_kTransformGroupMesh
      DOCUMENT ME!
    • m_kTransformGroupPlane

      private javax.media.j3d.TransformGroup m_kTransformGroupPlane
      DOCUMENT ME!
    • m_kTransformGroupPoseMesh

      private javax.media.j3d.TransformGroup m_kTransformGroupPoseMesh
      This node contains all of the cortical mesh related nodes in the scene which can be manipulated as a group.
    • m_kTransformGroupPosePlane

      private javax.media.j3d.TransformGroup m_kTransformGroupPosePlane
      This node contains all of the plane related nodes in the scene which can be manipulated as a group.
    • m_kTransformGroupPoseSphere

      private javax.media.j3d.TransformGroup m_kTransformGroupPoseSphere
      This node contains all of the sphere related nodes in the scene which can be manipulated as a group.
    • m_kTransformGroupSphere

      private javax.media.j3d.TransformGroup m_kTransformGroupSphere
      DOCUMENT ME!
    • m_kTriangleMesh

      private ModelTriangleMesh m_kTriangleMesh
      Geometry for the rendering of the cortical mesh is maintained here so that the scene can be updated when the mesh is inflated.
    • MAX_POINTS

      private int MAX_POINTS
      DOCUMENT ME!
    • MESH

      private int MESH
      DOCUMENT ME!
    • PLANE

      private int PLANE
      DOCUMENT ME!
    • SPHERE

      private int SPHERE
      DOCUMENT ME!
  • Constructor Details

    • MjCorticalAnalysis

      public MjCorticalAnalysis(ModelImage _imageA, ModelImage _imageB, GraphicsConfiguration _config, ViewJFrameVolumeView kParent)
      A simple universe is created that contains a viewing platform. A canvas is created and attached to the simple universe and is added to this instance The canvas is used for the 3D rendering. An initially empty scene graph for the application is created and assigned to the universe.
      Parameters:
      _imageA - DOCUMENT ME!
      _imageB - DOCUMENT ME!
      _config - DOCUMENT ME!
      kParent - DOCUMENT ME!
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
      actionPerformed.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - ActionEvent
    • 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:
    • displayConvexityColors

      public boolean displayConvexityColors()
      toggle between display of mean curvature-based colors and average convexity-based colors.
      Returns:
      DOCUMENT ME!
    • displayCurvatureColors

      public boolean displayCurvatureColors()
      toggle between display of mean curvature-based colors and average convexity-based colors.
      Returns:
      DOCUMENT ME!
    • displayPlane

      public void displayPlane()
      Switch to displaying the plane:
    • displaySphere

      public void displaySphere()
      Switch to displaying the sphere:
    • disposeLocal

      public void disposeLocal()
      DOCUMENT ME!
      Overrides:
      disposeLocal in class RenderViewBase
    • drawPicked

      public void drawPicked(javax.vecmath.Point3f kStart, int[] aiIndex, int iWhich)
      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:
      kStart - DOCUMENT ME!
      aiIndex - DOCUMENT ME!
      iWhich - DOCUMENT ME!
    • getMainPanel

      public JPanel getMainPanel()
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getMaxAverageConvexity

      public float getMaxAverageConvexity()
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getMaxCurvature

      public float getMaxCurvature()
      return the max mean curvature:
      Returns:
      DOCUMENT ME!
    • getMesh

      public javax.media.j3d.BranchGroup getMesh()
      Display the mesh in the SurfaceRenderer:
      Returns:
      a Branchgroup containing a copy of the ModelTriangleMesh
    • getMeshLines

      public javax.media.j3d.BranchGroup getMeshLines()
      Display the mesh lines in the SurfaceRenderer:
      Returns:
      a BranchGroup containing a copy of the TriangleMesh Lat/Lon Lines
    • getMinAverageConvexity

      public float getMinAverageConvexity()
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getMinCurvature

      public float getMinCurvature()
      return the min mean curvature:
      Returns:
      DOCUMENT ME!
    • getSceneState

      public Object getSceneState()
      Gets the scene state in terms of slices visible, which slice number, etc.
      Specified by:
      getSceneState in class RenderViewBase
      Returns:
      A private object extension specific to the class that extends this one.
    • getTMesh

      public ModelTriangleMesh getTMesh()
      Display the mesh in the SurfaceRenderer:
      Returns:
      DOCUMENT ME!
    • inflation

      public boolean inflation()
      perform inflation step and then render shapes using the average convexity colors.
      Returns:
      DOCUMENT ME!
    • isCorrespondencePickEnabled

      public boolean isCorrespondencePickEnabled()
      Return whether or not picking correspondence points is enabled:
      Returns:
      DOCUMENT ME!
    • isPickEnabled

      public boolean isPickEnabled()
      Returns whether or not picking is enabled:
      Returns:
      DOCUMENT ME!
    • isPuncturePickEnabled

      public boolean isPuncturePickEnabled()
      Return whether or not picking the puncture triangle is enabled:
      Returns:
      DOCUMENT ME!
    • mouseClicked

      public void mouseClicked(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      kEvent - the mouse event generated by a mouse clicked
    • mouseDragged

      public void mouseDragged(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      kEvent - the mouse event generated by a mouse drag
    • mouseEntered

      public void mouseEntered(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      kEvent - the mouse event generated by a mouse entered
    • mouseExited

      public void mouseExited(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      kEvent - the mouse event generated by a mouse exit
    • mouseMoved

      public void mouseMoved(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      kEvent - the event generated by a mouse movement
    • mousePressed

      public void mousePressed(MouseEvent kMouseEvent)
      DOCUMENT ME!
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      kMouseEvent - the mouse event generated by a mouse press
    • mouseReleased

      public void mouseReleased(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      kEvent - the mouse event generated by a mouse release
    • removePoints

      public void removePoints()
      Remove all points drawn on the mesh, sphere, and plane:
    • setAlphaBlend

      public void setAlphaBlend(int value)
      Sets the alpha blending of parameter for two image displaying.
      Specified by:
      setAlphaBlend in class RenderViewBase
      Parameters:
      value - amount [0,100] that is the percentage of Image A to be displayed and (1-percentage) of Image B to be displayed
    • setGUI

      public void setGUI(Object scene)
      Used by the JPanelMouse the redisplay the recorded actions.
      Specified by:
      setGUI in class RenderViewBase
      Parameters:
      scene - Object
    • setLUTConvexity

      public void setLUTConvexity(ModelLUT kLUT)
      DOCUMENT ME!
      Parameters:
      kLUT - DOCUMENT ME!
    • setLUTCurvature

      public void setLUTCurvature(ModelLUT kLUT)
      Update the colormap based on the LUT:
      Parameters:
      kLUT - DOCUMENT ME!
    • setRGBTA

      public void setRGBTA(ModelRGB RGBT)
      setRGBTA.
      Specified by:
      setRGBTA in class RenderViewBase
      Parameters:
      RGBT - ModelRGB
    • setRGBTB

      public void setRGBTB(ModelRGB RGBT)
      setRGBTB.
      Specified by:
      setRGBTB in class RenderViewBase
      Parameters:
      RGBT - ModelRGB
    • setSlice

      public void setSlice(int slice)
      setSlice.
      Specified by:
      setSlice in interface ViewImageUpdateInterface
      Parameters:
      slice - int
    • setTimeSlice

      public void setTimeSlice(int tSlice)
      setTimeSlice.
      Specified by:
      setTimeSlice in interface ViewImageUpdateInterface
      Parameters:
      tSlice - int
    • setup

      public void setup(ModelTriangleMesh kTriangleMesh)
      Perform all initialization prior to executing. Loads the sample mesh surface and sets up the rendering of the scene.
      Parameters:
      kTriangleMesh - DOCUMENT ME!
    • 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 - DOCUMENT ME!
      iNumLon - DOCUMENT ME!
    • stateChanged

      public void stateChanged(ChangeEvent e)
      stateChanged.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - ChangeEvent
    • toggleLatLonLines

      public void toggleLatLonLines()
      Toggle between displaying the latitude and longitude lines:
    • 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.
    • transformChanged

      public void transformChanged(int type, javax.media.j3d.Transform3D transform)
      transformChanged.
      Specified by:
      transformChanged in interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
      Parameters:
      type - int
      transform - Transform3D
    • updateImageExtents

      public boolean updateImageExtents()
      updateImageExtents.
      Specified by:
      updateImageExtents in interface ViewImageUpdateInterface
      Returns:
      boolean
    • updateImages

      public boolean updateImages()
      updateImages.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Returns:
      boolean
    • updateImages

      public boolean updateImages(boolean flag)
      updateImages.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      flag - boolean
      Returns:
      boolean
    • updateImages

      public boolean updateImages(ModelLUT LUTa, ModelLUT LUTb, boolean flag, int interpMode)
      updateImages.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      LUTa - ModelLUT
      LUTb - ModelLUT
      flag - boolean
      interpMode - int
      Returns:
      boolean
    • finalize

      protected void finalize() throws Throwable
      DOCUMENT ME!
      Overrides:
      finalize in class Object
      Throws:
      Throwable - DOCUMENT ME!
    • combine

      private static javax.vecmath.Point3f[] combine(javax.vecmath.Point3f[] akPointA, javax.vecmath.Point3f[] akPointB)
      DOCUMENT ME!
      Parameters:
      akPointA - DOCUMENT ME!
      akPointB - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • createGeometry

      private static javax.media.j3d.GeometryArray createGeometry(javax.vecmath.Point3f[] akPoint, javax.vecmath.Color4f[] akColor, int[] aiConnect)
      DOCUMENT ME!
      Parameters:
      akPoint - DOCUMENT ME!
      akColor - DOCUMENT ME!
      aiConnect - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • createTriangleMesh

      private static ModelTriangleMesh createTriangleMesh(javax.vecmath.Point3f[] akPoint, javax.vecmath.Vector3f[] akNormal, javax.vecmath.Color4f[] akColor, int[] aiConnect)
      DOCUMENT ME!
      Parameters:
      akPoint - DOCUMENT ME!
      akNormal - DOCUMENT ME!
      akColor - DOCUMENT ME!
      aiConnect - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getTranslateToCenter

      private static javax.vecmath.Vector3d getTranslateToCenter(javax.media.j3d.Shape3D kShape)
      DOCUMENT ME!
      Parameters:
      kShape - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • setColors

      private static void setColors(float fCMin, float fCMax, float[] afCArray, int iVQuantity, javax.vecmath.Color4f[] akColor)
      DOCUMENT ME!
      Parameters:
      fCMin - DOCUMENT ME!
      fCMax - DOCUMENT ME!
      afCArray - DOCUMENT ME!
      iVQuantity - DOCUMENT ME!
      akColor - DOCUMENT ME!
    • closestPlanePointIndex

      private float closestPlanePointIndex(javax.vecmath.Point3f kStart, int[] aiIndex)
      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:
      kStart - DOCUMENT ME!
      aiIndex - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • drawPoint

      private void drawPoint(javax.vecmath.Point3f kStart, int[] aiIndex, int iWhich)
      Draw the user-selected point as a sphere on the triangle mesh:
      Parameters:
      kStart - DOCUMENT ME!
      aiIndex - DOCUMENT ME!
      iWhich - DOCUMENT ME!
    • drawTriangle

      private void drawTriangle(javax.vecmath.Point3f kStart, int[] aiIndex, int iWhich)
      Draw the user-selected triangle as a black triangle, save the original color so it can be restored:
      Parameters:
      kStart - DOCUMENT ME!
      aiIndex - DOCUMENT ME!
      iWhich - DOCUMENT ME!
    • restoreTriColor

      private void restoreTriColor()
      Resets the previously picked triangle to it's orginal color:
    • setColorsLUT

      private void setColorsLUT()
      Update the colormap based on the LUT:
    • setupLight

      private void setupLight()
      Sets up a direction lightsource for the scene.