Class SurfacePaint

java.lang.Object
gov.nih.mipav.view.renderer.J3D.surfaceview.SurfacePaint
All Implemented Interfaces:
ActionListener, MouseListener, MouseMotionListener, EventListener

public class SurfacePaint extends Object implements ActionListener, MouseListener, MouseMotionListener
  • Field Details

    • VERTEX

      public static final int VERTEX
      Paint the ModelTriangleMesh vertex color:
      See Also:
    • TEXTURE

      public static final int TEXTURE
      Paint into the 3D texture map:
      See Also:
    • m_PaintMode

      private int m_PaintMode
      Curent paint mode.
    • m_bEnabled

      private boolean m_bEnabled
      Enables painting
    • m_kPickCanvas

      private com.sun.j3d.utils.picking.PickCanvas m_kPickCanvas
      PickCanvas, for triangle picking.
    • mPickShape

      private javax.media.j3d.PickShape mPickShape
      PickShape, for picking
    • kPickDirection

      private javax.vecmath.Vector3d kPickDirection
      PickDirection, the direction of the PickShape.
    • m_kPanel

      private JPanelSurface m_kPanel
      Reference to the JPanelSurface:
    • mPaintToolBar

      private JToolBar mPaintToolBar
      Paint user-interface ToolBar
    • mButtonGroup

      private ButtonGroup mButtonGroup
      Button group for paint functions:
    • mPaintBrushButton

      private JToggleButton mPaintBrushButton
      Paint brush button
    • mDropperButton

      private JToggleButton mDropperButton
      Paint dropper button
    • mPaintCanButton

      private JToggleButton mPaintCanButton
      Paint can button
    • mEraserButton

      private JToggleButton mEraserButton
      Eraser paint button
    • mEraseAllButton

      private JButton mEraseAllButton
      Erase all button
    • mBrushSizeText

      private JTextField mBrushSizeText
      Paint brush size text field
    • mBrushSize

      private int mBrushSize
      current paint brush size
    • mColorPaintButton

      private JButton mColorPaintButton
      Color selection button
    • mPaintColor

      private javax.vecmath.Color4f mPaintColor
      Current paint color
    • mOpacityPaintButton

      private JButton mOpacityPaintButton
      Opacity paint button
    • mOpacity

      private float mOpacity
      Current paint opacity
    • mColorChooser

      private JColorChooser mColorChooser
      Color Chooser dialog.
    • mPaintGrowDialog

      private JDialogPaintGrow mPaintGrowDialog
      Paint Grow Dialog.
    • mMouseRotate

      private javax.media.j3d.TransformGroup mMouseRotate
      Rotation transform for transforming the triangle normal into world coordinates.
  • Constructor Details

  • Method Details

    • init

      private void init()
    • setEnabled

      public void setEnabled(boolean flag)
      Enables/disables the user-interface
      Parameters:
      flag - when true the user-interface is enabled, when false the user-interface is disabled.
    • enableSurfacePaintCan

      public void enableSurfacePaintCan(boolean flag)
      Enables/disables the Paint Can user-interface
      Parameters:
      flag - when true Paint Can is enabled, when false the Paint Can is disabled.
    • enableSurfacePaint

      public void enableSurfacePaint(boolean flag)
      Enables/disables the Surface per-vertex paint user-interface
      Parameters:
      flag - when true per-vertex paint is enabled, when false the per-vertex paint is disabled is disabled.
    • getEnabled

      public boolean getEnabled()
      Returns true if the user has enabled the paint brush.
      Returns:
      the enabled/disbled status of the paint brush.
    • getPaintImage

      public ModelImage getPaintImage()
      Returns the ModelImage to paint into.
      Returns:
      paint/texture ModelImage
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      actionPerformed, listens for interface events.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - ActionEvent generated by the interface.
    • getToolBar

      public JToolBar getToolBar()
    • setPaintMode

      public void setPaintMode(int mode)
      Sets the type of paint, either vertex-color or texture value:
      Parameters:
      mode - SurfacePaint.TEXTURE or SurfacePaint.VERTEX
    • dispose

      public void dispose()
      Deletes all member variables, clean memory.
    • mouseClicked

      public void mouseClicked(MouseEvent kMouseEvent)
      One of the overrides necessary to be a MouseListener. This function is invoked when a button has been pressed and released.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      kMouseEvent - the mouse event generated by a mouse clicked
    • mouseDragged

      public void mouseDragged(MouseEvent kMouseEvent)
      mouseDragged.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      kMouseEvent - MouseEvent
    • mouseEntered

      public void mouseEntered(MouseEvent kMouseEvent)
      One of the overrides necessary to be a MouseListener. Invoked when the mouse enters a component.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      kMouseEvent - the mouse event generated by a mouse entered
    • mouseExited

      public void mouseExited(MouseEvent kMouseEvent)
      One of the overrides necessary to be a MouseListener. Invoked when the mouse leaves a component.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      kMouseEvent - the mouse event generated by a mouse exit
    • mouseMoved

      public void mouseMoved(MouseEvent kMouseEvent)
      Invoked when the mouse moves.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      kMouseEvent - MouseEvent
    • mousePressed

      public void mousePressed(MouseEvent kMouseEvent)
      One of the overrides necessary to be a MouseListener. Invoked when a mouse button is pressed.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      kMouseEvent - the mouse event generated by a mouse press
    • mouseReleased

      public void mouseReleased(MouseEvent kMouseEvent)
      One of the overrides necessary to be a MouseListener. Invoked when a mouse button is released.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      kMouseEvent - the mouse event generated by a mouse release
    • getPickResult

      private com.sun.j3d.utils.picking.PickResult getPickResult(MouseEvent kMouseEvent)
      Returns the pick result based on the input mouse event.
      Parameters:
      kMouseEvent - the current mouse position.
      Returns:
      kPickResult, the picked object.
    • setPickCanvas

      public void setPickCanvas(com.sun.j3d.utils.picking.PickCanvas kPickCanvas)
      Access function to set the pickCanvas.
      Parameters:
      kPickCanvas - PickCanvas
    • setOpacity

      public void setOpacity(float opacity)
      Sets the opacity of the paint.
      Parameters:
      opacity - paint opacity.
    • getModelColor

      private void getModelColor(javax.vecmath.Point3f kPickPoint)
      Display the ModelImage color in the JDialogPaintGrow interface.
      Parameters:
      kPickPoint - the model triangle mesh point under the mouse.
    • regionGrow

      public void regionGrow(ModelImage kImage, javax.vecmath.Point3f kSeedPoint)
      Grows a region based on a starting point supplied. A voxel is added to the the paintMask mask if its intensity is between the the bounds which are also supplied.
      Parameters:
      kImage - the image to grow the region in
      kSeedPoint - the starting point in the image