Package gov.nih.mipav.view.renderer.J3D
Class RenderViewBase
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Canvas
-
- javax.media.j3d.Canvas3D
-
- gov.nih.mipav.view.renderer.J3D.VolumeCanvas3D
-
- gov.nih.mipav.view.renderer.J3D.RenderViewBase
-
- All Implemented Interfaces:
com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback,ViewImageUpdateInterface,java.awt.event.ActionListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,javax.swing.event.ChangeListener
- Direct Known Subclasses:
MjCorticalAnalysis,SurfacePlotter,SurfaceRender,VolumeRenderer
public abstract class RenderViewBase extends VolumeCanvas3D implements ViewImageUpdateInterface, java.awt.event.ActionListener, com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, javax.swing.event.ChangeListener
This is an abstract class. This class defines the basic functionality of the renders, such as the LUT and bounding box and image rotation, etc. It was extended by the surface render, surface plotter and the volume render.- Version:
- 0.1 Oct 1, 1998
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRenderViewBase.MatrixThis matrix class is used for 3D object rotate along a specifid axis.
-
Field Summary
Fields Modifier and Type Field Description private static javax.vecmath.Vector3f[]akNormalnormal vector arrayes.protected javax.media.j3d.BackgroundbackgroundThe background node for the canvas.javax.media.j3d.BoundingSphereboundsA BoundingSphere that contains the entire scene.protected ViewJComponentBoxFrameboxFrameThe outside box frame.protected VolumeCanvas3DcanvasThe Canvas3D object on which the surfaces are drawn and where the picking happens.protected ViewJFrameRenderCameracaptureFrameCamera snapshot frame.protected ModelImagecaptureImageThe resulting ModelImage of the camera snapshot.protected java.awt.GraphicsConfigurationconfigThe config used to extends the Canvas3D class.protected intdisplayModeIndicates which image is to be acted upon when two images are displayed.static intIMAGE_ADisplay mode image A.static intIMAGE_BDisplay mode image B.protected ModelImageimageAReference to the image A of this frame.protected ModelImageimageBReference to the image Bof this frame.protected ModelLUTLUTaReference to LUT for image A.protected ModelLUTLUTbReference to LUT for image B.private static intm_iNumVoxelsImage volume size and x, y, z extents.private static intm_iSizeXImage volume size and x, y, z extents.private static intm_iSizeYImage volume size and x, y, z extents.private static intm_iSizeZImage volume size and x, y, z extents.private static javax.vecmath.Vector3fm_kZeroVectorSet the zero vector.protected javax.media.j3d.BranchGroupobjBehaviorBGThe BranchGroup to which the standard behaviors are attached, zoom and rotate.protected javax.media.j3d.BranchGroupobjBoxFrameBGParent of the whole box frame.protected javax.media.j3d.BranchGroupobjRootBGThe BranchGroup root of the scene managed by the simple universe.protected introtationAngleRotation angle when the camera takes snapshot.protected introtationAxisRotation axis when the camera takes snapshot.protected JPanelCamerarotationControlPanelCamera control dialog box.protected introtationTimesNumber of rotation during the camera auto snapshotting.protected introtationTotalThe total rotation degree, fixing one bug.protected javax.media.j3d.TransformGroupsceneRootTGA TransformGroup object to which all the scene objects are attached, including 3D images, surface, behavior, and lights.private static longserialVersionUIDUse serialVersionUID for interoperability.protected MouseEventVectorsliderEventsSlider events used by the mouse recorder.protected javax.media.j3d.Transform3DtransRotationtransform rotation of the volume image during camera snapshot.protected javax.media.j3d.Transform3DtransRotationMatrixRotation matrix.protected javax.media.j3d.BranchGrouptriPlanarViewBGTriplanar view branch group, which hold the three plane view and the slice box frame view.protected com.sun.j3d.utils.universe.SimpleUniverseuniverseThe SimpleUniverse object which is the parent of everything else in the scene.protected JPanelViewviewPanelView dialog associated with surface plotter or renderer.-
Fields inherited from class gov.nih.mipav.view.renderer.J3D.VolumeCanvas3D
m_dAccumulatedTime, m_dFrameRate, m_dLastTime, m_iAccumulatedFrameCount, m_iFrameCount, m_iMaxTimer, m_iTimer
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description RenderViewBase(ModelImage _imageA, ModelImage _imageB, java.awt.GraphicsConfiguration _config)Calls the constructor for ViewJFrameBase with the same parameters.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidautoCapture()Calculate the rotation matrix when the auto camera caputuring the images.javax.vecmath.Vector3f[]calcImageNormals()Create array of normal vectors corresponding to the voxels in the volume.protected voidcreateBoxFrame(float xBox, float yBox, float zBox)Creates a new box frame with the given dimensions.voiddisableCamera()Set the captureFrame to null.voiddisposeLocal()Clean memory.javax.media.j3d.BranchGroupgetBehaviorGroup()Accessor for the branch group that holds the mouse behavior.javax.media.j3d.BoundingSpheregetBound()Accessor for the bounds sphere.javax.media.j3d.BranchGroupgetBranchGroup()Accessor for the branch group of this 3D object, the parent of the transform group.javax.media.j3d.Canvas3DgetCanvas()Accessor for the canvas for this 3D object.ModelImagegetImageA()Accessor that returns the reference to image A.ModelImagegetImageB()Accessor that returns the reference to image B.static javax.vecmath.Vector3f[]getNormals()Get the normal vector arrays.ModelRGBgetRGBTA()Get the RGB table of imageA.ModelRGBgetRGBTB()Get the RGB table of imageB.javax.media.j3d.TransformGroupgetSceneRootTG()Accessor for the transform group of the scene, which is the parent of everything displayed.abstract java.lang.ObjectgetSceneState()Gets the scene state in terms of slices visible, which slice number, etc.MouseEventVectorgetSliderEvents()javax.media.j3d.BranchGroupgetTriPlanarViewBG()Return the triplanar view branch group.com.sun.j3d.utils.universe.SimpleUniversegetUniverse()Accessor for the universe for this 3D object.voidrecordMouse(java.lang.String name, JPanelMouse myMouseDialog, int mouseMode)Unchanged.voidresetAxisX()Reset the image volume to the original position.voidresetAxisY()Reset the image volume to the original position.voidresetImage()Reset the image volume to the original position.voidrotateImage()Rotates the image volume when the camera manually takes snapshot.abstract voidsetAlphaBlend(int value)Sets the alpha blending of parameter for two image displaying.voidsetBackgroundColor(java.awt.Color color)Sets the color of the background.voidsetBoxColor(java.awt.Color color)Sets the color of the box frame.abstract voidsetGUI(java.lang.Object scene)Used by the JPanelMouse the redisplay the recorded actions.abstract voidsetRGBTA(ModelRGB RGBT)Set the RGB table of imageA.abstract voidsetRGBTB(ModelRGB RGBT)Get the RGB table of imageB.voidsetRotationAngle(int value)Set the rotation angle with the camera takes snapshot.voidsetRotationAxis(int axis)Set the roation axis ( X, Y, Z Axis ) when the camera takes snapshot.booleanwriteImage()Write the image from the rendering frame into the camera capture frame.voidwriteImageAuto()Called when the camera button is clicked.-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.VolumeCanvas3D
GetTestFrameRate, MeasureTime, paint, postSwap, ResetTime, SetTestFrameRate, supportsTexture3D, update, UpdateFrameCount
-
Methods inherited from class javax.media.j3d.Canvas3D
addNotify, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphics2D, getGraphicsContext3D, getImagePlateToVworld, getInverseVworldProjection, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getLocationOnScreen, getMonoscopicViewPolicy, getOffScreenBuffer, getOffScreenLocation, getOffScreenLocation, getPhysicalHeight, getPhysicalWidth, getPixelLocationFromImagePlate, getPixelLocationInImagePlate, getPixelLocationInImagePlate, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getStereoAvailable, getStereoEnable, getView, getVworldProjection, getVworldToImagePlate, 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, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
transformChanged
-
Methods inherited from interface gov.nih.mipav.view.ViewImageUpdateInterface
setSlice, setTimeSlice, updateImageExtents, updateImages, updateImages, updateImages
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
IMAGE_A
public static final int IMAGE_A
Display mode image A.- See Also:
- Constant Field Values
-
IMAGE_B
public static final int IMAGE_B
Display mode image B.- See Also:
- Constant Field Values
-
m_kZeroVector
private static final javax.vecmath.Vector3f m_kZeroVector
Set the zero vector.
-
m_iNumVoxels
private static int m_iNumVoxels
Image volume size and x, y, z extents.
-
m_iSizeX
private static int m_iSizeX
Image volume size and x, y, z extents.
-
m_iSizeY
private static int m_iSizeY
Image volume size and x, y, z extents.
-
m_iSizeZ
private static int m_iSizeZ
Image volume size and x, y, z extents.
-
akNormal
private static javax.vecmath.Vector3f[] akNormal
normal vector arrayes.
-
bounds
public javax.media.j3d.BoundingSphere bounds
A BoundingSphere that contains the entire scene. This bound is used for all scheduling, including lighting and mouse behaviors.
-
background
protected javax.media.j3d.Background background
The background node for the canvas.
-
boxFrame
protected ViewJComponentBoxFrame boxFrame
The outside box frame.
-
canvas
protected VolumeCanvas3D canvas
The Canvas3D object on which the surfaces are drawn and where the picking happens.
-
captureFrame
protected ViewJFrameRenderCamera captureFrame
Camera snapshot frame.
-
captureImage
protected ModelImage captureImage
The resulting ModelImage of the camera snapshot.
-
config
protected java.awt.GraphicsConfiguration config
The config used to extends the Canvas3D class.
-
displayMode
protected int displayMode
Indicates which image is to be acted upon when two images are displayed.
-
imageA
protected ModelImage imageA
Reference to the image A of this frame.
-
imageB
protected ModelImage imageB
Reference to the image Bof this frame.
-
LUTa
protected ModelLUT LUTa
Reference to LUT for image A.
-
LUTb
protected ModelLUT LUTb
Reference to LUT for image B.
-
objBehaviorBG
protected javax.media.j3d.BranchGroup objBehaviorBG
The BranchGroup to which the standard behaviors are attached, zoom and rotate.
-
objBoxFrameBG
protected javax.media.j3d.BranchGroup objBoxFrameBG
Parent of the whole box frame.
-
objRootBG
protected javax.media.j3d.BranchGroup objRootBG
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 scene objects.
-
rotationAngle
protected int rotationAngle
Rotation angle when the camera takes snapshot.
-
rotationAxis
protected int rotationAxis
Rotation axis when the camera takes snapshot.
-
rotationControlPanel
protected JPanelCamera rotationControlPanel
Camera control dialog box.
-
rotationTimes
protected int rotationTimes
Number of rotation during the camera auto snapshotting.
-
rotationTotal
protected int rotationTotal
The total rotation degree, fixing one bug.
-
sceneRootTG
protected javax.media.j3d.TransformGroup sceneRootTG
A TransformGroup object to which all the scene objects are attached, including 3D images, surface, behavior, and lights.
-
transRotation
protected javax.media.j3d.Transform3D transRotation
transform rotation of the volume image during camera snapshot.
-
transRotationMatrix
protected javax.media.j3d.Transform3D transRotationMatrix
Rotation matrix.
-
triPlanarViewBG
protected javax.media.j3d.BranchGroup triPlanarViewBG
Triplanar view branch group, which hold the three plane view and the slice box frame view.
-
universe
protected com.sun.j3d.utils.universe.SimpleUniverse universe
The SimpleUniverse object which is the parent of everything else in the scene.
-
viewPanel
protected JPanelView viewPanel
View dialog associated with surface plotter or renderer.
-
sliderEvents
protected MouseEventVector sliderEvents
Slider events used by the mouse recorder.
-
-
Constructor Detail
-
RenderViewBase
public RenderViewBase(ModelImage _imageA, ModelImage _imageB, java.awt.GraphicsConfiguration _config)
Calls the constructor for ViewJFrameBase with the same parameters.- Parameters:
_imageA- The current image A._imageB- The current image B, ornullif there isn't one._config- The graphics config to use when rendering
-
-
Method Detail
-
getSceneState
public abstract java.lang.Object getSceneState()
Gets the scene state in terms of slices visible, which slice number, etc.- Returns:
- A private object extension specific to the class that extends this one.
-
setAlphaBlend
public abstract void setAlphaBlend(int value)
Sets the alpha blending of parameter for two image displaying.- Parameters:
value- amount [0,100] that is the percentage of Image A to be displayed and (1-percentage) of Image B to be displayed
-
setGUI
public abstract void setGUI(java.lang.Object scene)
Used by the JPanelMouse the redisplay the recorded actions.- Parameters:
scene- Object
-
setRGBTA
public abstract void setRGBTA(ModelRGB RGBT)
Set the RGB table of imageA. Method will be extended in renders.- Parameters:
RGBT- the rgb table to use for image A
-
setRGBTB
public abstract void setRGBTB(ModelRGB RGBT)
Get the RGB table of imageB. Method will be extended in renders.- Parameters:
RGBT- the rgb table to use for image B
-
getNormals
public static final javax.vecmath.Vector3f[] getNormals()
Get the normal vector arrays.- Returns:
- Vector3f[] normal vector array.
-
autoCapture
public void autoCapture()
Calculate the rotation matrix when the auto camera caputuring the images.
-
calcImageNormals
public javax.vecmath.Vector3f[] calcImageNormals()
Create array of normal vectors corresponding to the voxels in the volume. The normal vector is computed based on the gradient of the volume intensity values.- Returns:
- DOCUMENT ME!
-
disableCamera
public void disableCamera()
Set the captureFrame to null.
-
disposeLocal
public void disposeLocal()
Clean memory.
-
getBehaviorGroup
public javax.media.j3d.BranchGroup getBehaviorGroup()
Accessor for the branch group that holds the mouse behavior.- Returns:
- The mouse behavior's branch group.
-
getBound
public javax.media.j3d.BoundingSphere getBound()
Accessor for the bounds sphere.- Returns:
- bounding sphere
-
getBranchGroup
public javax.media.j3d.BranchGroup getBranchGroup()
Accessor for the branch group of this 3D object, the parent of the transform group.- Returns:
- The branch group parent of the scene.
-
getCanvas
public javax.media.j3d.Canvas3D getCanvas()
Accessor for the canvas for this 3D object.- Returns:
- The canvas for the scene.
-
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.
-
getRGBTA
public ModelRGB getRGBTA()
Get the RGB table of imageA. Method will be extended in renders.- Returns:
- rgb table for image A
-
getRGBTB
public ModelRGB getRGBTB()
Get the RGB table of imageB. Method will be extended in renders.- Returns:
- rgb table for image B
-
getSceneRootTG
public javax.media.j3d.TransformGroup getSceneRootTG()
Accessor for the transform group of the scene, which is the parent of everything displayed.- Returns:
- The transform group of the scene.
-
getTriPlanarViewBG
public javax.media.j3d.BranchGroup getTriPlanarViewBG()
Return the triplanar view branch group.- Returns:
- triPlanarViewBG the triplanar view branch group
-
getUniverse
public com.sun.j3d.utils.universe.SimpleUniverse getUniverse()
Accessor for the universe for this 3D object.- Returns:
- The universe for the scene.
-
resetAxisX
public void resetAxisX()
Reset the image volume to the original position.
-
resetAxisY
public void resetAxisY()
Reset the image volume to the original position.
-
resetImage
public void resetImage()
Reset the image volume to the original position.
-
rotateImage
public void rotateImage()
Rotates the image volume when the camera manually takes snapshot.
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color color)
Sets the color of the background.- Parameters:
color- Color to set to.
-
setBoxColor
public void setBoxColor(java.awt.Color color)
Sets the color of the box frame.- Parameters:
color- Color to set to.
-
setRotationAngle
public void setRotationAngle(int value)
Set the rotation angle with the camera takes snapshot.- Parameters:
value- angle value
-
setRotationAxis
public void setRotationAxis(int axis)
Set the roation axis ( X, Y, Z Axis ) when the camera takes snapshot.- Parameters:
axis- X_AXIS, Y_AXIS or Z_AXIS.
-
writeImage
public boolean writeImage()
Write the image from the rendering frame into the camera capture frame.- Returns:
- succeed
truemeans succeed,falsemeans unsucceed.
-
writeImageAuto
public void writeImageAuto()
Called when the camera button is clicked. This method brings up the camera control dialog.
-
createBoxFrame
protected void createBoxFrame(float xBox, float yBox, float zBox)Creates a new box frame with the given dimensions.- Parameters:
xBox- X dimension of box frame.yBox- Y dimension of box frame.zBox- Z dimension of box frame.
-
getSliderEvents
public MouseEventVector getSliderEvents()
-
recordMouse
public void recordMouse(java.lang.String name, JPanelMouse myMouseDialog, int mouseMode)Unchanged.- Parameters:
event- Original mouse event.
-
-