Class SurfacePaint
- java.lang.Object
-
- gov.nih.mipav.view.renderer.J3D.surfaceview.SurfacePaint
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.util.EventListener
public class SurfacePaint extends java.lang.Object implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
-
-
Field Summary
Fields Modifier and Type Field Description private javax.vecmath.Vector3d
kPickDirection
PickDirection, the direction of the PickShape.private boolean
m_bEnabled
Enables paintingprivate JPanelSurface
m_kPanel
Reference to the JPanelSurface:private com.sun.j3d.utils.picking.PickCanvas
m_kPickCanvas
PickCanvas, for triangle picking.private int
m_PaintMode
Curent paint mode.private int
mBrushSize
current paint brush sizeprivate javax.swing.JTextField
mBrushSizeText
Paint brush size text fieldprivate javax.swing.ButtonGroup
mButtonGroup
Button group for paint functions:private javax.swing.JColorChooser
mColorChooser
Color Chooser dialog.private javax.swing.JButton
mColorPaintButton
Color selection buttonprivate javax.swing.JToggleButton
mDropperButton
Paint dropper buttonprivate javax.swing.JButton
mEraseAllButton
Erase all buttonprivate javax.swing.JToggleButton
mEraserButton
Eraser paint buttonprivate javax.media.j3d.TransformGroup
mMouseRotate
Rotation transform for transforming the triangle normal into world coordinates.private float
mOpacity
Current paint opacityprivate javax.swing.JButton
mOpacityPaintButton
Opacity paint buttonprivate javax.swing.JToggleButton
mPaintBrushButton
Paint brush buttonprivate javax.swing.JToggleButton
mPaintCanButton
Paint can buttonprivate javax.vecmath.Color4f
mPaintColor
Current paint colorprivate JDialogPaintGrow
mPaintGrowDialog
Paint Grow Dialog.private javax.swing.JToolBar
mPaintToolBar
Paint user-interface ToolBarprivate javax.media.j3d.PickShape
mPickShape
PickShape, for pickingstatic int
TEXTURE
Paint into the 3D texture map:static int
VERTEX
Paint the ModelTriangleMesh vertex color:
-
Constructor Summary
Constructors Constructor Description SurfacePaint(JPanelSurface parent, SurfaceRender parentScene)
Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
actionPerformed, listens for interface events.void
dispose()
Deletes all member variables, clean memory.void
enableSurfacePaint(boolean flag)
Enables/disables the Surface per-vertex paint user-interfacevoid
enableSurfacePaintCan(boolean flag)
Enables/disables the Paint Can user-interfaceboolean
getEnabled()
Returns true if the user has enabled the paint brush.private void
getModelColor(javax.vecmath.Point3f kPickPoint)
Display the ModelImage color in the JDialogPaintGrow interface.ModelImage
getPaintImage()
Returns the ModelImage to paint into.private com.sun.j3d.utils.picking.PickResult
getPickResult(java.awt.event.MouseEvent kMouseEvent)
Returns the pick result based on the input mouse event.javax.swing.JToolBar
getToolBar()
private void
init()
void
mouseClicked(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener.void
mouseDragged(java.awt.event.MouseEvent kMouseEvent)
mouseDragged.void
mouseEntered(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener.void
mouseExited(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener.void
mouseMoved(java.awt.event.MouseEvent kMouseEvent)
Invoked when the mouse moves.void
mousePressed(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener.void
mouseReleased(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener.void
regionGrow(ModelImage kImage, javax.vecmath.Point3f kSeedPoint)
Grows a region based on a starting point supplied.void
setEnabled(boolean flag)
Enables/disables the user-interfacevoid
setOpacity(float opacity)
Sets the opacity of the paint.void
setPaintMode(int mode)
Sets the type of paint, either vertex-color or texture value:void
setPickCanvas(com.sun.j3d.utils.picking.PickCanvas kPickCanvas)
Access function to set the pickCanvas.
-
-
-
Field Detail
-
VERTEX
public static final int VERTEX
Paint the ModelTriangleMesh vertex color:- See Also:
- Constant Field Values
-
TEXTURE
public static final int TEXTURE
Paint into the 3D texture map:- See Also:
- Constant Field Values
-
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 javax.swing.JToolBar mPaintToolBar
Paint user-interface ToolBar
-
mButtonGroup
private javax.swing.ButtonGroup mButtonGroup
Button group for paint functions:
-
mPaintBrushButton
private javax.swing.JToggleButton mPaintBrushButton
Paint brush button
-
mDropperButton
private javax.swing.JToggleButton mDropperButton
Paint dropper button
-
mPaintCanButton
private javax.swing.JToggleButton mPaintCanButton
Paint can button
-
mEraserButton
private javax.swing.JToggleButton mEraserButton
Eraser paint button
-
mEraseAllButton
private javax.swing.JButton mEraseAllButton
Erase all button
-
mBrushSizeText
private javax.swing.JTextField mBrushSizeText
Paint brush size text field
-
mBrushSize
private int mBrushSize
current paint brush size
-
mColorPaintButton
private javax.swing.JButton mColorPaintButton
Color selection button
-
mPaintColor
private javax.vecmath.Color4f mPaintColor
Current paint color
-
mOpacityPaintButton
private javax.swing.JButton mOpacityPaintButton
Opacity paint button
-
mOpacity
private float mOpacity
Current paint opacity
-
mColorChooser
private javax.swing.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 Detail
-
SurfacePaint
public SurfacePaint(JPanelSurface parent, SurfaceRender parentScene)
Default Constructor
-
-
Method Detail
-
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(java.awt.event.ActionEvent event)
actionPerformed, listens for interface events.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
event
- ActionEvent generated by the interface.
-
getToolBar
public javax.swing.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(java.awt.event.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 interfacejava.awt.event.MouseListener
- Parameters:
kMouseEvent
- the mouse event generated by a mouse clicked
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent kMouseEvent)
mouseDragged.- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Parameters:
kMouseEvent
- MouseEvent
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener. Invoked when the mouse enters a component.- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
- Parameters:
kMouseEvent
- the mouse event generated by a mouse entered
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener. Invoked when the mouse leaves a component.- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
- Parameters:
kMouseEvent
- the mouse event generated by a mouse exit
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent kMouseEvent)
Invoked when the mouse moves.- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Parameters:
kMouseEvent
- MouseEvent
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener. Invoked when a mouse button is pressed.- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
- Parameters:
kMouseEvent
- the mouse event generated by a mouse press
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent kMouseEvent)
One of the overrides necessary to be a MouseListener. Invoked when a mouse button is released.- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
- Parameters:
kMouseEvent
- the mouse event generated by a mouse release
-
getPickResult
private com.sun.j3d.utils.picking.PickResult getPickResult(java.awt.event.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 inkSeedPoint
- the starting point in the image
-
-