Class ViewJComponentSurface

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
gov.nih.mipav.view.ViewJComponentBase
gov.nih.mipav.view.renderer.J3D.surfaceview.plotterview.ViewJComponentSurface
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class ViewJComponentSurface extends ViewJComponentBase
Component surface created from a 2D image. The intensity values are mapped like a relief map, with higher intensities making peaks and lower intensities forming valleys. A quad mesh is used to create the three-dimensional map. The same LUT from the image is used to colors the vertices of the quad mesh.
Version:
0.1 Aug 1, 2001
Author:
Matthew J. McAuliffe, Ph.D., Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

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

      private int[] cConnect
      Vertex connection array.
    • cVertex

      private javax.vecmath.Point3f[] cVertex
      Vertex array.
    • frame

      private RenderViewBase frame
      Frame where the plotted surface is displayed.
    • imageA

      private ModelImage imageA
      Structure holding image.
    • imageBufferA

      private float[] imageBufferA
      Buffer which holds the pixel data.
    • imageExtents

      private int[] imageExtents
      Extents of the image.
    • lineMode

      private boolean lineMode
      Flag indicating if the surface is currently in line mode (true) or fill mode (false).
    • LUTa

      private ModelLUT LUTa
      Lookup table for image.
    • lutBufferRemapped

      private int[] lutBufferRemapped
      Used to remap the LUT appropriately.
    • maxBox

      private float maxBox
      MaxBox value from the parent frame.
    • pixBuffer

      private int[] pixBuffer
      Buffer used to store ARGB images of the image presently being displayed.
    • plottedRoot

      private javax.media.j3d.BranchGroup plottedRoot
      Branch group that is the parent of the plotted surface.
    • qMesh

      private ModelQuadMesh qMesh
      Quad mesh. This is the core of the component.
    • sampleSize

      private int sampleSize
      Sample size. This determines how many triangles are used in the quad mesh.
    • xBox

      private float xBox
      xBox, yBox and zBox values from the parent frame.
    • yBox

      private float yBox
      xBox, yBox and zBox values from the parent frame.
    • zBox

      private float zBox
      xBox, yBox and zBox values from the parent frame.
  • Constructor Details

    • ViewJComponentSurface

      public ViewJComponentSurface(RenderViewBase _frame, ModelImage _imageA, ModelLUT _LUTa, int[] extents, int slice)
      Constructs a new component and sets up the variables.
      Parameters:
      _frame - Frame where image(s) will be displayed.
      _imageA - Model of the image that will be displayed.
      _LUTa - LUT used to display imageA.
      extents - Extents of image to be displayed.
      slice - Slice of 3D image to use, 0 if 2D image.
  • Method Details

    • dispose

      public void dispose(boolean gcFlag)
      Sets all variables to null, disposes, and garbage collects if parameter is set.
      Overrides:
      dispose in class ViewJComponentBase
      Parameters:
      gcFlag - If true garbage collector should be called.
    • getFrame

      public RenderViewBase getFrame()
      Accessor that returns the parent frame for the component.
      Returns:
      The parent frame.
    • getImageA

      public ModelImage getImageA()
      Accessor that returns the image A.
      Returns:
      imageA
    • getLUTa

      public ModelLUT getLUTa()
      Accessor that gets the model LUT for image A.
      Returns:
      The model LUT.
    • getQMesh

      public ModelQuadMesh getQMesh()
      Accessor that returns the quad mesh, which represents the plotted surface.
      Returns:
      The quad mesh.
    • getSampleSize

      public int getSampleSize()
      Accessor that returns the sample size that created the quad mesh.
      Returns:
      The sample size.
    • resample

      public void resample(int sample)
      Resamples and creates a new quad mesh, detaching the parent branch group and readding the surface.
      Parameters:
      sample - New sample size.
    • setImageA

      public void setImageA(ModelImage image)
      Sets component's image A. Sets zoom to 1, 1.
      Parameters:
      image - Image to set to.
    • setLUTa

      public void setLUTa(ModelLUT LUT)
      Accessor that sets the model LUT for the image A.
      Parameters:
      LUT - The model LUT to set to.
    • setPolygonMode

      public void setPolygonMode(boolean line)
      Sets the polygon mode, if it has changed.
      Parameters:
      line - true indicates set to line mode, false indicates set to fill mode.
    • setQMesh

      public void setQMesh(ModelQuadMesh quadMesh)
      Sets the quad mesh by detaching the parent branch group and readding the surface.
      Parameters:
      quadMesh - Quad mesh to set to.
    • setSlice

      public void setSlice(int slice)
      sets the slice/frame # for display.
      Parameters:
      slice - slice number
    • show

      public boolean show(ModelLUT _LUTa, boolean forceShow, int _interpMode)
      Shows the surface, using the LUT to color the indices.
      Parameters:
      _LUTa - to change to new LUT for imageA else null.
      forceShow - Forces this method to import image and recalculate java image.
      _interpMode - Image interpolation method (Nearest or Smooth).
      Returns:
      true indicates the show was successful.
    • finalize

      protected void finalize() throws Throwable
      Calls dispose.
      Overrides:
      finalize in class ViewJComponentBase
      Throws:
      Throwable - DOCUMENT ME!
    • addSurface

      private void addSurface()
      Sets up the surface by setting the color of the material to black, setting the polygon to no cull-face and a fill mode, and allowing intersections in case we want picking ability.
    • calcQuadSurface

      private void calcQuadSurface(boolean forceUpdate)
      Calculates quad surface. Sets up indices and connections between the indices, then sets the color of the indices based on the LUT.
      Parameters:
      forceUpdate - true updates Quad mesh, false not update Quad mesh.
    • initSurfaceBuffers

      private void initSurfaceBuffers()
      Initialize the global vertext and connection arrays.
    • setupLights

      private void setupLights()
      Create and initialize the eight lights in the scene graph. The lights are positioned at the eight vertices of the cube [-maxBox,maxBox]^3. Light 0 is at (-maxBox,-maxBox,-maxBox) and light 7 is at (maxBox,maxBox,maxBox). All are enabled. The default color for all lights is white. The default intensity is 1.