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.plotterview.SurfacePlotter
All Implemented Interfaces:
com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, ViewImageUpdateInterface, ActionListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class SurfacePlotter extends RenderViewBase implements MouseListener
Frame that holds the surface plotter. The surface plotter takes a 2D image and renders it into a 3D object that is similar to a relief map. Higher intensities are peaks, lower intensities are valleys. The colors are the same as those used in the LUT, and when the LUT for the image is updated, so is the LUT for the plotted surface. The image itself is also a part of the scene, and it can be slid along so that the peaks of the intensity levels match the image.
See Also:
  • Field Details

    • serialVersionUID

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

      private JPanelSurfaceBox boxDialog
      Dialog for recording and playing back mouse events.
    • componentImageXY

      private ViewJComponentSurface componentImageXY
      Main component found in this frame.
    • controlPanel

      private JPanel controlPanel
      the control panel that hold the z slider.
    • current

      private int current
      Current event vector index.
    • extents

      private int[] extents
      Extents of image.
    • imageBranch

      private javax.media.j3d.BranchGroup imageBranch
      Branch parent of the image in the scene, needed so image can be made invisible when another surface is loaded.
    • isVisible

      private boolean isVisible
      Flag indicating if the image is currently visible.
    • itemLine

      private JCheckBoxMenuItem itemLine
      Check box menu item indicating if surface should be in line mode or full mode.
    • label1

      private JLabel label1
      Label for slider, "1".
    • label100

      private JLabel label100
      Label for slider, "100".
    • label50

      private JLabel label50
      Label for slider, "50".
    • labelZ

      private JLabel labelZ
      Label that says "Z (1-100)".
    • LUTa

      private ModelLUT LUTa
      LUT that dictates how the vertices of the quad mesh are colored.
    • mainPanel

      private JPanel mainPanel
      The main control panel.
    • mouseDialog

      private JPanelMousePlotter mouseDialog
      Mouse recorder dialog associated with surface plotter.
    • mouseRotateBehavior

      private com.sun.j3d.utils.behaviors.mouse.MouseRotate mouseRotateBehavior
      Mouse Rotate behavior.
    • mouseTranslateBehavior

      private com.sun.j3d.utils.behaviors.mouse.MouseTranslate mouseTranslateBehavior
      Mouse Translate behavior.
    • mouseZoomBehavior

      private com.sun.j3d.utils.behaviors.mouse.MouseZoom mouseZoomBehavior
      Mouse Zoom behavior.
    • myEyePoint

      private javax.vecmath.Point3d myEyePoint
      Initial center viewing point of the image.
    • objTransXY

      private javax.media.j3d.TransformGroup objTransXY
      Transform group guiding how image is displayed.
    • openingMenuBar

      private JMenuBar openingMenuBar
      Menu bar.
    • panelToolbar

      private JPanel panelToolbar
      Panel that holds the toolbars.
    • parallelScaleT3D

      private javax.media.j3d.Transform3D parallelScaleT3D
      Transformation matrix.
    • setSliderFlag

      private boolean setSliderFlag
      Flag to indicate the first time slider name changes.
    • slice

      private int slice
      Current slice of 3D image, used to figure out XY plane to plot.
    • sliderEvents

      private MouseEventVectorPlotter sliderEvents
      Slider events used by the mouse recorder.
    • sliderFrame

      private JSlider sliderFrame
      Slider for frame/slice of image.
    • sliderZ

      private JSlider sliderZ
      3, 1-100%, dictating where the image in the surface should be displayed.
    • t3d_XY_t

      private javax.media.j3d.Transform3D t3d_XY_t
      Actual transform of the image.
    • textZ

      private JTextField textZ
      Text field displaying the percentage of the slider.
    • texUnitStateBXY

      private javax.media.j3d.TextureUnitState[] texUnitStateBXY
      Texture creating appearance for the "back" of the image. Needs to be array even though there will be only 1 item.
    • texUnitStateFXY

      private javax.media.j3d.TextureUnitState[] texUnitStateFXY
      Texture creating appearance for the "front" of the image. Needs to be array even though there will be only 1 item.
    • visibleBox

      private JCheckBox visibleBox
      Check box for whether or not the image should be visible.
    • xRes

      private float xRes
      X and Y resolution.
    • yRes

      private float yRes
      X and Y resolution.
    • zSlice

      private int zSlice
      Z slice, which image of 1-100 are we showing.
  • Constructor Details

    • SurfacePlotter

      public SurfacePlotter(ModelImage _imageA, ModelLUT _LUTa, int slice, GraphicsConfiguration _config)
      Makes a frame and puts the image and the plotted quad mesh into it.
      Parameters:
      _imageA - First image to display
      _LUTa - LUT of the imageA (if null grayscale LUT is constructed).
      slice - Slice of 3D image that we're going to plot; 0 if 2D.
      _config - Graphics configuration.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Calls various methods depending on the action:
      • Load in menu - calls a file chooser and loads the quad surface
      • Save in menu - calls a file chooser and saves the quad surface
      • Exit in menu - exits this frame
      • View in menu - opens view dialog
      • Mouse in menu - opens mouse recorder dialog
      • Line checkbox in menu - toggles polygon mode between fill and line
      • Visible checkbox on panel - toggles image on and off
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - Event that triggered function.
    • autoCapture

      public void autoCapture()
      Override the parent autoCapture method to capture MIP image volume.
      Overrides:
      autoCapture in class RenderViewBase
    • disableCamera

      public void disableCamera()
      Set the captureFrame to null.
      Overrides:
      disableCamera in class RenderViewBase
    • dispatchSavedEvent

      public void dispatchSavedEvent(EventObject event)
      Dispatches event to appropriate object.
      Parameters:
      event - Event to dispatch.
    • disposeLocal

      public void disposeLocal()
      Dispose memory.
      Overrides:
      disposeLocal in class RenderViewBase
    • finalize

      public void finalize() throws Throwable
      Finalize to free memory.
      Overrides:
      finalize in class Object
      Throws:
      Throwable - DOCUMENT ME!
    • getCameraPanel

      public JPanelCamera getCameraPanel()
      Get the camera control panel.
      Returns:
      JPanelCamera camera control panel
    • getControlPanel

      public JPanel getControlPanel()
      Get the main control panel.
      Returns:
      JPanel the main control panel
    • getImageA

      public ModelImage getImageA()
      Accessor that returns the reference to imageA.
      Overrides:
      getImageA in class RenderViewBase
      Returns:
      image
    • getImageB

      public ModelImage getImageB()
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Overrides:
      getImageB in class RenderViewBase
      Returns:
      null
    • getMouseControl

      public JPanelMousePlotter getMouseControl()
      Return mouseDialog from parent frame.
      Returns:
      mouseDialog Mouse Dialog box.
    • getMouseMode

      public int getMouseMode()
      Gets the mouse pointer mode - standard or fly - from the view dialog.
      Returns:
      The mouse pointer mode.
    • getMousePanel

      public JPanelMousePlotter getMousePanel()
      Get the mouse recorder control panel.
      Returns:
      JPanelMousePlotter mouse control panel
    • getSampleSize

      public int getSampleSize()
      Get the sample factor.
      Returns:
      int return the sample factor
    • getSceneState

      public Object getSceneState()
      Gets the current scene state, in terms of what number the slice is on and if it is visible.
      Specified by:
      getSceneState in class RenderViewBase
      Returns:
      A SceneState object with the variables set appropriately.
    • getSurfaceBoxPanel

      public JPanelSurfaceBox getSurfaceBoxPanel()
      Get the surface box control ???
      Returns:
      JPanelSurfaceBox
    • getViewPanel

      public JPanelView getViewPanel()
      Get the view control panel.
      Returns:
      JPanelView the view control
    • hideBoxFrame

      public void hideBoxFrame()
      Makes the box frame invisible.
    • mouseClicked

      public void mouseClicked(MouseEvent event)
      Unchanged.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseEntered

      public void mouseEntered(MouseEvent event)
      Unchanged.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseExited

      public void mouseExited(MouseEvent event)
      Unchanged.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mousePressed

      public void mousePressed(MouseEvent event)
      Unchanged.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      Used in MouseRecorder to stop one series of slide moves.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      event - Original mouse event.
    • resample

      public void resample(String selectedValue)
      Call by the plotter render frame to resample.
      Parameters:
      selectedValue - resample factor
    • resetMouseDialog

      public void resetMouseDialog()
      Reset mouseDialog box.
    • rotateImage

      public void rotateImage()
      Override the parent rotateImage method to rotate the MIP image volume. This method manully rotate the image volume during the camera snapshooting.
      Overrides:
      rotateImage in class RenderViewBase
    • setAlphaBlend

      public void setAlphaBlend(int value)
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Specified by:
      setAlphaBlend in class RenderViewBase
      Parameters:
      value - DOCUMENT ME!
    • setEnabled

      public void setEnabled(boolean flag)
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Overrides:
      setEnabled in class Component
      Parameters:
      flag - DOCUMENT ME!
    • setGUI

      public void setGUI(Object scene)
      Sets the GUI components to their proper state before the action is dispatched from the player.
      Specified by:
      setGUI in class RenderViewBase
      Parameters:
      scene - The state of the scene.
    • setLUTa

      public void setLUTa(ModelLUT LUT)
      Accessor that sets the LUT.
      Parameters:
      LUT - the LUT
    • setMouseMode

      public void setMouseMode(int mode)
      Sets the mouse pointer mode - standard or fly - in the view dialog.
      Parameters:
      mode - Mode to set to.
    • setPolygonMode

      public void setPolygonMode(boolean flag)
      Set the polygonal render mode.
      Parameters:
      flag - mode is on or not
    • setRenderPerspective

      public void setRenderPerspective(boolean bEnable)
      Enable perspective projection rendering; otherwise use orthographic projection.
      Parameters:
      bEnable - true to enable perspective projection
    • setRGBTA

      public void setRGBTA(ModelRGB RGBT)
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Specified by:
      setRGBTA in class RenderViewBase
      Parameters:
      RGBT - DOCUMENT ME!
    • setRGBTB

      public void setRGBTB(ModelRGB RGBT)
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Specified by:
      setRGBTB in class RenderViewBase
      Parameters:
      RGBT - DOCUMENT ME!
    • setRotationAngle

      public void setRotationAngle(int value)
      Set the rotation angel for the camera control.
      Overrides:
      setRotationAngle in class RenderViewBase
      Parameters:
      value - int
    • setRotationAxis

      public void setRotationAxis(int axis)
      Set the rotation axis for the camera control.
      Overrides:
      setRotationAxis in class RenderViewBase
      Parameters:
      axis - rotation axis x, y, z
    • setSceneState

      public void setSceneState(Object scene)
      Sets the scene state appropriately.
      Parameters:
      scene - The state of the scene.
    • setSlice

      public void setSlice(int slice)
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Specified by:
      setSlice in interface ViewImageUpdateInterface
      Parameters:
      slice - DOCUMENT ME!
    • setTimeSlice

      public void setTimeSlice(int slice)
      Does nothing but must instantiate for this to be a subclass of RenderViewBase.
      Specified by:
      setTimeSlice in interface ViewImageUpdateInterface
      Parameters:
      slice - DOCUMENT ME!
    • showBoxFrame

      public void showBoxFrame()
      Makes the box frame visible.
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Sets where image is in scene based on knob along slider.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - Event that triggered this function
    • transformChanged

      public void transformChanged(int type, javax.media.j3d.Transform3D transform)
      Does nothing but must instantiate for this to be a subclass of ViewJFrameSurface.
      Specified by:
      transformChanged in interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
      Parameters:
      type - DOCUMENT ME!
      transform - DOCUMENT ME!
    • updateImageExtents

      public boolean updateImageExtents()
      This methods calls the componentImage's REPAINT method to redraw the screen. The extents on this image have changed, so the extents need to be read in again and menus, panes and slide bars adjusted accordingly.
      Specified by:
      updateImageExtents in interface ViewImageUpdateInterface
      Returns:
      DOCUMENT ME!
    • updateImages

      public final boolean updateImages()
      This methods calls the componentImage's update method to redraw the screen - fastest of the three update methods.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Returns:
      boolean confirming successful update
    • updateImages

      public final boolean updateImages(boolean forceShow)
      This methods calls the componentImage's update method to redraw the screen. Without LUT changes.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      forceShow - forces show to re import image and calc. java image
      Returns:
      boolean confirming successful update
    • updateImages

      public final boolean updateImages(ModelLUT LUTa, ModelLUT LUTb, boolean forceShow, int interpMode)
      This methods calls the componentImage's update method to redraw the screen.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      LUTa - LUT used to update imageA
      LUTb - LUT used to update imageB (not used in the plotter)
      forceShow - forces show to re import image and calc. java image
      interpMode - image interpolation method (Nearest or Smooth)
      Returns:
      boolean confirming successful update
    • buildControlPanel

      private JPanel buildControlPanel()
      Panel that has a slider for the image.
      Returns:
      DOCUMENT ME!
    • buildMenu

      private void buildMenu()
      Builds menus for the frame.
    • buildToolBar

      private void buildToolBar()
      Builds the toolbar for the volume render frame.
    • configureFrame

      private void configureFrame()
      Constructs main frame structures for the surface.
    • createImageSceneGraph

      private void createImageSceneGraph()
      Creates the scene graph.
    • load

      private void load()
      Calls a file chooser then loads the quad mesh from that file. Removes the image and disables the visible check box, so the user may not see the image associated with the original quad mesh once a new one has been loaded.
    • makeSeparator

      private JButton makeSeparator()
      Makes a separator for the use in the toolbars.
      Returns:
      Separator for the toolbar.
    • save

      private void save()
      Calls a file chooser then writes the quad mesh to that file.
    • setSliderEnabled

      private void setSliderEnabled(boolean flag)
      Sets the slider, the label "Z (1-100)" and the labels underneath the slider to enabled or disabled, depending on flag.
      Parameters:
      flag - true means enable, false means disable.
    • setupEye

      private void setupEye()
      Set up the center point of the red line boxframe.
    • translateImage

      private void translateImage()
      DOCUMENT ME!
    • updateViewScreenScale

      private void updateViewScreenScale(javax.media.j3d.Transform3D kTransform)
      This function calculates the scale factor for zooming in parallel projection. The scenario is to calculate the distance between the origin boxframe center and tranformed boxframe center. This distance is used to compute the screen scale factor.
      Parameters:
      kTransform - The tranformation matrix from tranformChanged().