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,ActionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener
- Direct Known Subclasses:
MjCorticalAnalysis,SurfacePlotter,SurfaceRender,VolumeRenderer
public abstract class RenderViewBase
extends VolumeCanvas3D
implements ViewImageUpdateInterface, ActionListener, com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis matrix class is used for 3D object rotate along a specifid axis.Nested classes/interfaces inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvasNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static javax.vecmath.Vector3f[]normal vector arrayes.protected javax.media.j3d.BackgroundThe background node for the canvas.javax.media.j3d.BoundingSphereA BoundingSphere that contains the entire scene.protected ViewJComponentBoxFrameThe outside box frame.protected VolumeCanvas3DThe Canvas3D object on which the surfaces are drawn and where the picking happens.protected ViewJFrameRenderCameraCamera snapshot frame.protected ModelImageThe resulting ModelImage of the camera snapshot.protected GraphicsConfigurationThe config used to extends the Canvas3D class.protected intIndicates which image is to be acted upon when two images are displayed.static final intDisplay mode image A.static final intDisplay mode image B.protected ModelImageReference to the image A of this frame.protected ModelImageReference to the image Bof this frame.protected ModelLUTReference to LUT for image A.protected ModelLUTReference to LUT for image B.private static intImage volume size and x, y, z extents.private static intImage volume size and x, y, z extents.private static intImage volume size and x, y, z extents.private static intImage volume size and x, y, z extents.private static final javax.vecmath.Vector3fSet the zero vector.protected javax.media.j3d.BranchGroupThe BranchGroup to which the standard behaviors are attached, zoom and rotate.protected javax.media.j3d.BranchGroupParent of the whole box frame.protected javax.media.j3d.BranchGroupThe BranchGroup root of the scene managed by the simple universe.protected intRotation angle when the camera takes snapshot.protected intRotation axis when the camera takes snapshot.protected JPanelCameraCamera control dialog box.protected intNumber of rotation during the camera auto snapshotting.protected intThe total rotation degree, fixing one bug.protected javax.media.j3d.TransformGroupA TransformGroup object to which all the scene objects are attached, including 3D images, surface, behavior, and lights.private static final longUse serialVersionUID for interoperability.protected MouseEventVectorSlider events used by the mouse recorder.protected javax.media.j3d.Transform3Dtransform rotation of the volume image during camera snapshot.protected javax.media.j3d.Transform3DRotation matrix.protected javax.media.j3d.BranchGroupTriplanar view branch group, which hold the three plane view and the slice box frame view.protected com.sun.j3d.utils.universe.SimpleUniverseThe SimpleUniverse object which is the parent of everything else in the scene.protected JPanelViewView 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_iTimerFields inherited from class javax.media.j3d.Canvas3D
FIELD_ALL, FIELD_LEFT, FIELD_RIGHTFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
ROTATE, TRANSLATE, ZOOM -
Constructor Summary
ConstructorsConstructorDescriptionRenderViewBase(ModelImage _imageA, ModelImage _imageB, GraphicsConfiguration _config) Calls the constructor for ViewJFrameBase with the same parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalculate the rotation matrix when the auto camera caputuring the images.javax.vecmath.Vector3f[]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.voidSet the captureFrame to null.voidClean memory.javax.media.j3d.BranchGroupAccessor for the branch group that holds the mouse behavior.javax.media.j3d.BoundingSpheregetBound()Accessor for the bounds sphere.javax.media.j3d.BranchGroupAccessor for the branch group of this 3D object, the parent of the transform group.javax.media.j3d.Canvas3DAccessor for the canvas for this 3D object.Accessor that returns the reference to image A.Accessor that returns the reference to image B.static final javax.vecmath.Vector3f[]Get the normal vector arrays.getRGBTA()Get the RGB table of imageA.getRGBTB()Get the RGB table of imageB.javax.media.j3d.TransformGroupAccessor for the transform group of the scene, which is the parent of everything displayed.abstract ObjectGets the scene state in terms of slices visible, which slice number, etc.javax.media.j3d.BranchGroupReturn the triplanar view branch group.com.sun.j3d.utils.universe.SimpleUniverseAccessor for the universe for this 3D object.voidrecordMouse(String name, JPanelMouse myMouseDialog, int mouseMode) Unchanged.voidReset the image volume to the original position.voidReset the image volume to the original position.voidReset the image volume to the original position.voidRotates the image volume when the camera manually takes snapshot.abstract voidsetAlphaBlend(int value) Sets the alpha blending of parameter for two image displaying.voidsetBackgroundColor(Color color) Sets the color of the background.voidsetBoxColor(Color color) Sets the color of the box frame.abstract voidUsed by the JPanelMouse the redisplay the recorded actions.abstract voidSet the RGB table of imageA.abstract voidGet 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.booleanWrite the image from the rendering frame into the camera capture frame.voidCalled 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, UpdateFrameCountMethods 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, waitForOffScreenRenderingMethods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategyMethods 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, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.event.ActionListener
actionPerformedMethods inherited from interface javax.swing.event.ChangeListener
stateChangedMethods inherited from interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
transformChangedMethods inherited from interface gov.nih.mipav.view.ViewImageUpdateInterface
setSlice, setTimeSlice, updateImageExtents, updateImages, updateImages, updateImages
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
IMAGE_A
public static final int IMAGE_ADisplay mode image A.- See Also:
-
IMAGE_B
public static final int IMAGE_BDisplay mode image B.- See Also:
-
m_kZeroVector
private static final javax.vecmath.Vector3f m_kZeroVectorSet the zero vector. -
m_iNumVoxels
private static int m_iNumVoxelsImage volume size and x, y, z extents. -
m_iSizeX
private static int m_iSizeXImage volume size and x, y, z extents. -
m_iSizeY
private static int m_iSizeYImage volume size and x, y, z extents. -
m_iSizeZ
private static int m_iSizeZImage volume size and x, y, z extents. -
akNormal
private static javax.vecmath.Vector3f[] akNormalnormal vector arrayes. -
bounds
public javax.media.j3d.BoundingSphere boundsA BoundingSphere that contains the entire scene. This bound is used for all scheduling, including lighting and mouse behaviors. -
background
protected javax.media.j3d.Background backgroundThe background node for the canvas. -
boxFrame
The outside box frame. -
canvas
The Canvas3D object on which the surfaces are drawn and where the picking happens. -
captureFrame
Camera snapshot frame. -
captureImage
The resulting ModelImage of the camera snapshot. -
config
The config used to extends the Canvas3D class. -
displayMode
protected int displayModeIndicates which image is to be acted upon when two images are displayed. -
imageA
Reference to the image A of this frame. -
imageB
Reference to the image Bof this frame. -
LUTa
Reference to LUT for image A. -
LUTb
Reference to LUT for image B. -
objBehaviorBG
protected javax.media.j3d.BranchGroup objBehaviorBGThe BranchGroup to which the standard behaviors are attached, zoom and rotate. -
objBoxFrameBG
protected javax.media.j3d.BranchGroup objBoxFrameBGParent of the whole box frame. -
objRootBG
protected javax.media.j3d.BranchGroup objRootBGThe 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 rotationAngleRotation angle when the camera takes snapshot. -
rotationAxis
protected int rotationAxisRotation axis when the camera takes snapshot. -
rotationControlPanel
Camera control dialog box. -
rotationTimes
protected int rotationTimesNumber of rotation during the camera auto snapshotting. -
rotationTotal
protected int rotationTotalThe total rotation degree, fixing one bug. -
sceneRootTG
protected javax.media.j3d.TransformGroup sceneRootTGA TransformGroup object to which all the scene objects are attached, including 3D images, surface, behavior, and lights. -
transRotation
protected javax.media.j3d.Transform3D transRotationtransform rotation of the volume image during camera snapshot. -
transRotationMatrix
protected javax.media.j3d.Transform3D transRotationMatrixRotation matrix. -
triPlanarViewBG
protected javax.media.j3d.BranchGroup triPlanarViewBGTriplanar view branch group, which hold the three plane view and the slice box frame view. -
universe
protected com.sun.j3d.utils.universe.SimpleUniverse universeThe SimpleUniverse object which is the parent of everything else in the scene. -
viewPanel
View dialog associated with surface plotter or renderer. -
sliderEvents
Slider events used by the mouse recorder.
-
-
Constructor Details
-
RenderViewBase
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 Details
-
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
Used by the JPanelMouse the redisplay the recorded actions.- Parameters:
scene- Object
-
setRGBTA
Set the RGB table of imageA. Method will be extended in renders.- Parameters:
RGBT- the rgb table to use for image A
-
setRGBTB
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
Accessor that returns the reference to image A.- Returns:
- Image A.
-
getImageB
Accessor that returns the reference to image B.- Returns:
- Image B.
-
getRGBTA
Get the RGB table of imageA. Method will be extended in renders.- Returns:
- rgb table for image A
-
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
Sets the color of the background.- Parameters:
color- Color to set to.
-
setBoxColor
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
-
recordMouse
Unchanged.- Parameters:
event- Original mouse event.
-