Class ViewJComponentSurface

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.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:
    ViewJFrameSurfacePlotter, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      private void calcQuadSurface​(boolean forceUpdate)
      Calculates quad surface.
      void dispose​(boolean gcFlag)
      Sets all variables to null, disposes, and garbage collects if parameter is set.
      protected void finalize()
      Calls dispose.
      RenderViewBase getFrame()
      Accessor that returns the parent frame for the component.
      ModelImage getImageA()
      Accessor that returns the image A.
      ModelLUT getLUTa()
      Accessor that gets the model LUT for image A.
      ModelQuadMesh getQMesh()
      Accessor that returns the quad mesh, which represents the plotted surface.
      int getSampleSize()
      Accessor that returns the sample size that created the quad mesh.
      private void initSurfaceBuffers()
      Initialize the global vertext and connection arrays.
      void resample​(int sample)
      Resamples and creates a new quad mesh, detaching the parent branch group and readding the surface.
      void setImageA​(ModelImage image)
      Sets component's image A.
      void setLUTa​(ModelLUT LUT)
      Accessor that sets the model LUT for the image A.
      void setPolygonMode​(boolean line)
      Sets the polygon mode, if it has changed.
      void setQMesh​(ModelQuadMesh quadMesh)
      Sets the quad mesh by detaching the parent branch group and readding the surface.
      void setSlice​(int slice)
      sets the slice/frame # for display.
      private void setupLights()
      Create and initialize the eight lights in the scene graph.
      boolean show​(ModelLUT _LUTa, boolean forceShow, int _interpMode)
      Shows the surface, using the LUT to color the indices.
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

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

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

      • 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 java.lang.Throwable
        Calls dispose.
        Overrides:
        finalize in class ViewJComponentBase
        Throws:
        java.lang.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.