Class PlaneRender

  • All Implemented Interfaces:
    MouseBehaviorCallback, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

    public class PlaneRender
    extends VolumeCanvas3D
    implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener, MouseBehaviorCallback
    Class PlaneRender: renders a single dimension of the ModelImage data as a texture-mapped polygon. The PlaneRender class keeps track of whether it is rendering the Axial, Sagital, or Coronal view of the data. Surfaces are displayed as the intersection of the ModelTriangleMesh with the rendered z-slice.
    See Also:
    Serialized Form
    • Nested Class Summary

      • 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 int[] m_aiLocalImageExtents
      The image dimensions in x,y,z:.
      private javax.vecmath.Color3f[] m_akColors
      Set of colors used to draw the X and Y Bars and the Z box:.
      private javax.media.j3d.ImageComponent2D[] m_akImageComponent
      Image component 2D.
      private boolean m_bDrawAxes
      when true, the axis labels (P-> L-> S->) will be drawn
      private boolean m_bDrawXHairs
      Turns on drawing of the X,Y bars and the Axis labels:.
      private boolean m_bEntryPointSelect
      Boolean to turn on/off the RFA probe entry point selection with mouse:.
      private boolean m_bFirstDrag
      Change the mouse cursor with the first mouseDrag event
      private boolean m_bLeftMousePressed
      True when the left mouse has been pressed, set to false when the left mouse button is released.
      private boolean m_bMemoryUsage
      Whether to store all the data in ImageComponent2D array or not:.
      private boolean m_bPatientOrientation
      Actual image orietation.
      private boolean m_bRightMousePressed
      Flag indicating if the right mouse button is currently pressed down:
      private float m_fCenterX
      The center of the X,Y bar cross hairs, in plane coordinates:.
      private float m_fCenterY
      The center of the X,Y bar cross hairs, in plane coordinates:.
      private float m_fMaxBox
      Numbers dicatating the size of the plane based on the extents and resolutions of the image.
      private float m_fX0
      lower x-bound of the texture-mapped polygon:
      private float m_fX1
      upper x-bound of the texture-mapped polygon:
      private float m_fXBox
      Numbers dicatating the size of the plane based on the extents and resolutions of the image.
      private float m_fXRange
      Width of the texture-mapped polygon:
      private float m_fXTranslate
      X direction mouse translation.
      private float m_fY0
      lower y-bound of the texture-mapped polygon:
      private float m_fY1
      upper y-bound of the texture-mapped polygon:
      private float m_fYBox
      Numbers dicatating the size of the plane based on the extents and resolutions of the image.
      private float m_fYRange
      Height of the texture-mapped polygon:
      private float m_fYTranslate
      Y direction mouse translatioin.
      private float m_fZoomScale
      Image scaling from Zoom:.
      private int m_iPlaneOrientation
      Which dimension of the ModelImage to render.
      private int m_iSlice
      Which slice is currently displayed in the XY plane.
      private ModelImage m_kActiveImage
      Current active image for manipulating the LUT by dragging with the right-mouse down.
      private ModelStorageBase m_kActiveLookupTable
      The current active lookup table:
      private VolumeCanvas3D m_kCanvas
      The Canvas3D object on which the plane is drawn.
      private javax.media.j3d.Transform3D m_kCurrentTransform
      current zoom transformation
      private javax.media.j3d.ImageComponent2D m_kDisplayedImage
      The current displayed texture, based on the value of m_iSlice.
      private ModelImage m_kImageA
      Current image A.
      private ModelImage m_kImageB
      Current image B.
      private java.lang.String m_kLabelX
      x-axis label:
      private java.lang.String m_kLabelY
      y-axis label:
      private MouseTranslation m_kMouseTranslate
      Mouse translate behavior.
      private MouseZoomBehavior m_kMouseZoom
      Mouse zoom behavior.
      private javax.media.j3d.BranchGroup m_kObjRootBG
      The BranchGroup root of the scene managed by the simple universe.
      private javax.media.j3d.OrderedGroup m_kOrderedGroup
      Root order group of the image scene graph.
      private ViewJFrameVolumeView m_kParent
      Reference to the parent frame:.
      private PatientSlice m_kPatientSlice
      PatientSlice contains all the Patient Coordinate System view-specific data for rendering this component:
      private javax.media.j3d.BranchGroup m_kRFA_BranchGroup
      Branch group for the RFA indicator point.
      private javax.media.j3d.BranchGroup m_kTextBranchGroup
      Branch group to hold the texture image.
      private javax.media.j3d.TransformGroup m_kTextTransformGroup
      Transform group to hold the texture images.
      private javax.media.j3d.Texture2D m_kTexture
      The 2D texture for the texture-mapped polygon.
      private javax.media.j3d.TransformGroup m_kTranslationTG
      Group dictating how the plane is translated.
      private com.sun.j3d.utils.universe.SimpleUniverse m_kUniverse
      The SimpleUniverse object which is the parent of everything else in the scene.
      private WindowLevel m_kWinLevel  
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the frame.
      private void createImageSceneGraph()
      Creates the scene graph, made up of a branch group parent, a transform group under that which applies mouse behaviors to the scene, and a branch groups under the transform group for the texture-mapped polygon.
      void disposeLocal()
      Clean memory.
      private void drawLabels()
      Draws the Z box, the X bar and the Y bar:.
      void drawRFAPoint​(javax.vecmath.Point3f kPoint)
      Given a point in FileCoordinates, transform the point to local PatientCoordinates, and draw with a red sphere:
      void enableTargetPointPicking​(boolean bEnable)
      Enable or disable target point for the RFA probe from within the plane renderer:
      protected void finalize()
      Cleans memory.
      VolumeCanvas3D getCanvas()
      Returns the VolumeCanvas3D object.
      javax.vecmath.Vector3f getCenter()
      Returns the current center point of the 3 intersecting ModelImage planes in FileCoordinates.
      ModelImage getImageA()
      Accessor that returns the reference to image A.
      ModelImage getImageB()
      Accessor that returns the reference to image B.
      private void init()
      Creates the scene graph and initializes the SimpleUniverse and the Viewing transformations.
      private void initAxes()
      Initializes the Axis labels based on the ModelImage orientation.
      private void LocalToPatient​(WildMagic.LibFoundation.Mathematics.Vector3f localPt, WildMagic.LibFoundation.Mathematics.Vector3f patientPt)  
      void mouseClicked​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseDragged​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseEntered​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseExited​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a mouselistener.
      void mouseMoved​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseMotionListener.
      void mousePressed​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseReleased​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      private void PatientToLocal​(WildMagic.LibFoundation.Mathematics.Vector3f patientPt, WildMagic.LibFoundation.Mathematics.Vector3f localPt)
      Convert the position in PatientCoordinates into Local rendering coordinates:
      private void processLeftMouseDrag​(java.awt.event.MouseEvent kEvent)
      Dragging the mouse with the left-mouse button held down changes the positions of the X and Y cross bars, and therefor the ZSlice positions of the associated PlaneRender objects and the TriPlanar Surface.
      private void processRightMouseDrag​(java.awt.event.MouseEvent kEvent)
      If the right mouse button is pressed and dragged. processRightMouseDrag updates the HistoLUT window and level (contrast and brightness)
      private void ScreenToLocal​(int iX, int iY, WildMagic.LibFoundation.Mathematics.Vector3f kLocal, boolean bSetCenter)
      Calculate the position of the mouse in the Local Coordinates, taking into account zoom and translate:
      void setBackgroundColor​(java.awt.Color color)
      Sets the background color for the frame and rendered image.
      void setCenter​(WildMagic.LibFoundation.Mathematics.Vector3f center)
      setCenter sets the cursor and slice position for this PlaneRender object, based on the 3D location of the three intersecting ModelImage planes.
      void setLUTa​(ModelLUT LUT)
      Accessor that sets the LUT for image A.
      void setLUTb​(ModelLUT LUT)
      Accessor that sets the LUT for image B.
      private void setOrientation()
      Based on the orientaion of the ModelImage, sets up the index parameters, m_aiLocalImageExtents[0], m_aiLocalImageExtents[1], and m_aiLocalImageExtents[2], the drawing colors for the z box, x and y bars, and the invert flags.
      void setRGBTA​(ModelRGB RGBT)
      Accessor that sets the RGB lookup table for image A.
      void setRGBTB​(ModelRGB RGBT)
      Accessor that sets the RGB lookup table for image B.
      void setSlice​(float fSlice)
      Changes the displayed texture based on the new value for m_iSlice.
      void setSliceHairColor​(int iView, javax.vecmath.Color3f kColor)
      Sets the default color for the SliceHairColor.
      private void setXBar​(float fSlice)
      Sets the new location of the XBar.
      private void setYBar​(float fSlice)
      Sets the new location of the YBar.
      void showAxes​(boolean bShow)
      Turns displaying the Axis labes on or off:
      void showXHairs​(boolean bShow)
      Turns displaying the X and Y bars on or off:
      void transformChanged​(int type, javax.media.j3d.Transform3D transform)
      Tells the mouse dialog that the transform has changed.
      void update()
      Causes the labels to be redrawn:.
      void updateData()
      Causes new data to be loaded from the ModelImage into the textures and redisplayed on the texture-mapped polygon:
      void updateLut​(ModelLUT LUTa, ModelLUT LUTb)
      Causes the data to be redrawn with new LUT values:
      void updateRGBTA​(ModelRGB RGBT)
      Causes the data to be redrawn with new RGBTA values:
      void updateRGBTB​(ModelRGB RGBT)
      Causes the data to be redrawn with new RGBTA values:
      private void updateViewScreenScale​(javax.media.j3d.Transform3D kTransform)
      This function calculates the scale factor for zooming in parallel projection.
      private void writeTexture​(boolean bForceShow)
      Stores the ModelImage data as an array of texture maps, with LUT or RGBA color lookup:.
      • 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

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

        private int[] m_aiLocalImageExtents
        The image dimensions in x,y,z:.
      • m_akImageComponent

        private javax.media.j3d.ImageComponent2D[] m_akImageComponent
        Image component 2D. Used to store the ModelImage data as textures.
      • m_akColors

        private javax.vecmath.Color3f[] m_akColors
        Set of colors used to draw the X and Y Bars and the Z box:.
      • m_bDrawAxes

        private boolean m_bDrawAxes
        when true, the axis labels (P-> L-> S->) will be drawn
      • m_bDrawXHairs

        private boolean m_bDrawXHairs
        Turns on drawing of the X,Y bars and the Axis labels:.
      • m_bEntryPointSelect

        private boolean m_bEntryPointSelect
        Boolean to turn on/off the RFA probe entry point selection with mouse:.
      • m_bFirstDrag

        private boolean m_bFirstDrag
        Change the mouse cursor with the first mouseDrag event
      • m_bLeftMousePressed

        private boolean m_bLeftMousePressed
        True when the left mouse has been pressed, set to false when the left mouse button is released.
      • m_bMemoryUsage

        private boolean m_bMemoryUsage
        Whether to store all the data in ImageComponent2D array or not:.
      • m_bPatientOrientation

        private boolean m_bPatientOrientation
        Actual image orietation.
      • m_bRightMousePressed

        private boolean m_bRightMousePressed
        Flag indicating if the right mouse button is currently pressed down:
      • m_fCenterX

        private float m_fCenterX
        The center of the X,Y bar cross hairs, in plane coordinates:.
      • m_fCenterY

        private float m_fCenterY
        The center of the X,Y bar cross hairs, in plane coordinates:.
      • m_kActiveLookupTable

        private ModelStorageBase m_kActiveLookupTable
        The current active lookup table:
      • m_fX0

        private float m_fX0
        lower x-bound of the texture-mapped polygon:
      • m_fX1

        private float m_fX1
        upper x-bound of the texture-mapped polygon:
      • m_fXBox

        private float m_fXBox
        Numbers dicatating the size of the plane based on the extents and resolutions of the image.
      • m_fYBox

        private float m_fYBox
        Numbers dicatating the size of the plane based on the extents and resolutions of the image.
      • m_fMaxBox

        private float m_fMaxBox
        Numbers dicatating the size of the plane based on the extents and resolutions of the image.
      • m_fXRange

        private float m_fXRange
        Width of the texture-mapped polygon:
      • m_fXTranslate

        private float m_fXTranslate
        X direction mouse translation.
      • m_fY0

        private float m_fY0
        lower y-bound of the texture-mapped polygon:
      • m_fY1

        private float m_fY1
        upper y-bound of the texture-mapped polygon:
      • m_fYRange

        private float m_fYRange
        Height of the texture-mapped polygon:
      • m_fYTranslate

        private float m_fYTranslate
        Y direction mouse translatioin.
      • m_fZoomScale

        private float m_fZoomScale
        Image scaling from Zoom:.
      • m_iPlaneOrientation

        private int m_iPlaneOrientation
        Which dimension of the ModelImage to render.
      • m_iSlice

        private int m_iSlice
        Which slice is currently displayed in the XY plane.
      • m_kActiveImage

        private ModelImage m_kActiveImage
        Current active image for manipulating the LUT by dragging with the right-mouse down.
      • m_kCanvas

        private VolumeCanvas3D m_kCanvas
        The Canvas3D object on which the plane is drawn.
      • m_kCurrentTransform

        private javax.media.j3d.Transform3D m_kCurrentTransform
        current zoom transformation
      • m_kDisplayedImage

        private javax.media.j3d.ImageComponent2D m_kDisplayedImage
        The current displayed texture, based on the value of m_iSlice.
      • m_kImageA

        private ModelImage m_kImageA
        Current image A.
      • m_kImageB

        private ModelImage m_kImageB
        Current image B.
      • m_kLabelX

        private java.lang.String m_kLabelX
        x-axis label:
      • m_kLabelY

        private java.lang.String m_kLabelY
        y-axis label:
      • m_kMouseTranslate

        private MouseTranslation m_kMouseTranslate
        Mouse translate behavior.
      • m_kObjRootBG

        private javax.media.j3d.BranchGroup m_kObjRootBG
        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 objects.
      • m_kOrderedGroup

        private javax.media.j3d.OrderedGroup m_kOrderedGroup
        Root order group of the image scene graph.
      • m_kRFA_BranchGroup

        private javax.media.j3d.BranchGroup m_kRFA_BranchGroup
        Branch group for the RFA indicator point.
      • m_kTextBranchGroup

        private javax.media.j3d.BranchGroup m_kTextBranchGroup
        Branch group to hold the texture image.
      • m_kTextTransformGroup

        private javax.media.j3d.TransformGroup m_kTextTransformGroup
        Transform group to hold the texture images.
      • m_kTexture

        private javax.media.j3d.Texture2D m_kTexture
        The 2D texture for the texture-mapped polygon.
      • m_kTranslationTG

        private javax.media.j3d.TransformGroup m_kTranslationTG
        Group dictating how the plane is translated.
      • m_kUniverse

        private com.sun.j3d.utils.universe.SimpleUniverse m_kUniverse
        The SimpleUniverse object which is the parent of everything else in the scene.
      • m_kPatientSlice

        private PatientSlice m_kPatientSlice
        PatientSlice contains all the Patient Coordinate System view-specific data for rendering this component:
    • Constructor Detail

      • PlaneRender

        public PlaneRender​(ViewJFrameVolumeView kParent,
                           ModelImage kImageA,
                           ModelLUT kLUTa,
                           ModelImage kImageB,
                           ModelLUT kLUTb,
                           java.awt.GraphicsConfiguration kConfig,
                           int iPlane,
                           boolean bMemory)
        Creates a new PlaneRender object.
        Parameters:
        kParent - ViewJFrameVolumeView - reference to parent frame.
        kImageA - First image to display, cannot be null.
        kLUTa - LUT of the imageA (if null grayscale LUT is constructed).
        kImageB - Second loaded image, may be null.
        kLUTb - LUT of the imageB, may be null.
        kConfig - GraphicsConfiguration
        iPlane - Image dimension to be displayed.
        bMemory - when true store all the data in memory, when false, write textues as the slices change
    • Method Detail

      • close

        public void close()
        Closes the frame.
      • disposeLocal

        public void disposeLocal()
        Clean memory.
      • drawRFAPoint

        public void drawRFAPoint​(javax.vecmath.Point3f kPoint)
        Given a point in FileCoordinates, transform the point to local PatientCoordinates, and draw with a red sphere:
        Parameters:
        kPoint - RFA indicator point coordinate
      • enableTargetPointPicking

        public void enableTargetPointPicking​(boolean bEnable)
        Enable or disable target point for the RFA probe from within the plane renderer:
        Parameters:
        bEnable - true enable target point, false not.
      • getCanvas

        public VolumeCanvas3D getCanvas()
        Returns the VolumeCanvas3D object.
        Returns:
        the volume canvas
      • 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.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This function is called when there is a double-click event.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        kEvent - the mouse event generated by a mouse clicked
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This function is invoked when a mouse button is held down and the mouse is dragged in the active window area.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        kEvent - the mouse event generated by a mouse drag
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This function is called when the mouse enters the active area.
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        kEvent - the mouse event generated by a mouse entered
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a mouselistener. This function is called when the mouse leaves the active area.
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        kEvent - the mouse event generated by a mouse exit
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseMotionListener. This function is called when the mouse is moved (without holding any buttons down).
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Parameters:
        kEvent - the event generated by a mouse movement
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener.

        If the left mouse button is pressed, the function sets the m_bLeftMousePressed to be true, and records the current canvas width and height.

        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        kEvent - the mouse event generated by a mouse press
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        kEvent - the mouse event generated by a mouse release
      • setBackgroundColor

        public void setBackgroundColor​(java.awt.Color color)
        Sets the background color for the frame and rendered image.
        Parameters:
        color - RGBA color to use as the background color.
      • setLUTa

        public void setLUTa​(ModelLUT LUT)
        Accessor that sets the LUT for image A.
        Parameters:
        LUT - The LUT.
      • setLUTb

        public void setLUTb​(ModelLUT LUT)
        Accessor that sets the LUT for image B.
        Parameters:
        LUT - The LUT.
      • setRGBTA

        public void setRGBTA​(ModelRGB RGBT)
        Accessor that sets the RGB lookup table for image A.
        Parameters:
        RGBT - the new ModelRGB for PatientSlice.imageA
      • setRGBTB

        public void setRGBTB​(ModelRGB RGBT)
        Accessor that sets the RGB lookup table for image B.
        Parameters:
        RGBT - the new ModelRGB for PatientSlice.imageB
      • setSlice

        public void setSlice​(float fSlice)
        Changes the displayed texture based on the new value for m_iSlice.
        Parameters:
        fSlice - The relative position along the actual m_aiLocalImageExtents[2] dimension of the new slice.
      • setXBar

        private void setXBar​(float fSlice)
        Sets the new location of the XBar.
        Parameters:
        fSlice - The new position of the XBar in plane coordinates:
      • setSliceHairColor

        public void setSliceHairColor​(int iView,
                                      javax.vecmath.Color3f kColor)
        Sets the default color for the SliceHairColor.
        Parameters:
        kColor - set the hair color to this color
      • setYBar

        private void setYBar​(float fSlice)
        Sets the new location of the YBar.
        Parameters:
        fSlice - The new position of the YBar in plane coordinates:
      • showAxes

        public void showAxes​(boolean bShow)
        Turns displaying the Axis labes on or off:
        Parameters:
        bShow - when true display the axis lables, when false hide the axis labels
      • showXHairs

        public void showXHairs​(boolean bShow)
        Turns displaying the X and Y bars on or off:
        Parameters:
        bShow - when true show the cross-hairs when false hide the cross-hairs
      • transformChanged

        public void transformChanged​(int type,
                                     javax.media.j3d.Transform3D transform)
        Tells the mouse dialog that the transform has changed.
        Specified by:
        transformChanged in interface MouseBehaviorCallback
        Parameters:
        type - Type of transform.
        transform - Transform that was changed to.
      • update

        public void update()
        Causes the labels to be redrawn:.
      • updateData

        public void updateData()
        Causes new data to be loaded from the ModelImage into the textures and redisplayed on the texture-mapped polygon:
      • updateLut

        public void updateLut​(ModelLUT LUTa,
                              ModelLUT LUTb)
        Causes the data to be redrawn with new LUT values:
        Parameters:
        LUTa - imageA LUT
        LUTb - imageB LUT
      • updateRGBTA

        public void updateRGBTA​(ModelRGB RGBT)
        Causes the data to be redrawn with new RGBTA values:
        Parameters:
        RGBT - imageA ModelRGB
      • updateRGBTB

        public void updateRGBTB​(ModelRGB RGBT)
        Causes the data to be redrawn with new RGBTA values:
        Parameters:
        RGBT - imageB ModelRGB
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Cleans memory.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - if there is a problem encountered during memory clean-up
      • createImageSceneGraph

        private void createImageSceneGraph()
        Creates the scene graph, made up of a branch group parent, a transform group under that which applies mouse behaviors to the scene, and a branch groups under the transform group for the texture-mapped polygon.
      • drawLabels

        private void drawLabels()
        Draws the Z box, the X bar and the Y bar:.
      • ScreenToLocal

        private void ScreenToLocal​(int iX,
                                   int iY,
                                   WildMagic.LibFoundation.Mathematics.Vector3f kLocal,
                                   boolean bSetCenter)
        Calculate the position of the mouse in the Local Coordinates, taking into account zoom and translate:
        Parameters:
        iX - mouse x coordinate value
        iY - mouse y coordinate value
        kLocal - mouse position in Local Coordinates
        bSetCenter - if true updates the position for rendering the x-bar and y-bar colored axes (for left mouse drag)
      • LocalToPatient

        private void LocalToPatient​(WildMagic.LibFoundation.Mathematics.Vector3f localPt,
                                    WildMagic.LibFoundation.Mathematics.Vector3f patientPt)
      • PatientToLocal

        private void PatientToLocal​(WildMagic.LibFoundation.Mathematics.Vector3f patientPt,
                                    WildMagic.LibFoundation.Mathematics.Vector3f localPt)
        Convert the position in PatientCoordinates into Local rendering coordinates:
        Parameters:
        patientPt - the current point in PatientCoordinates
        localPt - the transformed point in LocalCoordinates
      • init

        private void init()
        Creates the scene graph and initializes the SimpleUniverse and the Viewing transformations.
      • initAxes

        private void initAxes()
        Initializes the Axis labels based on the ModelImage orientation. Axes are displayed with 3D text objects and arrows drawn as polygons. They are colored and labeled to match the axes they represent.
      • processLeftMouseDrag

        private void processLeftMouseDrag​(java.awt.event.MouseEvent kEvent)
        Dragging the mouse with the left-mouse button held down changes the positions of the X and Y cross bars, and therefor the ZSlice positions of the associated PlaneRender objects and the TriPlanar Surface. The new positions are calculated and passed onto the parent frame.
        Parameters:
        kEvent - the mouse event generated by a mouse drag
      • setCenter

        public void setCenter​(WildMagic.LibFoundation.Mathematics.Vector3f center)
        setCenter sets the cursor and slice position for this PlaneRender object, based on the 3D location of the three intersecting ModelImage planes.
        Parameters:
        center - the 3D center in FileCoordinates of the three intersecting ModelImage planes.
      • getCenter

        public javax.vecmath.Vector3f getCenter()
        Returns the current center point of the 3 intersecting ModelImage planes in FileCoordinates.
        Returns:
        the current volume center point in FileCoordinates
      • processRightMouseDrag

        private void processRightMouseDrag​(java.awt.event.MouseEvent kEvent)
        If the right mouse button is pressed and dragged. processRightMouseDrag updates the HistoLUT window and level (contrast and brightness)
        Parameters:
        kEvent - the mouse event generated by a mouse drag
      • setOrientation

        private void setOrientation()
        Based on the orientaion of the ModelImage, sets up the index parameters, m_aiLocalImageExtents[0], m_aiLocalImageExtents[1], and m_aiLocalImageExtents[2], the drawing colors for the z box, x and y bars, and the invert flags.

        Once setup everything is rendered into an x,y plane where x,y may be any of the original x,y, or z dimensions in the original ModelImage.

      • 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().
      • writeTexture

        private void writeTexture​(boolean bForceShow)
        Stores the ModelImage data as an array of texture maps, with LUT or RGBA color lookup:.