Class ViewJComponentRenderImage

  • All Implemented Interfaces:
    java.awt.event.MouseMotionListener, java.util.EventListener
    Direct Known Subclasses:
    ViewJComponentRenderImageRayCast, ViewJComponentRenderImageShearWarp

    public abstract class ViewJComponentRenderImage
    extends java.lang.Object
    implements java.awt.event.MouseMotionListener
    Abstract class used for displaying images in the program MIPAV.
    Version:
    1.0 August 31, 1999
    Author:
    Matthew J. McAuliffe, Ph.D.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void disposeLocal​(boolean flag)
      Clean memory.
      void drawImages​(int[] aiRenBufferA, int[] aiRenBufferB)
      Note that alphaBlending is applied with 1 component taken as zero if both components are not present -for example, if either imageA or imageB but not both has red, then the red component is alphaBlended with zero.
      protected void finalize()
      Calls dispose.
      float getalphaBlend()
      Accessor that returns amount of alpha blending between two images.
      javax.vecmath.AxisAngle4f getAxisAngle()
      DOCUMENT ME!
      javax.vecmath.Point3f getEyePoint()
      Return access to the current eye point in world coordinates.
      java.awt.image.BufferedImage getImage()
      Gets the Java image.
      ModelImage getImageA()
      Returns the imageA.
      ModelImage getImageB()
      Returns the imageB.
      ModelLUT getLUTa()
      Accessor that returns the model lut for the imageA.
      ModelLUT getLUTb()
      Accessor that returns the model lut for the imageB.
      boolean getParallel()
      Change the camera model.
      Renderer getRayTracerA()
      Accessor that returns the reference to rayTracerA.
      int getRenderMode()
      Get the rendering mode.
      ModelRGB getRGBTA()
      Accessor that returns the ModelRGB RGBTA for imageA.
      ModelRGB getRGBTB()
      Accessor that returns the ModelRGB for imageB.
      int getSpaceSize()
      Get the raytrace region space size.
      int getStepSize()
      Get raytrace step size.
      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 MouseMotionListener.
      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.
      boolean moveTrackBall​(float fX0, float fY0, float fX1, float fY1)
      A virtual track ball.
      void setAlphaBlend​(int iValue)
      Sets the alpha blending of parameter for two image displaying.
      void setBackgroundColor​(java.awt.Color color)
      Sets the background color for the frame and rendered image.
      void setImageA​(ModelImage image)
      Sets component's ImageA.
      void setImageB​(ModelImage image)
      Sets component's ImageB !!!!!!
      void setLUTa​(ModelLUT LUT)
      Accessor that sets the model LUT for the imageA.
      void setLUTb​(ModelLUT LUT)
      Accessor that sets the model LUTb for the imageB.
      void setMaxExtent​(int iMaxExtent, int[] rvolBufferA, int[] rvolBufferB)
      Updates the BufferedImage, Dimension, and render buffers when the render target image size changes so that the image can be redisplayed at the new target resolution.
      void setParallel​(boolean bParallel)
      Change the camera model.
      abstract void setRenderMode​(int renderMode)
      Change the camera model.
      void setRGBTA​(ModelRGB kRGBT)
      The following 2 functions set the RGB tables for ARGB images A and B.
      void setRGBTB​(ModelRGB kRGBT)
      Sets the RGB table for ARGB image B.
      void setSpaceSize​(int spaceSize)
      Set the raytrace region space size.
      void setStepSize​(int stepSize)
      Set the raytrace step size.
      void setXBoundNeg​(float value)
      Setup the X Negative clipping plane position.
      void setXBoundPos​(float value)
      Setup the X positive clipping plane position.
      void setYBoundNeg​(float value)
      Setup the Y Negative clipping plane position.
      void setYBoundPos​(float value)
      Setup the Y positive clipping plane position.
      void setZBoundNeg​(float value)
      Setup the Z negative clipping plane position.
      void setZBoundPos​(float value)
      Setup the Z positive clipping plane position.
      boolean show​(int tSlice, ModelLUT _LUTa, ModelLUT _LUTb, boolean forceShow, boolean bQualityHigh)
      shows the image and the VOI(s).
      protected abstract void trace​(int rayStepSize, int raySpaceSize)
      Ray trace by step size.
      boolean updateLighting​(SoftwareLightSet kLightSet, SoftwareMaterial kMaterial)
      Setup the specified set of lights to use for rendering.
      void updateTransform​(javax.media.j3d.Transform3D transform)
      Update transform from the surface volume render.
      boolean updateView​(int type, javax.media.j3d.Transform3D transform)
      Call by the surface volume render to update transform changes.
      • Methods inherited from class java.lang.Object

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

      • ModeXRAY

        public static final int ModeXRAY
        DRR rendering mode constant.
        See Also:
        Constant Field Values
      • ModeSURFACE

        public static final int ModeSURFACE
        SURFACE rendering mode constant.
        See Also:
        Constant Field Values
      • ModeCOMPOSITE

        public static final int ModeCOMPOSITE
        COMPOSITE rendering mode constant.
        See Also:
        Constant Field Values
      • ModeSURFACEFAST

        public static final int ModeSURFACEFAST
        Surface faset rendering mode constant.
        See Also:
        Constant Field Values
      • imageExtentMax

        protected int imageExtentMax
        DOCUMENT ME!
      • LUTa

        protected ModelLUT LUTa
        Lookup table for (intensity) image A.
      • LUTb

        protected ModelLUT LUTb
        Lookup table for (intensity) image B.
      • m_fAlphaBlend

        protected float m_fAlphaBlend
        alphaBlending values for compositing two images.
      • m_kBackgroundColor

        protected java.awt.Color m_kBackgroundColor
        DOCUMENT ME!
      • m_kImage

        protected java.awt.image.BufferedImage m_kImage
        DOCUMENT ME!
      • m_kImageA

        protected ModelImage m_kImageA
        Images to be renderer.
      • m_kImageB

        protected ModelImage m_kImageB
        DOCUMENT ME!
      • m_kImageDim

        protected java.awt.Dimension m_kImageDim
        DOCUMENT ME!
      • m_kRendererImageDataA

        protected RendererImageData m_kRendererImageDataA
        Manages the renderer data for each image.
      • m_kRendererImageDataB

        protected RendererImageData m_kRendererImageDataB
        DOCUMENT ME!
      • m_kRGBTA

        protected ModelRGB m_kRGBTA
        model of a RGB Table.
      • m_kRGBTB

        protected ModelRGB m_kRGBTB
        DOCUMENT ME!
      • m_kVolumeRenderer

        protected VolumeRenderer m_kVolumeRenderer
        Reference to the ShearWarpVolumeRenderer which hold this as an instance.
      • mode

        protected int mode
        mode - used to describe the cursor mode.
      • raySpaceSize

        protected int raySpaceSize
        Default ray tracing space size.
      • rayStepSize

        protected int rayStepSize
        Default ray tracing step size.
      • rayTracerA

        protected Renderer rayTracerA
        DOCUMENT ME!
      • rayTracerB

        protected Renderer rayTracerB
        DOCUMENT ME!
      • renBufferA

        protected int[] renBufferA
        Buffer used to store ARGB images of the image presently being displayed.
      • renBufferB

        protected int[] renBufferB
        DOCUMENT ME!
      • renderingMode

        protected int renderingMode
        Default rending mode, MIP mode.
      • timeSlice

        protected int timeSlice
        Time sliders value.
      • timeSliceA

        protected int timeSliceA
        DOCUMENT ME!
      • timeSliceB

        protected int timeSliceB
        DOCUMENT ME!
      • transformBU

        protected javax.media.j3d.Transform3D transformBU
        Current updated transform.
      • transformCounter

        protected int transformCounter
        Transform counter, used to reduce the rendering frequency.
      • m_aiPaintBuffer

        private int[] m_aiPaintBuffer
        buffer used for image to draw to display.
      • m_kAxisAngle

        private javax.vecmath.AxisAngle4f m_kAxisAngle
        Axis angle vector.
      • m_kV0

        private javax.vecmath.Vector3f m_kV0
        temporary variables to avoid 'new' calls.
      • m_kV1

        private javax.vecmath.Vector3f m_kV1
        temporary variables to avoid 'new' calls.
      • m_kVCross

        private javax.vecmath.Vector3f m_kVCross
        temporary variables to avoid 'new' calls.
    • Constructor Detail

      • ViewJComponentRenderImage

        public ViewJComponentRenderImage​(VolumeRenderer kVolumeRenderer,
                                         ModelImage _imageA,
                                         ModelLUT _LUTa,
                                         ModelImage _imageB,
                                         ModelLUT _LUTb,
                                         int[] rvolBufferA,
                                         int[] rvolBufferB,
                                         int[] extents,
                                         int renderMode,
                                         int maxExtent)
        ImageA and ImageB are expected to be of the same dimensionality !!
        Parameters:
        kVolumeRenderer - Access to renderer of which this is an instance.
        _imageA - Model of the image that will be displayed
        _LUTa - LUT used to display imageA
        _imageB - Model of the image that will be displayed
        _LUTb - LUT used to display imageB
        rvolBufferA - rendering buffer A
        rvolBufferB - rendering buffer B // Tagged for CHECKING DELETING
        extents - image dimension extents
        renderMode - rendering mode, MIP, DRR and SURFACE
        maxExtent - maximium extent value.
    • Method Detail

      • setRenderMode

        public abstract void setRenderMode​(int renderMode)
        Change the camera model.
        Parameters:
        renderMode - rendering mode.
      • disposeLocal

        public void disposeLocal​(boolean flag)
        Clean memory.
        Parameters:
        flag - is true call the super.disposeLocal
      • drawImages

        public void drawImages​(int[] aiRenBufferA,
                               int[] aiRenBufferB)
        Note that alphaBlending is applied with 1 component taken as zero if both components are not present -for example, if either imageA or imageB but not both has red, then the red component is alphaBlended with zero.
        Parameters:
        aiRenBufferA - DOCUMENT ME!
        aiRenBufferB - DOCUMENT ME!
      • getalphaBlend

        public float getalphaBlend()
        Accessor that returns amount of alpha blending between two images.
        Returns:
        DOCUMENT ME!
      • getAxisAngle

        public javax.vecmath.AxisAngle4f getAxisAngle()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getEyePoint

        public javax.vecmath.Point3f getEyePoint()
        Return access to the current eye point in world coordinates.
        Returns:
        Point3f current eye point in world coordinates.
      • getImage

        public java.awt.image.BufferedImage getImage()
        Gets the Java image.
        Returns:
        Java image
        See Also:
        Image
      • getImageA

        public ModelImage getImageA()
        Returns the imageA.
        Returns:
        imageA Model image A.
      • getImageB

        public ModelImage getImageB()
        Returns the imageB.
        Returns:
        imageB Model image B.
      • getLUTa

        public ModelLUT getLUTa()
        Accessor that returns the model lut for the imageA.
        Returns:
        LUTa the model LUT for imageA
      • getLUTb

        public ModelLUT getLUTb()
        Accessor that returns the model lut for the imageB.
        Returns:
        LUTb the model LUT for imageB
      • getParallel

        public boolean getParallel()
        Change the camera model.
        Returns:
        DOCUMENT ME!
      • getRayTracerA

        public Renderer getRayTracerA()
        Accessor that returns the reference to rayTracerA.
        Returns:
        DOCUMENT ME!
      • getRenderMode

        public int getRenderMode()
        Get the rendering mode.
        Returns:
        renderingMode MIP, DRR and SUR
      • getRGBTA

        public ModelRGB getRGBTA()
        Accessor that returns the ModelRGB RGBTA for imageA.
        Returns:
        DOCUMENT ME!
      • getRGBTB

        public ModelRGB getRGBTB()
        Accessor that returns the ModelRGB for imageB.
        Returns:
        DOCUMENT ME!
      • getSpaceSize

        public int getSpaceSize()
        Get the raytrace region space size.
        Returns:
        raySpaceSize space size.
      • getStepSize

        public int getStepSize()
        Get raytrace step size.
        Returns:
        rayStepSize raytrace step size.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
        Parameters:
        kEvent - the mouse event generated by a mouse press
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseMotionListener. This member handles rotating the virtual track ball during the dragging of the mouse after a mouse-press event but before a mouse-release event. Each drag event causes the virtual track ball to be rotated. Each such rotation causes a ray trace to occur, but the trace is generated at low resolution.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        kEvent - the event generated by the mouse dragging
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
        Parameters:
        kEvent - the mouse event generated by a mouse press
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
        Parameters:
        kEvent - the mouse event generated by a mouse press
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseMotionListener. This member only exists to satisfy the conditions of being a MouseMotionListener. It does nothing when invoked.
        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. When a mouse button is pressed, the application is starting a drag operation to rotate the virtual track ball. The initial mouse location is recorded for use by 'moveTrackBall', stored as a point (x0,y0) in [-1,1]^2.
        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. When a mouse button is released, the application is finishing a drag operation to rotate the virtual track ball. The final mouse location is recorded for use by 'moveTrackBall', stored as a point (x1,y1) in [-1,1]^2. The virtual track ball is moved into its final position and a ray trace is performed at highest resolution.
        Parameters:
        kEvent - the mouse event generated by a mouse press
      • moveTrackBall

        public boolean moveTrackBall​(float fX0,
                                     float fY0,
                                     float fX1,
                                     float fY1)
        A virtual track ball. This method generates a rotation matrix from (x0,y0) and (x1,y1), two points in [-1,1]^2. If either point is outside the unit circle, it is projected onto the unit circle. The corresponding sphere points (x0,y0,z0) and (x1,y1,z1) are computed. The cross product is used as the axis of rotation. The angle between the vectors is used as the angle of rotation. The rotation matrix is used to rotate the oriented bounding box of the 3D image.
        Parameters:
        fX0 - DOCUMENT ME!
        fY0 - DOCUMENT ME!
        fX1 - DOCUMENT ME!
        fY1 - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • setAlphaBlend

        public void setAlphaBlend​(int iValue)
        Sets the alpha blending of parameter for two image displaying.
        Parameters:
        iValue - int amount [0,100] that is the percentage of Image A to be displayed
      • setBackgroundColor

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

        public void setImageA​(ModelImage image)
        Sets component's ImageA.
        Parameters:
        image - DOCUMENT ME! assumes dimensionality same as image B's for now
      • setImageB

        public void setImageB​(ModelImage image)
        Sets component's ImageB !!!!!! assumes dimensionality same as image A's for now will fix soon.
        Parameters:
        image - imageB
      • setLUTa

        public void setLUTa​(ModelLUT LUT)
        Accessor that sets the model LUT for the imageA.
        Parameters:
        LUT - the model LUT
      • setLUTb

        public void setLUTb​(ModelLUT LUT)
        Accessor that sets the model LUTb for the imageB.
        Parameters:
        LUT - the model LUT
      • setMaxExtent

        public void setMaxExtent​(int iMaxExtent,
                                 int[] rvolBufferA,
                                 int[] rvolBufferB)
        Updates the BufferedImage, Dimension, and render buffers when the render target image size changes so that the image can be redisplayed at the new target resolution.
        Parameters:
        iMaxExtent - DOCUMENT ME!
        rvolBufferA - DOCUMENT ME!
        rvolBufferB - DOCUMENT ME!
      • setParallel

        public void setParallel​(boolean bParallel)
        Change the camera model.
        Parameters:
        bParallel - true for a parallel camera, false for a perspective camera
      • setRGBTA

        public void setRGBTA​(ModelRGB kRGBT)
        The following 2 functions set the RGB tables for ARGB images A and B. Sets the RGB table for ARGB image A
        Parameters:
        kRGBT - RGB table
      • setRGBTB

        public void setRGBTB​(ModelRGB kRGBT)
        Sets the RGB table for ARGB image B.
        Parameters:
        kRGBT - RGB table
      • setSpaceSize

        public void setSpaceSize​(int spaceSize)
        Set the raytrace region space size.
        Parameters:
        spaceSize - region space size.
      • setStepSize

        public void setStepSize​(int stepSize)
        Set the raytrace step size.
        Parameters:
        stepSize - step size
      • setXBoundNeg

        public void setXBoundNeg​(float value)
        Setup the X Negative clipping plane position.
        Parameters:
        value - position of the X negative clip slider.
      • setXBoundPos

        public void setXBoundPos​(float value)
        Setup the X positive clipping plane position.
        Parameters:
        value - position of the X positive clip slider.
      • setYBoundNeg

        public void setYBoundNeg​(float value)
        Setup the Y Negative clipping plane position.
        Parameters:
        value - position of the Y negative clip slider.
      • setYBoundPos

        public void setYBoundPos​(float value)
        Setup the Y positive clipping plane position.
        Parameters:
        value - positin of the Y positve clip slider.
      • setZBoundNeg

        public void setZBoundNeg​(float value)
        Setup the Z negative clipping plane position.
        Parameters:
        value - position of the Z negative clip slider.
      • setZBoundPos

        public void setZBoundPos​(float value)
        Setup the Z positive clipping plane position.
        Parameters:
        value - position of the Z positive clip slider.
      • show

        public boolean show​(int tSlice,
                            ModelLUT _LUTa,
                            ModelLUT _LUTb,
                            boolean forceShow,
                            boolean bQualityHigh)
        shows the image and the VOI(s).
        Parameters:
        tSlice - t (time) slice to show
        _LUTa - LUTa - to change to new LUT for imageA else null
        _LUTb - LUTb - to change to new LUT for imageB else null
        forceShow - forces this method to import image and recalculate java image
        bQualityHigh - forces a call to trace(1,1) instead of using lower res sampling
        Returns:
        boolean to indicate if the show was successful
      • updateLighting

        public boolean updateLighting​(SoftwareLightSet kLightSet,
                                      SoftwareMaterial kMaterial)
        Setup the specified set of lights to use for rendering.
        Parameters:
        kLightSet - SoftwareLightSet Set of world/model lights.
        kMaterial - SoftwareMaterial Set of default material properties to use when applying the lighting.
        Returns:
        boolean True if the update of lighting triggers a need to redraw the images.
      • updateTransform

        public void updateTransform​(javax.media.j3d.Transform3D transform)
        Update transform from the surface volume render.
        Parameters:
        transform - Transform3D
      • updateView

        public boolean updateView​(int type,
                                  javax.media.j3d.Transform3D transform)
        Call by the surface volume render to update transform changes. Composite the slice trace by the specified space size.
        Parameters:
        type - Transform type, current not used.
        transform - Transform3D
      • trace

        protected abstract void trace​(int rayStepSize,
                                      int raySpaceSize)
        Ray trace by step size.
        Parameters:
        rayStepSize - interp step size
        raySpaceSize - DOCUMENT ME!
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Calls dispose.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - DOCUMENT ME!