Class VolumeImageMultiDimensionalTransfer

java.lang.Object
WildMagic.LibApplications.OpenGLApplication.Application
WildMagic.LibApplications.OpenGLApplication.JavaApplication
WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
gov.nih.mipav.view.renderer.WildMagic.Render.VolumeImageViewer
gov.nih.mipav.view.renderer.WildMagic.Render.MultiDimensionalTransfer.VolumeImageMultiDimensionalTransfer
All Implemented Interfaces:
com.jogamp.opengl.GLEventListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, Serializable, EventListener

public class VolumeImageMultiDimensionalTransfer extends VolumeImageViewer implements com.jogamp.opengl.GLEventListener, KeyListener
This class implements the 2D Histogram display and user-interaction widget in the JPanelMultiDimensionalTransfer class. The widget is displayed with a GLCanvas with a screen-space polygon displaying the 2D Histogram texture as the background. The user can add ClassificationWidgets to the canvas and change their location and size as well as color and blending parameters. This class provides the display and user-interaction for those widgets. The widget parameters are then passed to the Volume Renderer GLSL program in the VolumeRayCast class where they determine how the volume is displayed.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private JPanel
    main container for this object:
    The list of widgets displayed on the 2D Histogram.
    private boolean
    When true a new Widget was added with the mouse.
    private boolean
     
    private boolean
    When true there is a pending mouse pick to process.
    private boolean
     
    private int
    The ID of the active and previously active widget.
    private int
     
    private int
    Stores which button was pressed during mouse drag.
    private int
    Stores the mouse position for picking.
    private int
    Stores the mouse position for picking.
    private int
    The ID of the
    private int
    The ID of the active and previously active widget.
    private WildMagic.LibFoundation.Mathematics.ColorRGBA
    The current color to use to create a new Widget.
    Reference to the containing JPanel.
    private WildMagic.LibFoundation.Mathematics.Vector2f
     
    private WildMagic.LibFoundation.Mathematics.Vector2f
    The bounds on the 2D Histogram texture coordinates used to display the 2D Histogram.
    private String
    Defines the current selected widget type.
    int
    The maximum number of widgets that can be added to the display.
    private static final long
     

    Fields inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D

    cameraParams, m_akWorldAxis, m_bCameraMoveable, m_bDArrowPressed, m_bEndPressed, m_bHomePressed, m_bLArrowPressed, m_bLInsertPressed, m_bObjectZoomed, m_bPgDnPressed, m_bPgUpPressed, m_bRArrowPressed, m_bRDeletePressed, m_bTrackBallDown, m_bUArrowPressed, m_bUseTrackBall, m_dAccumulatedTime, m_dFrameRate, m_dLastTime, m_fRotSpeed, m_fRotSpeedFactor, m_fTrnSpeed, m_fTrnSpeedFactor, m_fXDrag0, m_fXTrack0, m_fXTrack1, m_fYDrag0, m_fYTrack0, m_fYTrack1, m_fZoomSpeed, m_iAccumulatedFrameCount, m_iDoPitch, m_iDoRoll, m_iDoYaw, m_iFrameCount, m_iMaxTimer, m_iTimer, m_kSaveRotate, m_mouseRotSpeed, m_spkCamera, m_spkMotionObject, pitchRotationAngle, rollRotationAngle, xCameraMove, xCameraTurn, yawRotationAngle, yCameraMove, yCameraTurn, zCameraMove

    Fields inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication

    m_acWindowTitle, m_eBuffering, m_eDepth, m_eFormat, m_eMultisampling, m_eStencil, m_iHeight, m_iWidth, m_iXPosition, m_iYPosition, m_kBackgroundColor, m_pkRenderer
  • Constructor Summary

    Constructors
    Constructor
    Description
    VolumeImageMultiDimensionalTransfer(com.jogamp.opengl.util.Animator animator, com.jogamp.opengl.awt.GLCanvas canvas, double dpiScale, VolumeTriPlanarInterface kParentFrame, VolumeImage kVolumeImage)
    Create a new VolumeImageMultiDimensionalTranfer display.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    private void
    createContainer(com.jogamp.opengl.awt.GLCanvas canvas)
    Creates the containing JPanel that will display this object.
    protected void
     
    protected void
     
    void
    Set the display to true and call GLCanvas.display;
    void
    display(com.jogamp.opengl.GLAutoDrawable arg0)
     
    void
     
    void
    dispose(com.jogamp.opengl.GLAutoDrawable arg0)
     
    Returns the container for this object.
     
    int
    Returns the ID of the currently picked Widget.
    Returns the current Widgets.
    void
    init(com.jogamp.opengl.GLAutoDrawable arg0)
     
    void
    keyPressed callback.
    void
    load(String fileName)
     
    main(com.jogamp.opengl.awt.GLCanvas kCanvas, double dpiScale, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, boolean displayInSeparateFrame)
    Iridescence.main creates the Iridescence object and window frame to contain the GLCanvas.
    void
     
    void
     
    void
     
    void
     
    protected void
    Pick(WildMagic.LibGraphics.Rendering.Renderer kRenderer)
    Determine which widget is selected with the mouse/
    void
    reshape(com.jogamp.opengl.GLAutoDrawable arg0, int iX, int iY, int iWidth, int iHeight)
     
    void
    save(String fileName)
     
    void
    setAlpha(float fAlpha)
     
    void
    setBoundary(float fAlpha)
    Sets the contribution of the 2nd derivative on the volume rendering for this widget.
    void
    setColor(WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
    Sets the color of the color transfer function for this widget.
    void
    Sets the parent container panel:
    void
    setPicked(int value)
    Sets the current picked ID.
    void
    setWidget(String kWidgetType)
    Sets the widget type for new widgets.
    void
    Sets the list of Widgets.
    void
    update(String kCommand)
     
    private void
    Updates the scene graph after a new list of widgets is added.

    Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.VolumeImageViewer

    computeElapsedTime, displayChanged, GetCanvas, main, SetAnimator, SetFrame, setStartTime, UpdateSlice, writeImage

    Methods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D

    DrawFrameRate, getCameraLocation, getCameraParameters, getObjectParameters, getObjectRotation, InitializeCameraMotion, InitializeCameraMotion, InitializeObjectMotion, keyReleased, keyTyped, LookDown, LookUp, MeasureTime, mouseClicked, mouseEntered, mouseExited, mouseWheelMoved, MoveBackward, MoveCamera, MoveDown, MoveForward, MoveLeft, MoveObject, MoveRight, MoveUp, OnDisplay, OnInitialize, OnTerminate, ResetTime, RotateTrackBall, setCameraLocation, setCameraParameters, setObjectParameters, setObjectRotation, TurnLeft, TurnRight, UpdateCameraRotationSpeed, UpdateCameraTranslationSpeed, UpdateCameraZoomSpeed, UpdateFrameCount, UpdateMouseRotationSpeed

    Methods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication

    GetAspectRatio, GetHeight, GetRenderer, GetWidth, GetWindowTitle, GetXPosition, GetYPosition, OnIdle, OnMove, OnPrecreate, OnResize, SetRenderer

    Methods inherited from class WildMagic.LibApplications.OpenGLApplication.Application

    reloadShaders, TestStreaming

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.awt.event.KeyListener

    keyReleased, keyTyped
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • MAX_WIDGETS

      public int MAX_WIDGETS
      The maximum number of widgets that can be added to the display. More can be added, but then the Volume Renderer GLSL program should be changed to add the new widgets.
    • container

      private JPanel container
      main container for this object:
    • m_iMouseButton

      private int m_iMouseButton
      Stores which button was pressed during mouse drag.
    • m_iMouseX

      private int m_iMouseX
      Stores the mouse position for picking.
    • m_iMouseY

      private int m_iMouseY
      Stores the mouse position for picking.
    • m_kTMin

      private WildMagic.LibFoundation.Mathematics.Vector2f m_kTMin
      The bounds on the 2D Histogram texture coordinates used to display the 2D Histogram. The texture coordinates are clamped to show only the portions of the texture that are above a threshold value.
    • m_kTMax

      private WildMagic.LibFoundation.Mathematics.Vector2f m_kTMax
    • m_akWidgets

      private Vector<ClassificationWidget> m_akWidgets
      The list of widgets displayed on the 2D Histogram.
    • m_iCurrent

      private int m_iCurrent
      The ID of the active and previously active widget.
    • m_iPrevious

      private int m_iPrevious
      The ID of the active and previously active widget.
    • m_iPicked

      private int m_iPicked
      The ID of the
    • m_bPickPending

      private boolean m_bPickPending
      When true there is a pending mouse pick to process.
    • m_kCurrentColor

      private WildMagic.LibFoundation.Mathematics.ColorRGBA m_kCurrentColor
      The current color to use to create a new Widget.
    • m_bAdded

      private boolean m_bAdded
      When true a new Widget was added with the mouse.
    • m_kInterface

      private JInterfaceBase m_kInterface
      Reference to the containing JPanel.
    • m_kWidgetType

      private String m_kWidgetType
      Defines the current selected widget type.
    • m_bFirstAdded

      private boolean m_bFirstAdded
    • m_bUpdateLev

      private boolean m_bUpdateLev
    • m_iLUTIndex

      private int m_iLUTIndex
  • Constructor Details

    • VolumeImageMultiDimensionalTransfer

      public VolumeImageMultiDimensionalTransfer(com.jogamp.opengl.util.Animator animator, com.jogamp.opengl.awt.GLCanvas canvas, double dpiScale, VolumeTriPlanarInterface kParentFrame, VolumeImage kVolumeImage)
      Create a new VolumeImageMultiDimensionalTranfer display.
      Parameters:
      canvas - The canvas to use for the display. The canvas shares a context with the VolumeTriPlanarRenderer.
      kParentFrame - parent frame.
      kVolumeImage - the VolumeImage with the associated 2D Histogram.
  • Method Details

    • main

      public static VolumeImageMultiDimensionalTransfer main(com.jogamp.opengl.awt.GLCanvas kCanvas, double dpiScale, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, boolean displayInSeparateFrame)
      Iridescence.main creates the Iridescence object and window frame to contain the GLCanvas. An Animator object is created with the GLCanvas as an argument. The Animator provides the same function as the glutMainLoop() function call commonly used in OpenGL applications.
    • clearAllWidgets

      public void clearAllWidgets()
    • display

      public void display()
      Set the display to true and call GLCanvas.display;
    • display

      public void display(com.jogamp.opengl.GLAutoDrawable arg0)
      Specified by:
      display in interface com.jogamp.opengl.GLEventListener
      Overrides:
      display in class VolumeImageViewer
    • dispose

      public void dispose()
      Overrides:
      dispose in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • dispose

      public void dispose(com.jogamp.opengl.GLAutoDrawable arg0)
      Specified by:
      dispose in interface com.jogamp.opengl.GLEventListener
      Overrides:
      dispose in class VolumeImageViewer
    • getContainingPanel

      public JPanel getContainingPanel()
      Returns the container for this object. The container has a scroll pane and slider for the depth.
      Returns:
    • getM_akLev

      public Vector<ClassificationWidget> getM_akLev()
    • getPicked

      public int getPicked()
      Returns the ID of the currently picked Widget.
      Returns:
      the ID of the currently picked Widget.
    • getWidgets

      public Vector<ClassificationWidget> getWidgets()
      Returns the current Widgets.
      Returns:
      the current Widgets.
    • init

      public void init(com.jogamp.opengl.GLAutoDrawable arg0)
      Specified by:
      init in interface com.jogamp.opengl.GLEventListener
      Overrides:
      init in class VolumeImageViewer
    • keyPressed

      public void keyPressed(KeyEvent kKey)
      keyPressed callback.
      Specified by:
      keyPressed in interface KeyListener
      Overrides:
      keyPressed in class VolumeImageViewer
      Parameters:
      kKey - the KeyEvent triggering the callback.
    • load

      public void load(String fileName)
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • reshape

      public void reshape(com.jogamp.opengl.GLAutoDrawable arg0, int iX, int iY, int iWidth, int iHeight)
      Specified by:
      reshape in interface com.jogamp.opengl.GLEventListener
      Overrides:
      reshape in class VolumeImageViewer
    • save

      public void save(String fileName)
    • setAlpha

      public void setAlpha(float fAlpha)
    • setBoundary

      public void setBoundary(float fAlpha)
      Sets the contribution of the 2nd derivative on the volume rendering for this widget.
      Parameters:
      fAlpha - the contribution of the 2nd derivative on the volume rendering for this widget.
    • setColor

      public void setColor(WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
      Sets the color of the color transfer function for this widget.
      Parameters:
      kColor - the color of the color transfer function for this widget.
    • SetInterface

      public void SetInterface(JInterfaceBase kInterface)
      Sets the parent container panel:
      Parameters:
      kInterface -
    • setPicked

      public void setPicked(int value)
      Sets the current picked ID.
      Parameters:
      value -
    • setWidget

      public void setWidget(String kWidgetType)
      Sets the widget type for new widgets.
      Parameters:
      kWidgetType -
    • setWidgets

      public void setWidgets(Vector<ClassificationWidget> kWidgetList)
      Sets the list of Widgets.
      Parameters:
      kWidgetList -
    • update

      public void update(String kCommand)
    • createContainer

      private void createContainer(com.jogamp.opengl.awt.GLCanvas canvas)
      Creates the containing JPanel that will display this object. The JPanel contains a scroll pane with both horizontal and vertical scroll bars and a horizontal slider for changing where the slice plane intersects the volume in depth.
      Parameters:
      imageComponent -
    • CreatePlaneNode

      protected void CreatePlaneNode()
      Overrides:
      CreatePlaneNode in class VolumeImageViewer
    • CreateScene

      protected void CreateScene()
      Overrides:
      CreateScene in class VolumeImageViewer
    • Pick

      protected void Pick(WildMagic.LibGraphics.Rendering.Renderer kRenderer)
      Determine which widget is selected with the mouse/
    • updateLev

      private void updateLev()
      Updates the scene graph after a new list of widgets is added.