Class RenderViewBase

  • All Implemented Interfaces:
    com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, ViewImageUpdateInterface, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener
    Direct Known Subclasses:
    MjCorticalAnalysis, SurfacePlotter, SurfaceRender, VolumeRenderer

    public abstract class RenderViewBase
    extends VolumeCanvas3D
    implements ViewImageUpdateInterface, java.awt.event.ActionListener, com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, javax.swing.event.ChangeListener
    This is an abstract class. This class defines the basic functionality of the renders, such as the LUT and bounding box and image rotation, etc. It was extended by the surface render, surface plotter and the volume render.
    Version:
    0.1 Oct 1, 1998
    Author:
    Matthew J. McAuliffe, Ph.D.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  RenderViewBase.Matrix
      This matrix class is used for 3D object rotate along a specifid axis.
      • Nested classes/interfaces inherited from class java.awt.Canvas

        java.awt.Canvas.AccessibleAWTCanvas
      • 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static javax.vecmath.Vector3f[] akNormal
      normal vector arrayes.
      protected javax.media.j3d.Background background
      The background node for the canvas.
      javax.media.j3d.BoundingSphere bounds
      A BoundingSphere that contains the entire scene.
      protected ViewJComponentBoxFrame boxFrame
      The outside box frame.
      protected VolumeCanvas3D canvas
      The Canvas3D object on which the surfaces are drawn and where the picking happens.
      protected ViewJFrameRenderCamera captureFrame
      Camera snapshot frame.
      protected ModelImage captureImage
      The resulting ModelImage of the camera snapshot.
      protected java.awt.GraphicsConfiguration config
      The config used to extends the Canvas3D class.
      protected int displayMode
      Indicates which image is to be acted upon when two images are displayed.
      static int IMAGE_A
      Display mode image A.
      static int IMAGE_B
      Display mode image B.
      protected ModelImage imageA
      Reference to the image A of this frame.
      protected ModelImage imageB
      Reference to the image Bof this frame.
      protected ModelLUT LUTa
      Reference to LUT for image A.
      protected ModelLUT LUTb
      Reference to LUT for image B.
      private static int m_iNumVoxels
      Image volume size and x, y, z extents.
      private static int m_iSizeX
      Image volume size and x, y, z extents.
      private static int m_iSizeY
      Image volume size and x, y, z extents.
      private static int m_iSizeZ
      Image volume size and x, y, z extents.
      private static javax.vecmath.Vector3f m_kZeroVector
      Set the zero vector.
      protected javax.media.j3d.BranchGroup objBehaviorBG
      The BranchGroup to which the standard behaviors are attached, zoom and rotate.
      protected javax.media.j3d.BranchGroup objBoxFrameBG
      Parent of the whole box frame.
      protected javax.media.j3d.BranchGroup objRootBG
      The BranchGroup root of the scene managed by the simple universe.
      protected int rotationAngle
      Rotation angle when the camera takes snapshot.
      protected int rotationAxis
      Rotation axis when the camera takes snapshot.
      protected JPanelCamera rotationControlPanel
      Camera control dialog box.
      protected int rotationTimes
      Number of rotation during the camera auto snapshotting.
      protected int rotationTotal
      The total rotation degree, fixing one bug.
      protected javax.media.j3d.TransformGroup sceneRootTG
      A TransformGroup object to which all the scene objects are attached, including 3D images, surface, behavior, and lights.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      protected MouseEventVector sliderEvents
      Slider events used by the mouse recorder.
      protected javax.media.j3d.Transform3D transRotation
      transform rotation of the volume image during camera snapshot.
      protected javax.media.j3d.Transform3D transRotationMatrix
      Rotation matrix.
      protected javax.media.j3d.BranchGroup triPlanarViewBG
      Triplanar view branch group, which hold the three plane view and the slice box frame view.
      protected com.sun.j3d.utils.universe.SimpleUniverse universe
      The SimpleUniverse object which is the parent of everything else in the scene.
      protected JPanelView viewPanel
      View dialog associated with surface plotter or renderer.
      • Fields inherited from class javax.media.j3d.Canvas3D

        FIELD_ALL, FIELD_LEFT, FIELD_RIGHT
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback

        ROTATE, TRANSLATE, ZOOM
    • Constructor Summary

      Constructors 
      Constructor Description
      RenderViewBase​(ModelImage _imageA, ModelImage _imageB, java.awt.GraphicsConfiguration _config)
      Calls the constructor for ViewJFrameBase with the same parameters.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void autoCapture()
      Calculate the rotation matrix when the auto camera caputuring the images.
      javax.vecmath.Vector3f[] calcImageNormals()
      Create array of normal vectors corresponding to the voxels in the volume.
      protected void createBoxFrame​(float xBox, float yBox, float zBox)
      Creates a new box frame with the given dimensions.
      void disableCamera()
      Set the captureFrame to null.
      void disposeLocal()
      Clean memory.
      javax.media.j3d.BranchGroup getBehaviorGroup()
      Accessor for the branch group that holds the mouse behavior.
      javax.media.j3d.BoundingSphere getBound()
      Accessor for the bounds sphere.
      javax.media.j3d.BranchGroup getBranchGroup()
      Accessor for the branch group of this 3D object, the parent of the transform group.
      javax.media.j3d.Canvas3D getCanvas()
      Accessor for the canvas for this 3D object.
      ModelImage getImageA()
      Accessor that returns the reference to image A.
      ModelImage getImageB()
      Accessor that returns the reference to image B.
      static javax.vecmath.Vector3f[] getNormals()
      Get the normal vector arrays.
      ModelRGB getRGBTA()
      Get the RGB table of imageA.
      ModelRGB getRGBTB()
      Get the RGB table of imageB.
      javax.media.j3d.TransformGroup getSceneRootTG()
      Accessor for the transform group of the scene, which is the parent of everything displayed.
      abstract java.lang.Object getSceneState()
      Gets the scene state in terms of slices visible, which slice number, etc.
      MouseEventVector getSliderEvents()  
      javax.media.j3d.BranchGroup getTriPlanarViewBG()
      Return the triplanar view branch group.
      com.sun.j3d.utils.universe.SimpleUniverse getUniverse()
      Accessor for the universe for this 3D object.
      void recordMouse​(java.lang.String name, JPanelMouse myMouseDialog, int mouseMode)
      Unchanged.
      void resetAxisX()
      Reset the image volume to the original position.
      void resetAxisY()
      Reset the image volume to the original position.
      void resetImage()
      Reset the image volume to the original position.
      void rotateImage()
      Rotates the image volume when the camera manually takes snapshot.
      abstract void setAlphaBlend​(int value)
      Sets the alpha blending of parameter for two image displaying.
      void setBackgroundColor​(java.awt.Color color)
      Sets the color of the background.
      void setBoxColor​(java.awt.Color color)
      Sets the color of the box frame.
      abstract void setGUI​(java.lang.Object scene)
      Used by the JPanelMouse the redisplay the recorded actions.
      abstract void setRGBTA​(ModelRGB RGBT)
      Set the RGB table of imageA.
      abstract void setRGBTB​(ModelRGB RGBT)
      Get the RGB table of imageB.
      void setRotationAngle​(int value)
      Set the rotation angle with the camera takes snapshot.
      void setRotationAxis​(int axis)
      Set the roation axis ( X, Y, Z Axis ) when the camera takes snapshot.
      boolean writeImage()
      Write the image from the rendering frame into the camera capture frame.
      void writeImageAuto()
      Called when the camera button is clicked.
      • Methods inherited from class javax.media.j3d.Canvas3D

        addNotify, getBounds, getBounds, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphics2D, getGraphicsContext3D, getHeight, getImagePlateToVworld, getInverseVworldProjection, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getLocation, getLocation, getLocationOnScreen, getMonoscopicViewPolicy, getOffScreenBuffer, getOffScreenLocation, getOffScreenLocation, getPhysicalHeight, getPhysicalWidth, getPixelLocationFromImagePlate, getPixelLocationInImagePlate, getPixelLocationInImagePlate, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getSize, getSize, getStereoAvailable, getStereoEnable, getView, getVworldProjection, getVworldToImagePlate, getWidth, getX, getY, isOffScreen, isRendererRunning, isShadingLanguageSupported, postRender, preRender, queryProperties, removeNotify, renderField, renderOffScreenBuffer, setDoubleBufferEnable, setLeftManualEyeInImagePlate, setMonoscopicViewPolicy, setOffScreenBuffer, setOffScreenLocation, setOffScreenLocation, setRightManualEyeInImagePlate, setStereoEnable, startRenderer, stopRenderer, swap, waitForOffScreenRendering
      • Methods inherited from class java.awt.Canvas

        createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.event.ActionListener

        actionPerformed
      • Methods inherited from interface javax.swing.event.ChangeListener

        stateChanged
      • Methods inherited from interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback

        transformChanged
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • m_kZeroVector

        private static final javax.vecmath.Vector3f m_kZeroVector
        Set the zero vector.
      • m_iNumVoxels

        private static int m_iNumVoxels
        Image volume size and x, y, z extents.
      • m_iSizeX

        private static int m_iSizeX
        Image volume size and x, y, z extents.
      • m_iSizeY

        private static int m_iSizeY
        Image volume size and x, y, z extents.
      • m_iSizeZ

        private static int m_iSizeZ
        Image volume size and x, y, z extents.
      • akNormal

        private static javax.vecmath.Vector3f[] akNormal
        normal vector arrayes.
      • bounds

        public javax.media.j3d.BoundingSphere bounds
        A BoundingSphere that contains the entire scene. This bound is used for all scheduling, including lighting and mouse behaviors.
      • background

        protected javax.media.j3d.Background background
        The background node for the canvas.
      • canvas

        protected VolumeCanvas3D canvas
        The Canvas3D object on which the surfaces are drawn and where the picking happens.
      • captureImage

        protected ModelImage captureImage
        The resulting ModelImage of the camera snapshot.
      • config

        protected java.awt.GraphicsConfiguration config
        The config used to extends the Canvas3D class.
      • displayMode

        protected int displayMode
        Indicates which image is to be acted upon when two images are displayed.
      • imageA

        protected ModelImage imageA
        Reference to the image A of this frame.
      • imageB

        protected ModelImage imageB
        Reference to the image Bof this frame.
      • LUTa

        protected ModelLUT LUTa
        Reference to LUT for image A.
      • LUTb

        protected ModelLUT LUTb
        Reference to LUT for image B.
      • objBehaviorBG

        protected javax.media.j3d.BranchGroup objBehaviorBG
        The BranchGroup to which the standard behaviors are attached, zoom and rotate.
      • objBoxFrameBG

        protected javax.media.j3d.BranchGroup objBoxFrameBG
        Parent of the whole box frame.
      • objRootBG

        protected javax.media.j3d.BranchGroup objRootBG
        The BranchGroup root of the scene managed by the simple universe. The root has a single child, a TransformGroup, that manages all of the actual scene objects.
      • rotationAngle

        protected int rotationAngle
        Rotation angle when the camera takes snapshot.
      • rotationAxis

        protected int rotationAxis
        Rotation axis when the camera takes snapshot.
      • rotationControlPanel

        protected JPanelCamera rotationControlPanel
        Camera control dialog box.
      • rotationTimes

        protected int rotationTimes
        Number of rotation during the camera auto snapshotting.
      • rotationTotal

        protected int rotationTotal
        The total rotation degree, fixing one bug.
      • sceneRootTG

        protected javax.media.j3d.TransformGroup sceneRootTG
        A TransformGroup object to which all the scene objects are attached, including 3D images, surface, behavior, and lights.
      • transRotation

        protected javax.media.j3d.Transform3D transRotation
        transform rotation of the volume image during camera snapshot.
      • transRotationMatrix

        protected javax.media.j3d.Transform3D transRotationMatrix
        Rotation matrix.
      • triPlanarViewBG

        protected javax.media.j3d.BranchGroup triPlanarViewBG
        Triplanar view branch group, which hold the three plane view and the slice box frame view.
      • universe

        protected com.sun.j3d.utils.universe.SimpleUniverse universe
        The SimpleUniverse object which is the parent of everything else in the scene.
      • viewPanel

        protected JPanelView viewPanel
        View dialog associated with surface plotter or renderer.
      • sliderEvents

        protected MouseEventVector sliderEvents
        Slider events used by the mouse recorder.
    • Constructor Detail

      • RenderViewBase

        public RenderViewBase​(ModelImage _imageA,
                              ModelImage _imageB,
                              java.awt.GraphicsConfiguration _config)
        Calls the constructor for ViewJFrameBase with the same parameters.
        Parameters:
        _imageA - The current image A.
        _imageB - The current image B, or null if there isn't one.
        _config - The graphics config to use when rendering
    • Method Detail

      • getSceneState

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

        public abstract void setAlphaBlend​(int value)
        Sets the alpha blending of parameter for two image displaying.
        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 abstract void setGUI​(java.lang.Object scene)
        Used by the JPanelMouse the redisplay the recorded actions.
        Parameters:
        scene - Object
      • setRGBTA

        public abstract void setRGBTA​(ModelRGB RGBT)
        Set the RGB table of imageA. Method will be extended in renders.
        Parameters:
        RGBT - the rgb table to use for image A
      • setRGBTB

        public abstract void setRGBTB​(ModelRGB RGBT)
        Get the RGB table of imageB. Method will be extended in renders.
        Parameters:
        RGBT - the rgb table to use for image B
      • getNormals

        public static final javax.vecmath.Vector3f[] getNormals()
        Get the normal vector arrays.
        Returns:
        Vector3f[] normal vector array.
      • autoCapture

        public void autoCapture()
        Calculate the rotation matrix when the auto camera caputuring the images.
      • calcImageNormals

        public javax.vecmath.Vector3f[] calcImageNormals()
        Create array of normal vectors corresponding to the voxels in the volume. The normal vector is computed based on the gradient of the volume intensity values.
        Returns:
        DOCUMENT ME!
      • disableCamera

        public void disableCamera()
        Set the captureFrame to null.
      • disposeLocal

        public void disposeLocal()
        Clean memory.
      • getBehaviorGroup

        public javax.media.j3d.BranchGroup getBehaviorGroup()
        Accessor for the branch group that holds the mouse behavior.
        Returns:
        The mouse behavior's branch group.
      • getBound

        public javax.media.j3d.BoundingSphere getBound()
        Accessor for the bounds sphere.
        Returns:
        bounding sphere
      • getBranchGroup

        public javax.media.j3d.BranchGroup getBranchGroup()
        Accessor for the branch group of this 3D object, the parent of the transform group.
        Returns:
        The branch group parent of the scene.
      • getCanvas

        public javax.media.j3d.Canvas3D getCanvas()
        Accessor for the canvas for this 3D object.
        Returns:
        The canvas for the scene.
      • getImageA

        public ModelImage getImageA()
        Accessor that returns the reference to image A.
        Returns:
        Image A.
      • getImageB

        public ModelImage getImageB()
        Accessor that returns the reference to image B.
        Returns:
        Image B.
      • getRGBTA

        public ModelRGB getRGBTA()
        Get the RGB table of imageA. Method will be extended in renders.
        Returns:
        rgb table for image A
      • getRGBTB

        public ModelRGB getRGBTB()
        Get the RGB table of imageB. Method will be extended in renders.
        Returns:
        rgb table for image B
      • getSceneRootTG

        public javax.media.j3d.TransformGroup getSceneRootTG()
        Accessor for the transform group of the scene, which is the parent of everything displayed.
        Returns:
        The transform group of the scene.
      • getTriPlanarViewBG

        public javax.media.j3d.BranchGroup getTriPlanarViewBG()
        Return the triplanar view branch group.
        Returns:
        triPlanarViewBG the triplanar view branch group
      • getUniverse

        public com.sun.j3d.utils.universe.SimpleUniverse getUniverse()
        Accessor for the universe for this 3D object.
        Returns:
        The universe for the scene.
      • resetAxisX

        public void resetAxisX()
        Reset the image volume to the original position.
      • resetAxisY

        public void resetAxisY()
        Reset the image volume to the original position.
      • resetImage

        public void resetImage()
        Reset the image volume to the original position.
      • rotateImage

        public void rotateImage()
        Rotates the image volume when the camera manually takes snapshot.
      • setBackgroundColor

        public void setBackgroundColor​(java.awt.Color color)
        Sets the color of the background.
        Parameters:
        color - Color to set to.
      • setBoxColor

        public void setBoxColor​(java.awt.Color color)
        Sets the color of the box frame.
        Parameters:
        color - Color to set to.
      • setRotationAngle

        public void setRotationAngle​(int value)
        Set the rotation angle with the camera takes snapshot.
        Parameters:
        value - angle value
      • setRotationAxis

        public void setRotationAxis​(int axis)
        Set the roation axis ( X, Y, Z Axis ) when the camera takes snapshot.
        Parameters:
        axis - X_AXIS, Y_AXIS or Z_AXIS.
      • writeImage

        public boolean writeImage()
        Write the image from the rendering frame into the camera capture frame.
        Returns:
        succeed true means succeed, false means unsucceed.
      • writeImageAuto

        public void writeImageAuto()
        Called when the camera button is clicked. This method brings up the camera control dialog.
      • createBoxFrame

        protected void createBoxFrame​(float xBox,
                                      float yBox,
                                      float zBox)
        Creates a new box frame with the given dimensions.
        Parameters:
        xBox - X dimension of box frame.
        yBox - Y dimension of box frame.
        zBox - Z dimension of box frame.
      • recordMouse

        public void recordMouse​(java.lang.String name,
                                JPanelMouse myMouseDialog,
                                int mouseMode)
        Unchanged.
        Parameters:
        event - Original mouse event.