Class ViewJComponentRenderImage
java.lang.Object
gov.nih.mipav.view.renderer.J3D.volumeview.ViewJComponentRenderImage
- All Implemented Interfaces:
MouseMotionListener,EventListener
- Direct Known Subclasses:
ViewJComponentRenderImageRayCast,ViewJComponentRenderImageShearWarp
Abstract class used for displaying images in the program MIPAV.
- Version:
- 1.0 August 31, 1999
- Author:
- Matthew J. McAuliffe, Ph.D.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDOCUMENT ME!protected ModelLUTLookup table for (intensity) image A.protected ModelLUTLookup table for (intensity) image B.private int[]buffer used for image to draw to display.protected floatalphaBlending values for compositing two images.private javax.vecmath.AxisAngle4fAxis angle vector.protected ColorDOCUMENT ME!protected BufferedImageDOCUMENT ME!protected ModelImageImages to be renderer.protected ModelImageDOCUMENT ME!protected DimensionDOCUMENT ME!protected RendererImageDataManages the renderer data for each image.protected RendererImageDataDOCUMENT ME!protected ModelRGBmodel of a RGB Table.protected ModelRGBDOCUMENT ME!private javax.vecmath.Vector3ftemporary variables to avoid 'new' calls.private javax.vecmath.Vector3ftemporary variables to avoid 'new' calls.private javax.vecmath.Vector3ftemporary variables to avoid 'new' calls.protected VolumeRendererReference to the ShearWarpVolumeRenderer which hold this as an instance.protected intmode - used to describe the cursor mode.static final intCOMPOSITE rendering mode constant.static final intMIP rendering mode constant.static final intSURFACE rendering mode constant.static final intSurface faset rendering mode constant.static final intDRR rendering mode constant.protected intDefault ray tracing space size.protected intDefault ray tracing step size.protected RendererDOCUMENT ME!protected RendererDOCUMENT ME!protected int[]Buffer used to store ARGB images of the image presently being displayed.protected int[]DOCUMENT ME!protected intDefault rending mode, MIP mode.protected intTime sliders value.protected intDOCUMENT ME!protected intDOCUMENT ME!protected javax.media.j3d.Transform3DCurrent updated transform.protected intTransform counter, used to reduce the rendering frequency. -
Constructor Summary
ConstructorsConstructorDescriptionViewJComponentRenderImage(VolumeRenderer kVolumeRenderer, ModelImage _imageA, ModelLUT _LUTa, ModelImage _imageB, ModelLUT _LUTb, int[] rvolBufferA, int[] rvolBufferB, int[] extents, int renderMode, int maxExtent) ImageA and ImageB are expected to be of the same dimensionality !! -
Method Summary
Modifier and TypeMethodDescriptionvoiddisposeLocal(boolean flag) Clean memory.voiddrawImages(int[] aiRenBufferA, int[] aiRenBufferB) Note that alphaBlending is applied with 1 component taken as zero if both components are not present -for example, if either imageA or imageB but not both has red, then the red component is alphaBlended with zero.protected voidfinalize()Calls dispose.floatAccessor that returns amount of alpha blending between two images.javax.vecmath.AxisAngle4fDOCUMENT ME!javax.vecmath.Point3fReturn access to the current eye point in world coordinates.getImage()Gets the Java image.Returns the imageA.Returns the imageB.getLUTa()Accessor that returns the model lut for the imageA.getLUTb()Accessor that returns the model lut for the imageB.booleanChange the camera model.Accessor that returns the reference to rayTracerA.intGet the rendering mode.getRGBTA()Accessor that returns the ModelRGB RGBTA for imageA.getRGBTB()Accessor that returns the ModelRGB for imageB.intGet the raytrace region space size.intGet raytrace step size.voidmouseClicked(MouseEvent kEvent) One of the overrides necessary to be a MouseListener.voidmouseDragged(MouseEvent kEvent) One of the overrides necessary to be a MouseMotionListener.voidmouseEntered(MouseEvent kEvent) One of the overrides necessary to be a MouseListener.voidmouseExited(MouseEvent kEvent) One of the overrides necessary to be a MouseListener.voidmouseMoved(MouseEvent kEvent) One of the overrides necessary to be a MouseMotionListener.voidmousePressed(MouseEvent kEvent) One of the overrides necessary to be a MouseListener.voidmouseReleased(MouseEvent kEvent) One of the overrides necessary to be a MouseListener.booleanmoveTrackBall(float fX0, float fY0, float fX1, float fY1) A virtual track ball.voidsetAlphaBlend(int iValue) Sets the alpha blending of parameter for two image displaying.voidsetBackgroundColor(Color color) Sets the background color for the frame and rendered image.voidsetImageA(ModelImage image) Sets component's ImageA.voidsetImageB(ModelImage image) Sets component's ImageB !!!!!!voidAccessor that sets the model LUT for the imageA.voidAccessor that sets the model LUTb for the imageB.voidsetMaxExtent(int iMaxExtent, int[] rvolBufferA, int[] rvolBufferB) Updates the BufferedImage, Dimension, and render buffers when the render target image size changes so that the image can be redisplayed at the new target resolution.voidsetParallel(boolean bParallel) Change the camera model.abstract voidsetRenderMode(int renderMode) Change the camera model.voidThe following 2 functions set the RGB tables for ARGB images A and B.voidSets the RGB table for ARGB image B.voidsetSpaceSize(int spaceSize) Set the raytrace region space size.voidsetStepSize(int stepSize) Set the raytrace step size.voidsetXBoundNeg(float value) Setup the X Negative clipping plane position.voidsetXBoundPos(float value) Setup the X positive clipping plane position.voidsetYBoundNeg(float value) Setup the Y Negative clipping plane position.voidsetYBoundPos(float value) Setup the Y positive clipping plane position.voidsetZBoundNeg(float value) Setup the Z negative clipping plane position.voidsetZBoundPos(float value) Setup the Z positive clipping plane position.booleanshows the image and the VOI(s).protected abstract voidtrace(int rayStepSize, int raySpaceSize) Ray trace by step size.booleanupdateLighting(SoftwareLightSet kLightSet, SoftwareMaterial kMaterial) Setup the specified set of lights to use for rendering.voidupdateTransform(javax.media.j3d.Transform3D transform) Update transform from the surface volume render.booleanupdateView(int type, javax.media.j3d.Transform3D transform) Call by the surface volume render to update transform changes.
-
Field Details
-
ModeMIP
public static final int ModeMIPMIP rendering mode constant.- See Also:
-
ModeXRAY
public static final int ModeXRAYDRR rendering mode constant.- See Also:
-
ModeSURFACE
public static final int ModeSURFACESURFACE rendering mode constant.- See Also:
-
ModeCOMPOSITE
public static final int ModeCOMPOSITECOMPOSITE rendering mode constant.- See Also:
-
ModeSURFACEFAST
public static final int ModeSURFACEFASTSurface faset rendering mode constant.- See Also:
-
imageExtentMax
protected int imageExtentMaxDOCUMENT ME! -
LUTa
Lookup table for (intensity) image A. -
LUTb
Lookup table for (intensity) image B. -
m_fAlphaBlend
protected float m_fAlphaBlendalphaBlending values for compositing two images. -
m_kBackgroundColor
DOCUMENT ME! -
m_kImage
DOCUMENT ME! -
m_kImageA
Images to be renderer. -
m_kImageB
DOCUMENT ME! -
m_kImageDim
DOCUMENT ME! -
m_kRendererImageDataA
Manages the renderer data for each image. -
m_kRendererImageDataB
DOCUMENT ME! -
m_kRGBTA
model of a RGB Table. -
m_kRGBTB
DOCUMENT ME! -
m_kVolumeRenderer
Reference to the ShearWarpVolumeRenderer which hold this as an instance. -
mode
protected int modemode - used to describe the cursor mode. -
raySpaceSize
protected int raySpaceSizeDefault ray tracing space size. -
rayStepSize
protected int rayStepSizeDefault ray tracing step size. -
rayTracerA
DOCUMENT ME! -
rayTracerB
DOCUMENT ME! -
renBufferA
protected int[] renBufferABuffer used to store ARGB images of the image presently being displayed. -
renBufferB
protected int[] renBufferBDOCUMENT ME! -
renderingMode
protected int renderingModeDefault rending mode, MIP mode. -
timeSlice
protected int timeSliceTime sliders value. -
timeSliceA
protected int timeSliceADOCUMENT ME! -
timeSliceB
protected int timeSliceBDOCUMENT ME! -
transformBU
protected javax.media.j3d.Transform3D transformBUCurrent updated transform. -
transformCounter
protected int transformCounterTransform counter, used to reduce the rendering frequency. -
m_aiPaintBuffer
private int[] m_aiPaintBufferbuffer used for image to draw to display. -
m_kAxisAngle
private javax.vecmath.AxisAngle4f m_kAxisAngleAxis angle vector. -
m_kV0
private javax.vecmath.Vector3f m_kV0temporary variables to avoid 'new' calls. -
m_kV1
private javax.vecmath.Vector3f m_kV1temporary variables to avoid 'new' calls. -
m_kVCross
private javax.vecmath.Vector3f m_kVCrosstemporary variables to avoid 'new' calls.
-
-
Constructor Details
-
ViewJComponentRenderImage
public ViewJComponentRenderImage(VolumeRenderer kVolumeRenderer, ModelImage _imageA, ModelLUT _LUTa, ModelImage _imageB, ModelLUT _LUTb, int[] rvolBufferA, int[] rvolBufferB, int[] extents, int renderMode, int maxExtent) ImageA and ImageB are expected to be of the same dimensionality !!- Parameters:
kVolumeRenderer- Access to renderer of which this is an instance._imageA- Model of the image that will be displayed_LUTa- LUT used to display imageA_imageB- Model of the image that will be displayed_LUTb- LUT used to display imageBrvolBufferA- rendering buffer ArvolBufferB- rendering buffer B // Tagged for CHECKING DELETINGextents- image dimension extentsrenderMode- rendering mode, MIP, DRR and SURFACEmaxExtent- maximium extent value.
-
-
Method Details
-
setRenderMode
public abstract void setRenderMode(int renderMode) Change the camera model.- Parameters:
renderMode- rendering mode.
-
disposeLocal
public void disposeLocal(boolean flag) Clean memory.- Parameters:
flag- is true call the super.disposeLocal
-
drawImages
public void drawImages(int[] aiRenBufferA, int[] aiRenBufferB) Note that alphaBlending is applied with 1 component taken as zero if both components are not present -for example, if either imageA or imageB but not both has red, then the red component is alphaBlended with zero.- Parameters:
aiRenBufferA- DOCUMENT ME!aiRenBufferB- DOCUMENT ME!
-
getalphaBlend
public float getalphaBlend()Accessor that returns amount of alpha blending between two images.- Returns:
- DOCUMENT ME!
-
getAxisAngle
public javax.vecmath.AxisAngle4f getAxisAngle()DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getEyePoint
public javax.vecmath.Point3f getEyePoint()Return access to the current eye point in world coordinates.- Returns:
- Point3f current eye point in world coordinates.
-
getImage
Gets the Java image.- Returns:
- Java image
- See Also:
-
getImageA
Returns the imageA.- Returns:
- imageA Model image A.
-
getImageB
Returns the imageB.- Returns:
- imageB Model image B.
-
getLUTa
Accessor that returns the model lut for the imageA.- Returns:
- LUTa the model LUT for imageA
-
getLUTb
Accessor that returns the model lut for the imageB.- Returns:
- LUTb the model LUT for imageB
-
getParallel
public boolean getParallel()Change the camera model.- Returns:
- DOCUMENT ME!
-
getRayTracerA
Accessor that returns the reference to rayTracerA.- Returns:
- DOCUMENT ME!
-
getRenderMode
public int getRenderMode()Get the rendering mode.- Returns:
- renderingMode MIP, DRR and SUR
-
getRGBTA
Accessor that returns the ModelRGB RGBTA for imageA.- Returns:
- DOCUMENT ME!
-
getRGBTB
Accessor that returns the ModelRGB for imageB.- Returns:
- DOCUMENT ME!
-
getSpaceSize
public int getSpaceSize()Get the raytrace region space size.- Returns:
- raySpaceSize space size.
-
getStepSize
public int getStepSize()Get raytrace step size.- Returns:
- rayStepSize raytrace step size.
-
mouseClicked
One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.- Parameters:
kEvent- the mouse event generated by a mouse press
-
mouseDragged
One of the overrides necessary to be a MouseMotionListener. This member handles rotating the virtual track ball during the dragging of the mouse after a mouse-press event but before a mouse-release event. Each drag event causes the virtual track ball to be rotated. Each such rotation causes a ray trace to occur, but the trace is generated at low resolution.- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
kEvent- the event generated by the mouse dragging
-
mouseEntered
One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.- Parameters:
kEvent- the mouse event generated by a mouse press
-
mouseExited
One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.- Parameters:
kEvent- the mouse event generated by a mouse press
-
mouseMoved
One of the overrides necessary to be a MouseMotionListener. This member only exists to satisfy the conditions of being a MouseMotionListener. It does nothing when invoked.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
kEvent- the event generated by a mouse movement
-
mousePressed
One of the overrides necessary to be a MouseListener. When a mouse button is pressed, the application is starting a drag operation to rotate the virtual track ball. The initial mouse location is recorded for use by 'moveTrackBall', stored as a point (x0,y0) in [-1,1]^2.- Parameters:
kEvent- the mouse event generated by a mouse press
-
mouseReleased
One of the overrides necessary to be a MouseListener. When a mouse button is released, the application is finishing a drag operation to rotate the virtual track ball. The final mouse location is recorded for use by 'moveTrackBall', stored as a point (x1,y1) in [-1,1]^2. The virtual track ball is moved into its final position and a ray trace is performed at highest resolution.- Parameters:
kEvent- the mouse event generated by a mouse press
-
moveTrackBall
public boolean moveTrackBall(float fX0, float fY0, float fX1, float fY1) A virtual track ball. This method generates a rotation matrix from (x0,y0) and (x1,y1), two points in [-1,1]^2. If either point is outside the unit circle, it is projected onto the unit circle. The corresponding sphere points (x0,y0,z0) and (x1,y1,z1) are computed. The cross product is used as the axis of rotation. The angle between the vectors is used as the angle of rotation. The rotation matrix is used to rotate the oriented bounding box of the 3D image.- Parameters:
fX0- DOCUMENT ME!fY0- DOCUMENT ME!fX1- DOCUMENT ME!fY1- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
setAlphaBlend
public void setAlphaBlend(int iValue) Sets the alpha blending of parameter for two image displaying.- Parameters:
iValue- int amount [0,100] that is the percentage of Image A to be displayed
-
setBackgroundColor
Sets the background color for the frame and rendered image.- Parameters:
color- Color RGBA color to use as the background color.
-
setImageA
Sets component's ImageA.- Parameters:
image- DOCUMENT ME! assumes dimensionality same as image B's for now
-
setImageB
Sets component's ImageB !!!!!! assumes dimensionality same as image A's for now will fix soon.- Parameters:
image- imageB
-
setLUTa
Accessor that sets the model LUT for the imageA.- Parameters:
LUT- the model LUT
-
setLUTb
Accessor that sets the model LUTb for the imageB.- Parameters:
LUT- the model LUT
-
setMaxExtent
public void setMaxExtent(int iMaxExtent, int[] rvolBufferA, int[] rvolBufferB) Updates the BufferedImage, Dimension, and render buffers when the render target image size changes so that the image can be redisplayed at the new target resolution.- Parameters:
iMaxExtent- DOCUMENT ME!rvolBufferA- DOCUMENT ME!rvolBufferB- DOCUMENT ME!
-
setParallel
public void setParallel(boolean bParallel) Change the camera model.- Parameters:
bParallel- true for a parallel camera, false for a perspective camera
-
setRGBTA
The following 2 functions set the RGB tables for ARGB images A and B. Sets the RGB table for ARGB image A- Parameters:
kRGBT- RGB table
-
setRGBTB
Sets the RGB table for ARGB image B.- Parameters:
kRGBT- RGB table
-
setSpaceSize
public void setSpaceSize(int spaceSize) Set the raytrace region space size.- Parameters:
spaceSize- region space size.
-
setStepSize
public void setStepSize(int stepSize) Set the raytrace step size.- Parameters:
stepSize- step size
-
setXBoundNeg
public void setXBoundNeg(float value) Setup the X Negative clipping plane position.- Parameters:
value- position of the X negative clip slider.
-
setXBoundPos
public void setXBoundPos(float value) Setup the X positive clipping plane position.- Parameters:
value- position of the X positive clip slider.
-
setYBoundNeg
public void setYBoundNeg(float value) Setup the Y Negative clipping plane position.- Parameters:
value- position of the Y negative clip slider.
-
setYBoundPos
public void setYBoundPos(float value) Setup the Y positive clipping plane position.- Parameters:
value- positin of the Y positve clip slider.
-
setZBoundNeg
public void setZBoundNeg(float value) Setup the Z negative clipping plane position.- Parameters:
value- position of the Z negative clip slider.
-
setZBoundPos
public void setZBoundPos(float value) Setup the Z positive clipping plane position.- Parameters:
value- position of the Z positive clip slider.
-
show
public boolean show(int tSlice, ModelLUT _LUTa, ModelLUT _LUTb, boolean forceShow, boolean bQualityHigh) shows the image and the VOI(s).- Parameters:
tSlice- t (time) slice to show_LUTa- LUTa - to change to new LUT for imageA else null_LUTb- LUTb - to change to new LUT for imageB else nullforceShow- forces this method to import image and recalculate java imagebQualityHigh- forces a call to trace(1,1) instead of using lower res sampling- Returns:
- boolean to indicate if the show was successful
-
updateLighting
Setup the specified set of lights to use for rendering.- Parameters:
kLightSet- SoftwareLightSet Set of world/model lights.kMaterial- SoftwareMaterial Set of default material properties to use when applying the lighting.- Returns:
- boolean True if the update of lighting triggers a need to redraw the images.
-
updateTransform
public void updateTransform(javax.media.j3d.Transform3D transform) Update transform from the surface volume render.- Parameters:
transform- Transform3D
-
updateView
public boolean updateView(int type, javax.media.j3d.Transform3D transform) Call by the surface volume render to update transform changes. Composite the slice trace by the specified space size.- Parameters:
type- Transform type, current not used.transform- Transform3D
-
trace
protected abstract void trace(int rayStepSize, int raySpaceSize) Ray trace by step size.- Parameters:
rayStepSize- interp step sizeraySpaceSize- DOCUMENT ME!
-
finalize
Calls dispose.
-