Class JPanelSurface

All Implemented Interfaces:
ActionListener, FocusListener, ItemListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, ListSelectionListener

A Java3D-based dialog for surfaces represented as triangle meshes. The surfaces are displayed in the 3D viewer that already contains a 3D image. The mouse behavior is the same for the image as it is for the surfaces, so that when the user zooms or rotates, it looks like the surfaces are part of the tri-image.
Author:
David Eberly, Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • fixedColor

      private static javax.vecmath.Color3f[] fixedColor
      The colors for the surfaces.
    • activeLightBulbIndex

      private int activeLightBulbIndex
      Record the current active index of light bulb, which is being picked.
    • areaLabel

      private JLabel areaLabel
      The area label.
    • areaText

      private JTextField areaText
      Displays the area of triangle.
    • colorButton

      private JButton colorButton
      The color button, which calls a color chooser.
    • colorChooser

      private ViewJColorChooser colorChooser
      Color chooser for when the user wants to change the color of the surface.
    • colorLabel

      private JLabel colorLabel
      The color button label.
    • comboLabel

      private JLabel comboLabel
      The polygon mode combo box label.
    • currentIndex

      private int currentIndex
      Current surface index being highlighted.
    • decimateButton

      private JButton decimateButton
      Decimate button.
    • detailLabel

      private JLabel detailLabel
      The level of detail slider label.
    • detailSlider

      private JSlider detailSlider
      Level of detail slider.
    • detailSliderLabels

      private JLabel[] detailSliderLabels
      The labels below the detail slider.
    • findArbitraryClipping

      private boolean findArbitraryClipping
      flag indicates arbitrary clpping bounding frame being picked.
    • findProbe

      private boolean findProbe
      flag indicates the probe being picked.
    • levelSButton

      private JButton levelSButton
      Save surface button.
    • levelVButton

      private JButton levelVButton
      Save surface button.
    • levelWButton

      private JButton levelWButton
      Save surface button.
    • levelXMLButton

      private JButton levelXMLButton
      Save surface button.
    • lightArray

      private javax.media.j3d.Light[] lightArray
      An array of eight lights that can be used for illuminating the surfaces in the scene. The lights at indices 0 and 7 are initially enabled; the other lights are initially disabled. The default positions for the lights are at the 8 corners of the cube [0,1]^3. Light 0 is at (0,0,0) and light 7 is at (1,1,1), thereby providing suitable lighting for the visible surfaces in the scene. Other lights can be enabled as desired through the light attribute dialog.
    • lightArrayBG

      private javax.media.j3d.BranchGroup[] lightArrayBG
      The branch groups to which the lights are attached.
    • lightBulbs

      private ViewJComponentLightBulbs lightBulbs
      The structure for the light bulbs.
    • m_aiMapIndexToJPanelLightsIndex

      private final int[] m_aiMapIndexToJPanelLightsIndex
      The index of the lights in JPanelLights is different from the order maintained here. This array maps from our index to JPanelLights' index.
    • m_aiMapJPanelLightsIndexToIndex

      private final int[] m_aiMapJPanelLightsIndexToIndex
      The index of the lights in JPanelLights is different from the order maintained here. This array maps from JPanelLights' index to our index.
    • m_akLights

      private GeneralLight[] m_akLights
      The description of the lights so they can be duplicated in the "Advanced Material Properties" dialog:.
    • m_kAdvancedMaterialOptionsButton

      private JButton m_kAdvancedMaterialOptionsButton
      The material options button, which launches the material editor window.
    • m_kGeodesicGroup

      private javax.media.j3d.BranchGroup m_kGeodesicGroup
      For drawing the geodesic lines on the triangle mesh:.
    • m_kFiberTractGroup

      javax.media.j3d.BranchGroup m_kFiberTractGroup
      For displaying the fiber bundle tracts in the orthogonal slice view:
    • m_kLightsControl

      private JPanelLights m_kLightsControl
      Light dialog for when the user clicks the light button.
    • m_kPathPositionTG

      private javax.media.j3d.TransformGroup m_kPathPositionTG
      For drawing the flythru path in the triangle mesh:.
    • m_kStereoButton

      private JButton m_kStereoButton
      Stereo render button, launches the JStereoWindow for viewing the ModelTriangleMesh in stereo:.
    • m_kSurfaceTextureButton

      private JButton m_kSurfaceTextureButton
      Opens SurfaceTexture dialog:.
    • maxBox

      private float maxBox
      ModelImage max dimension: (Extents * resolutions).
    • resolutions

      private float[] resolutions
    • extents

      private int[] extents
    • mSurfaceMask

      private SurfaceMask mSurfaceMask
      Surface mask.
    • mSurfacePaint

      private SurfacePaint mSurfacePaint
      Paint interface/algorithm for allowing the user to interactively paint the vertices of the ModelTriangleMesh.
    • opacityLabel

      private JLabel opacityLabel
      The opacity slider label.
    • opacitySlider

      private JSlider opacitySlider
      Opacity slider, not enabled yet.
    • opacitySliderLabels

      private JLabel[] opacitySliderLabels
      The labels below the opacity slider.
    • parentScene

      private SurfaceRender parentScene
      The parent object that holds necessary the structures to which the surfaces will be added and modified.
    • pickCanvas

      private com.sun.j3d.utils.picking.PickCanvas pickCanvas
      The PickCanvas object that ties together the canvas and the surfaces branch group to allow pick operations on the scene.
    • polygonModeCB

      private JComboBox polygonModeCB
      The combo box for the polygon mode to display.
    • scroller

      private JScrollPane scroller
      The scroll pane holding the panel content. Useful when the screen is small.
    • setSurfaceOpacityFlag

      private boolean setSurfaceOpacityFlag
      Indicator for the opacity slider moves.
    • smooth1Button

      private JButton smooth1Button
      Smooth button.
    • smooth2Button

      private JButton smooth2Button
      Smooth button.
    • smooth3Button

      private JButton smooth3Button
      Smooth button.
    • sphere

      private com.sun.j3d.utils.geometry.Sphere sphere
      Sphere showing where the user clicked in the surface.
    • sphereBranch

      private javax.media.j3d.BranchGroup sphereBranch
      Branch group parent of the sphere.
    • sphereShowing

      private boolean sphereShowing
      Flag indicating if the sphere is currently showing.
    • sphereTransform

      private javax.media.j3d.TransformGroup sphereTransform
      Transform group parent of the sphere.
    • staticLightBehaviorBG

      private javax.media.j3d.BranchGroup staticLightBehaviorBG
      Static light hehavior branch group.
    • staticLightBG

      private javax.media.j3d.BranchGroup staticLightBG
      The branch group that holds the static light bulb.
    • staticLightBulb

      private ViewJComponentLightBulbs staticLightBulb
      The structure for the static light bulb.
    • staticLightTG

      private javax.media.j3d.TransformGroup staticLightTG
      The transform group that holds the static light branch group.
    • staticLightTranslate

      private com.sun.j3d.utils.behaviors.mouse.MouseTranslate staticLightTranslate
      Static light translate behavior.
    • staticLightZoom

      private com.sun.j3d.utils.behaviors.mouse.MouseZoom staticLightZoom
      Static light zoom behavior.
    • surfaceBackFaceCB

      private JCheckBox surfaceBackFaceCB
      Check Box for surface back face culling.
    • surfaceClipCB

      private JCheckBox surfaceClipCB
      Check Box for surface clpping of the volume render.
    • surfaceDirectoryName

      private String surfaceDirectoryName
      The directory where a surface file was last loaded/saved. Defaults to MIPAV default directory.
    • surfaceList

      private JList surfaceList
      The list box in the dialog for surfaces.
    • surfaceOpacityEvents

      private MouseEventVector surfaceOpacityEvents
      Surface opacity changes event queue.
    • surfaceOpacitySlice

      private int surfaceOpacitySlice
      Surface volume opacity.
    • surfacePickableCB

      private JCheckBox surfacePickableCB
      Check Box for surface pickable.
    • surfaceRootBG

      private javax.media.j3d.BranchGroup surfaceRootBG
      The branch group that holds all the surfaces together.
    • surfaceRootTG

      private javax.media.j3d.TransformGroup surfaceRootTG
      The transform group to which the model lights are attached.
    • surfaceSliderCount

      private int surfaceSliderCount
      Counter for surface opacity slider moves.
    • surfaceTransparencyCB

      private JCheckBox surfaceTransparencyCB
      Check Box for surface transparency.
    • surfaceVector

      private Vector<SurfaceAttributes> surfaceVector
      A list of the surfaces. The elements are of type SurfaceAttributes.
    • triangleLabel

      private JLabel triangleLabel
      The number of triangles label.
    • triangleText

      private JTextField triangleText
      Displays the number of triangles.
    • volumeLabel

      private JLabel volumeLabel
      The volume label.
    • volumeText

      private JTextField volumeText
      Displays the volume of triangle.
  • Constructor Details

    • JPanelSurface

      public JPanelSurface(SurfaceRender parent, javax.media.j3d.Canvas3D canvas, javax.media.j3d.TransformGroup surfaceRoot, float xBox, float yBox, float zBox)
      Creates the Java3D scene graph for the application. The surfaces are all children of the BranchGroup surfaceRootBG, which is in turn a child of the TransformGroup in ViewJFrameTriImage3D. That transform group controls how both the surfaces and the three image planes are displayed; by making the surfaces a child of the transform, the surfaces and image planes move together. The BranchGroup created here is used for the PickCanvas, so that the pick tool ignores the image planes when the mouse is clicked and just looks for the surfaces.

      This constructor also adds lights to the scene. Because of the texture maps on the image planes, lights don't make a difference in how the image planes are displayed. Therefore, the lights are only necessary for the surfaces.

      Parameters:
      parent - SurfaceRender reference
      canvas - Canvas3D reference
      surfaceRoot - TransformGroup root to add surfaces
      xBox - red box x dimension
      yBox - red box y dimension
      zBox - red box z dimension
  • Method Details

    • getNewSurfaceColor

      public static javax.vecmath.Color4f getNewSurfaceColor(int index)
      static function returns the next default surface color, based on the current number of surfaces displayed. If the number of surfaces is less than the fixedColor.length then fixedColor is the source of the surface color, otherwise a random color is generated.
      Parameters:
      index - the number of the new surface
      Returns:
      Color4f, the default surface color for the new surface.
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      The override necessary to be an ActionListener. This callback is executed whenever the Add or Remove buttons are clicked, or when the color button or light button is clicked, or when the combo box changes. If the Add button is clicked, a file dialog is launched to allow the user to select new surface meshes to load from disk. If the Remove button is clicked, the currently selected surfaces in the list box are removed from the scene graph.
      Specified by:
      actionPerformed in interface ActionListener
      Specified by:
      actionPerformed in class JPanelRendererBase
      Parameters:
      event - The action event.
    • addAttachedSurfaces

      public void addAttachedSurfaces()
      Add any attached surfaces the current image has in its file info (if the file info is in the xml format).
    • addBranch

      public void addBranch(javax.media.j3d.BranchGroup kBranch, ModelTriangleMesh kMesh, javax.vecmath.Point3f kMeshCenter)
      Adds a BranchGroup to the display.
      Parameters:
      kBranch - BranchGroup branch group
      kMesh - ModelTriangleMesh surface mesh
      kMeshCenter - Point3f center of mass
    • addFlightPath

      public void addFlightPath(javax.media.j3d.Shape3D kPathShape, javax.vecmath.Point3f kPosition)
      Adds the flythru path shape and current view position to the display.
      Parameters:
      kPathShape - the flythru path geometry
      kPosition - the current viewpoint.
    • addLineArray

      public javax.media.j3d.BranchGroup addLineArray(javax.media.j3d.LineArray kLine, int iGroup)
      Called from the JDialogDTIInput. Adds a line array representing the fiber bundle tract to the SurfaceRender.
      Parameters:
      kLine - LineArray to add
      iGroup - branch group index to add the line to.
      Returns:
      the BranchGroup the line is added to.
    • removeLineArray

      public void removeLineArray(javax.media.j3d.BranchGroup kBranch)
      Called from the JDialogDTIInput. Removes the line array representing the fiber bundle tract from the SurfaceRender.
      Parameters:
      kBranch - the BranchGroup the line is in.
    • addMesh

      public void addMesh(ModelTriangleMesh kOld, ModelTriangleMesh kNew, String kName)
      Called when a mesh is changed by the Geodesic class, when a mesh is cut along the geodesic curve it may be divided into two or more meshes. This function allows the Geodesic class to add meshes to the scene renderer. It follows the pattern of adding a surface through the surface dialog.
      Parameters:
      kOld - ModelTriangleMesh old mesh
      kNew - ModelTriangleMesh new mesh
      kName - String mesh name
    • addSurface

      public void addSurface()
      Add surface to the volume image. Calls the FileSurface.openSurfaces function to open a file dialog so the user can choose the surfaces to add.
    • addSurfaces

      public void addSurfaces(String dir, File surfaceFile)
      Adding the surface with specific directory and file name. Called from the ViewJFrameVolumeView class from the JPanelEndoscopy loadingSurface function.
      Parameters:
      dir - directory name
      surfaceFile - file name
    • addSurfaces

      public void addSurfaces(SurfaceAttributes[] surfaces, boolean pickable)
      Adds an array of surfaces described by their SurfaceAttributes to the scene graph.
      Parameters:
      surfaces - the new surfaces (SurfaceAttributes[]) to add to the scene graph.
      pickable - when true turn picking on for the new surfaces, when false disable picking.
    • dispose

      public void dispose()
      Dispose memory.
    • enableSurfacePaint

      public void enableSurfacePaint(boolean bEnable)
      Enables/Disables the SurfacePaint per-vertex functions.
      Parameters:
      bEnable - when true the SurfacePaint per-vertex functions (PaintBrush, Dropper, Eraser, BrushSize) are enabled, when false they are disabled.
    • enableSurfacePaintCan

      public void enableSurfacePaintCan(boolean bEnable)
      Enables/Disables the SurfacePaint Paint Can function.
      Parameters:
      bEnable - when true the Paint Can function is enabled, when false it is disabled.
    • findPickedObject

      public void findPickedObject(MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener. The surface attribute dialog was added as a listener to the 3D canvas on which the scene is drawn. Whenever a picking operation occurs on the canvas, this member function is called. The pick operation returns the Shape3D object (null, if no object is situated at the pick location). The root of the subtree for the picked surface is looked up within the surfaces list. If found, the list box, color button, detail slider, triangle text, and polygon mode are updated to display the selected surface.

      Note. The use of Shape3D by the picker and BranchGroup by the surfaces list appears to be more complicated than necessary, and instead both should use Shape3D or BranchGroup. In fact it is necessary to structure the code as it currently is. The picker needs to locate actual geometry, so Shape3D objects must enable themselves to be picked with ray-triangle intersection testing. If the surfaces in the list were set up to be Shape3D instead of BranchGroup, then all add/remove operations would have to be based on Shape3D, not on BranchGroups. These operations are not allowed in compiled scene graphs.

      Note. The iteration over the surface list checking for the BranchGroup whose child is the picked surface is also necessary. Simpler would be to query the Shape3D object for its parent. Such a query is also not supported in a compiled scene graph.
      Parameters:
      kEvent - The mouse event.
    • generateNewTextureCoords

      public void generateNewTextureCoords(ModelImage kImage, boolean bVertexColors, boolean bUseImageMask)
      Generates new texture coordinates for all surfaces, based on the new ModelImage texture-source. If bVertexColors is true, the ModelImage is displayed as per-vertex colors.
      Parameters:
      kImage - the new ModelImage used to texture-map the ModelTriangleMesh polygons.
      bVertexColors - when true display the ModelImage as per-vertex colors, when false, display the ModelImage as a 3D Texture.
      bUseImageMask - DOCUMENT ME!
    • getGeodesicGroup

      public javax.media.j3d.BranchGroup getGeodesicGroup()
      Return access to the Group data member m_kGeodesicGroup so Geodesic object can draw on the triangle mesh.
      Returns:
      BranchGroup root of the geodesic group reference.
    • getLightColor

      public javax.vecmath.Color3f getLightColor(int i)
      The only caller of this method is the light attribute dialog, an object from class JDialogSurfaceLight. The dialog calls this to initialize its color button.
      Parameters:
      i - The light index (must be in [0..8]).
      Returns:
      The color of light i.
    • getLightCount

      public int getLightCount()
      The number of lights supported by the viewer (currently 9). The only caller of this method is the light attribute dialog, an object from class JDialogSurfaceLight. The dialog uses the count to create a list of lights in the scene. If the number of supported lights ever changes, the dialog code does not have to change.
      Returns:
      The number of supported lights in the scene.
    • getLightDialog

      public JPanelLights getLightDialog()
      Return the surface light control dialog box.
      Returns:
      lights Surface light dialog box
    • getMainPanel

      public JPanel getMainPanel()
      Return the main surface panel.
      Specified by:
      getMainPanel in class JPanelRendererBase
      Returns:
      the surface panel
    • getOpacitySlider

      public JSlider getOpacitySlider()
      Get the current surface opacity slider.
      Returns:
      opacitySlider Surface opacity slider
    • getPickCanvas

      public com.sun.j3d.utils.picking.PickCanvas getPickCanvas()
      Get the pick canvas.
      Returns:
      pickCanvas pick canvas.
    • getSurfaceClipCB

      public JCheckBox getSurfaceClipCB()
      Get the surface clip check box.
      Returns:
      surfaceClipCB surface clip check box.
    • getSurfaceList

      public JList getSurfaceList()
      Get the reference to the surface list. This method is called by the probePanel.
      Returns:
      surfaceList reference to surfaceList
    • getSurfaceMask

      public SurfaceMask getSurfaceMask()
      Returns the SurfaceMask object.
      Returns:
      mSurfaceMask.
    • getSurfaceOpacity

      public int getSurfaceOpacity()
      Get the current surface opacity value.
      Returns:
      surfaceOpaictySlice Surface opacity slider value
    • getSurfaceVector

      public Vector<SurfaceAttributes> getSurfaceVector()
      Return the surface vector reference.
      Returns:
      surfaceVector surface vector
    • getTextureImage

      public ModelImage getTextureImage()
      Returns the ModelImage used to generate the Texture3D.
      Returns:
      the JPanelSurfaceTexture ModelImage data source for the Texture3D object.
    • getTextureStatus

      public int getTextureStatus()
      Returns the texture status, either TEXTURE, VERTEX_COLOR, or NONE.
      Returns:
      the texture status, either TEXTURE, VERTEX_COLOR, or NONE
    • isProbePicked

      public boolean isProbePicked()
      If probe being picked or not.
      Returns:
      boolean probe picked or not
    • isSurfacePickableSelected

      public boolean isSurfacePickableSelected()
      Check if the surface pickable checkbox be selected or not.
      Returns:
      isSelected Surface pickable check box selected or not.
    • mouseClicked

      public void mouseClicked(MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      kEvent - The mouse event.
    • mouseDragged

      public void mouseDragged(MouseEvent kEvent)
      One of the overrides necessary to be a MouseMotionListener. This member only exists to satisfy the conditions of being a MouseMotionListener. It does nothing when invoked.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      kEvent - The mouse event.
    • mouseEntered

      public void mouseEntered(MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      kEvent - The mouse event.
    • mouseExited

      public void mouseExited(MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      kEvent - The mouse event.
    • mouseMoved

      public void mouseMoved(MouseEvent kEvent)
      One of the overrides necessary to be a MouseMotionListener. This member only exists to satisfy the conditions of being a MouseMotionListener. It does nothing when invoked.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      kEvent - The mouse event.
    • mousePressed

      public void mousePressed(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      kEvent - The mouse event.
    • mouseReleased

      public void mouseReleased(MouseEvent kEvent)
      DOCUMENT ME!
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      kEvent - The mouse event.
    • removeBranch

      public void removeBranch(javax.media.j3d.BranchGroup kBranch, boolean bRemoveMesh)
      Removes a BranchGroup to the display.
      Parameters:
      kBranch - BranchGroup surface branch group reference.
      bRemoveMesh - boolean flag to remove the surface mesh or not
    • removeSurface

      public void removeSurface()
      Remove the surface from the volume render.
    • removeSurface

      public void removeSurface(javax.media.j3d.BranchGroup root)
      Remove the specified surface subtree from the scene graph.
      Parameters:
      root - The root of the subtree to remove.
    • replaceMesh

      public void replaceMesh(ModelTriangleMesh kOld, ModelTriangleMesh kNew)
      ReplaceMesh is used by the Geodesic when a mesh is cut along either an open or closed geodesic curve, the original mesh is changed, but not deleted and no new mesh is added. The orginal mesh, kOld, is replced by the new mesh, kNew
      Parameters:
      kOld - ModelTriangleMesh old mesh reference
      kNew - ModelTriangleMesh new mesh reference
    • resizePanel

      public void resizePanel(int panelWidth, int frameHeight)
      Resizing the control panel with ViewJFrameVolumeView's frame width and height.
      Overrides:
      resizePanel in class JPanelRendererBase
      Parameters:
      panelWidth - int width
      frameHeight - int height
    • restorePerVertexColor

      public void restorePerVertexColor(javax.media.j3d.Material kMaterial, int index)
      Restores the per-vertex colors for the surface at the index parameter. Called by the AdvancedMaterialProperties dialog.
      Parameters:
      kMaterial - the original Material to restore
      index - the surface index
    • restoreVertexColors

      public void restoreVertexColors()
      Restores the vertex colors for the surfaces.
    • setLightAttributes

      public void setLightAttributes(int iIndex)
      Update the properties of the specified light bulb.
      Parameters:
      iIndex - int Index of the bulb in the array as stored in JPanelLights.
    • setLightBulbsVisible

      public void setLightBulbsVisible(boolean flag)
      Sets the light bulbs to visible or invisible.
      Parameters:
      flag - true means visible.
    • setMaterial

      public void setMaterial(javax.media.j3d.Material kMaterial, int iIndex)
      Called from the JPanelSurfaceMAterialProperties.java dialog when the dialog is used to change the material properties of a surface. The surface is determined by the index iIndex. The color button is set to the Material diffuse color.
      Parameters:
      kMaterial - Material reference
      iIndex - int material index
    • setPathPosition

      public void setPathPosition(javax.vecmath.Point3f kPosition)
      Updates the position of the flythru view point along the flythru path.
      Parameters:
      kPosition - Point3f
    • stateChanged

      public void stateChanged(ChangeEvent event)
      The override necessary to be a ChangeListener for a JSlider.

      When a change occurs to the detailSlider, the user has requested that the level of detail be changed for the currently active surface. The slider range is [0,100] and is treated as a percent of maximum level of detail. A change has no effect on ModelTriangleMesh objects, but it does change the level of detail for an ModelClodMesh object. The number of triangles is also updated.

      When a change occurs to the opacity slider, the surface transparency is updated.

      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - The change event.
    • toggleWireframe

      public void toggleWireframe()
      Toggle between wireframe and filled polygon mode.
    • updateVolumeTexture

      public void updateVolumeTexture(BitSet paintMask, javax.vecmath.Color4f kColor)
      Called from SurfacePaint. Used to paint the ModelImage texture with the paint can function.
      Parameters:
      paintMask - the paint mask to add to the texture.
      kColor - DOCUMENT ME!
    • valueChanged

      public void valueChanged(ListSelectionEvent kEvent)
      The override necessary to be a ListSelectionListener. This callback is executed whenever the user selects a new item (or items) in the list box. If a single item is selected, then the selection index is remembered in iSelect and the interface items are initialized with the appropriate values corresponding to the selected surface. If multiple items are selected, then the selection index is -1 and the color button is set to the background color. The slider and polygon mode are set to the values found in the minimum selected surface.
      Specified by:
      valueChanged in interface ListSelectionListener
      Parameters:
      kEvent - The list selection event.
    • windowClosing

      public void windowClosing(WindowEvent event)
      Overrides method in JDialogBase so dialog isn't disposed, just hidden.
      Parameters:
      event - Event that triggered this method.
    • buildToolBar

      private void buildToolBar()
      Build the toolbar.
    • changePolyMode

      private void changePolyMode(int mode)
      Changes the polygon mode of the selected surface by detaching it, calling the appropriate method, and reattaching it.
      Parameters:
      mode - The new polygon mode to set.
    • containsMesh

      private SurfaceAttributes[] containsMesh(ModelTriangleMesh kOld)
      containsMesh returns the SurfaceAttributes[] containing the input ModelTriangleMesh parameter, where the SurfaceAttributes[] array is of length 1. If the input mesh is not in the scene graph, then null is returned.
      Parameters:
      kOld - the ModelTriangleMesh that is being searched for in the scene graph
      Returns:
      SurfaceAttributes[1], an array of 1 containing the SurfaceAttributes describing the input mesh, null if the mesh is not found.
    • createLabel

      private JLabel createLabel(String title)
      Creates a label in the proper font and color.
      Parameters:
      title - The title of the label.
      Returns:
      The new label.
    • createSurface

      private void createSurface(SurfaceAttributes surface, boolean pickable)
      Creates a surface in the scene graph from an array of triangle meshes.
      Parameters:
      surface - Triangle meshes that make up surface
      pickable - Color of surface
    • decimate

      private void decimate(SurfaceAttributes[] surfaces)
      Decimate the surface.
      Parameters:
      surfaces - DOCUMENT ME!
    • displayAdvancedMaterialOptions

      private void displayAdvancedMaterialOptions(SurfaceAttributes[] surfaces)
      For each file in the selected list, launch the AdvancedMaterialOptions dialog:
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • displayImageAsTexture

      private void displayImageAsTexture(SurfaceAttributes[] surfaces)
      Displays the selected surfaces with the ModelImage as a 3D texture map on the surface triangle mesh.
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • displayStereo

      private void displayStereo(SurfaceAttributes[] surfaces)
      For each file in the selected list, launch the stereo viewer:
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • doPick

      private com.sun.j3d.utils.picking.PickResult doPick(MouseEvent kEvent)
      Locate the surface that corresponds to a picking operation in the viewer window. This member is called via the mouse listener callback. If a surface is picked, the list box is updated to show that the surface is selected and the corresponding information is set for the color button, the detail slider, and the number of triangles.
      Parameters:
      kEvent - The mouse event generated by the picking operation.
      Returns:
      The picked surface, or null if no surface is located at the pick location.
    • enableStaticLightBehavior

      private void enableStaticLightBehavior(boolean flag)
      Enable static light behavior.
      Parameters:
      flag - true enable and false disable.
    • getColorChange

      private void getColorChange(Color color)
      This is called when the user chooses a new color for the surface. It changes the color of the surface.
      Parameters:
      color - Color to change surface to.
    • getSelectedSurfaces

      private SurfaceAttributes[] getSelectedSurfaces(int[] aiSelected)
      Returns an array of SurfaceAttributes based on which surfaces are selected by the user in the surfaceList combo-box. Only surfaces are selected, VOI points are ignored.
      Parameters:
      aiSelected - the list of selected indices in the surfaceList
      Returns:
      an array of SurfaceAttributes that contains the corresponding list of surfaces from the surfaceVector.
    • init

      private void init()
      Initializes the GUI components.
    • initSphere

      private void initSphere()
      Initialize the sphere scene graph objects for the sphere showing where the user clicked in the surface.
    • isStaticLightEnabled

      private boolean isStaticLightEnabled()
      Check static light is enable or not.
      Returns:
      staticLightEnable true means enable, false means disable.
    • isStaticPicked

      private boolean isStaticPicked()
      Indicates whether the static light bulb being picked by the mouse.
      Returns:
      whether the static light bulb is being picked
    • polygonIndexToMode

      private int polygonIndexToMode(int index)
      Convert from the polygon mode combo-box list index to the PolygonAttributes.POLYGON_LINE, PolygonAttributes.POLYGON_POINT, and PolygonAttributes.POLYGON_FILL values:
      Parameters:
      index - the index of the selected polygon mode in the polygonModeCB combo box.
      Returns:
      the corresponding PolygonAttributes defined value.
    • readSurface

      private void readSurface(String dir, File surfaceFile, float surfaceOpacity)
      Adding the surface with specific directory, file name, and surfaceOpacity.
      Parameters:
      dir - directory name
      surfaceFile - file name
      surfaceOpacity - opacity
    • removeSurfaces

      private void removeSurfaces(SurfaceAttributes[] surfaces)
      The action taken when the Remove button is clicked in the list box. All selected surfaces in the list box are removed from the scene graph.
      Parameters:
      surfaces - the selected surfaces (SurfaceAttributes[]) to be removed.
    • setBackface

      private void setBackface(SurfaceAttributes[] surfaces)
      Turns BackFace Culling on/off for the selected surfaces.
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • setClipping

      private void setClipping(SurfaceAttributes[] surfaces)
      Turns Clipping on/off for the selected surfaces.
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • setElementsEnabled

      private void setElementsEnabled(boolean flag)
      Sets the surface options GUI panel to enabled or disabled. If there are 0 or multiple surfaces selected, all the options should be disabled.
      Parameters:
      flag - Enable or disable.
    • setPickable

      private void setPickable(SurfaceAttributes[] surfaces)
      Turns picking on/off for the selected surfaces.
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • setTransparency

      private void setTransparency(SurfaceAttributes[] surfaces)
      Turns Transparency on/off for the selected surfaces.
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
    • setupLights

      private void setupLights(javax.media.j3d.TransformGroup surfaceRoot)
      Create and initialize the nine lights in the scene graph. The first eight lights are positioned at the eight vertices of the cube [-1,1]^3. Light 0 is at (-1,-1,-1) and light 7 is at (1,1,1), both enabled by default. The default color for all lights is white. The default intensity is 1. All surfaces in the scene are illuminated by all enabled lights. The ninth light is ambient light, light that seems to come from all directions.
      Parameters:
      surfaceRoot - Transform group to attach lights to.
    • smoothSurface

      private void smoothSurface(SurfaceAttributes[] surfaces, int smoothType)
      Smoothes the selected surfaces. One dialog per group of selected surfaces is displayed (not a different dialog per-serface).
      Parameters:
      surfaces - the list of selected surfaces (SurfaceAttributes)
      smoothType - the level of smoothing JDialogSmoothMesh.SMOOTH1, JDialogSmoothMesh.SMOOTH2, or JDialogSmoothMesh.SMOOTH3
    • updateSurfaceNameList

      private void updateSurfaceNameList(int[] selected)
      Called when surfaces are added or removed from the surfaceVector SurfaceAttributes list. Updates the surfaceList combo-box displayed in the user-interface.
      Parameters:
      selected - array of names that are currently selected.
    • updateSurfaceRender

      private void updateSurfaceRender(boolean bUpdateProbe)
      Updates the SurfaceRenderer.
      Parameters:
      bUpdateProbe - when true update the ProbeDialog.
    • calcVolume

      public float calcVolume(ModelImage imageA, ModelTriangleMesh[] kMesh)