Class ViewJComponentRenderImage
- java.lang.Object
-
- gov.nih.mipav.view.renderer.J3D.volumeview.ViewJComponentRenderImage
-
- All Implemented Interfaces:
java.awt.event.MouseMotionListener,java.util.EventListener
- Direct Known Subclasses:
ViewJComponentRenderImageRayCast,ViewJComponentRenderImageShearWarp
public abstract class ViewJComponentRenderImage extends java.lang.Object implements java.awt.event.MouseMotionListenerAbstract class used for displaying images in the program MIPAV.- Version:
- 1.0 August 31, 1999
- Author:
- Matthew J. McAuliffe, Ph.D.
-
-
Field Summary
Fields Modifier and Type Field Description protected intimageExtentMaxDOCUMENT ME!protected ModelLUTLUTaLookup table for (intensity) image A.protected ModelLUTLUTbLookup table for (intensity) image B.private int[]m_aiPaintBufferbuffer used for image to draw to display.protected floatm_fAlphaBlendalphaBlending values for compositing two images.private javax.vecmath.AxisAngle4fm_kAxisAngleAxis angle vector.protected java.awt.Colorm_kBackgroundColorDOCUMENT ME!protected java.awt.image.BufferedImagem_kImageDOCUMENT ME!protected ModelImagem_kImageAImages to be renderer.protected ModelImagem_kImageBDOCUMENT ME!protected java.awt.Dimensionm_kImageDimDOCUMENT ME!protected RendererImageDatam_kRendererImageDataAManages the renderer data for each image.protected RendererImageDatam_kRendererImageDataBDOCUMENT ME!protected ModelRGBm_kRGBTAmodel of a RGB Table.protected ModelRGBm_kRGBTBDOCUMENT ME!private javax.vecmath.Vector3fm_kV0temporary variables to avoid 'new' calls.private javax.vecmath.Vector3fm_kV1temporary variables to avoid 'new' calls.private javax.vecmath.Vector3fm_kVCrosstemporary variables to avoid 'new' calls.protected VolumeRendererm_kVolumeRendererReference to the ShearWarpVolumeRenderer which hold this as an instance.protected intmodemode - used to describe the cursor mode.static intModeCOMPOSITECOMPOSITE rendering mode constant.static intModeMIPMIP rendering mode constant.static intModeSURFACESURFACE rendering mode constant.static intModeSURFACEFASTSurface faset rendering mode constant.static intModeXRAYDRR rendering mode constant.protected intraySpaceSizeDefault ray tracing space size.protected intrayStepSizeDefault ray tracing step size.protected RendererrayTracerADOCUMENT ME!protected RendererrayTracerBDOCUMENT ME!protected int[]renBufferABuffer used to store ARGB images of the image presently being displayed.protected int[]renBufferBDOCUMENT ME!protected intrenderingModeDefault rending mode, MIP mode.protected inttimeSliceTime sliders value.protected inttimeSliceADOCUMENT ME!protected inttimeSliceBDOCUMENT ME!protected javax.media.j3d.Transform3DtransformBUCurrent updated transform.protected inttransformCounterTransform counter, used to reduce the rendering frequency.
-
Constructor Summary
Constructors Constructor Description 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 !!
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddisposeLocal(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.floatgetalphaBlend()Accessor that returns amount of alpha blending between two images.javax.vecmath.AxisAngle4fgetAxisAngle()DOCUMENT ME!javax.vecmath.Point3fgetEyePoint()Return access to the current eye point in world coordinates.java.awt.image.BufferedImagegetImage()Gets the Java image.ModelImagegetImageA()Returns the imageA.ModelImagegetImageB()Returns the imageB.ModelLUTgetLUTa()Accessor that returns the model lut for the imageA.ModelLUTgetLUTb()Accessor that returns the model lut for the imageB.booleangetParallel()Change the camera model.RenderergetRayTracerA()Accessor that returns the reference to rayTracerA.intgetRenderMode()Get the rendering mode.ModelRGBgetRGBTA()Accessor that returns the ModelRGB RGBTA for imageA.ModelRGBgetRGBTB()Accessor that returns the ModelRGB for imageB.intgetSpaceSize()Get the raytrace region space size.intgetStepSize()Get raytrace step size.voidmouseClicked(java.awt.event.MouseEvent kEvent)One of the overrides necessary to be a MouseListener.voidmouseDragged(java.awt.event.MouseEvent kEvent)One of the overrides necessary to be a MouseMotionListener.voidmouseEntered(java.awt.event.MouseEvent kEvent)One of the overrides necessary to be a MouseListener.voidmouseExited(java.awt.event.MouseEvent kEvent)One of the overrides necessary to be a MouseListener.voidmouseMoved(java.awt.event.MouseEvent kEvent)One of the overrides necessary to be a MouseMotionListener.voidmousePressed(java.awt.event.MouseEvent kEvent)One of the overrides necessary to be a MouseListener.voidmouseReleased(java.awt.event.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(java.awt.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 !!!!!!voidsetLUTa(ModelLUT LUT)Accessor that sets the model LUT for the imageA.voidsetLUTb(ModelLUT LUT)Accessor 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.voidsetRGBTA(ModelRGB kRGBT)The following 2 functions set the RGB tables for ARGB images A and B.voidsetRGBTB(ModelRGB kRGBT)Sets 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.booleanshow(int tSlice, ModelLUT _LUTa, ModelLUT _LUTb, boolean forceShow, boolean bQualityHigh)shows 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 Detail
-
ModeMIP
public static final int ModeMIP
MIP rendering mode constant.- See Also:
- Constant Field Values
-
ModeXRAY
public static final int ModeXRAY
DRR rendering mode constant.- See Also:
- Constant Field Values
-
ModeSURFACE
public static final int ModeSURFACE
SURFACE rendering mode constant.- See Also:
- Constant Field Values
-
ModeCOMPOSITE
public static final int ModeCOMPOSITE
COMPOSITE rendering mode constant.- See Also:
- Constant Field Values
-
ModeSURFACEFAST
public static final int ModeSURFACEFAST
Surface faset rendering mode constant.- See Also:
- Constant Field Values
-
imageExtentMax
protected int imageExtentMax
DOCUMENT ME!
-
LUTa
protected ModelLUT LUTa
Lookup table for (intensity) image A.
-
LUTb
protected ModelLUT LUTb
Lookup table for (intensity) image B.
-
m_fAlphaBlend
protected float m_fAlphaBlend
alphaBlending values for compositing two images.
-
m_kBackgroundColor
protected java.awt.Color m_kBackgroundColor
DOCUMENT ME!
-
m_kImage
protected java.awt.image.BufferedImage m_kImage
DOCUMENT ME!
-
m_kImageA
protected ModelImage m_kImageA
Images to be renderer.
-
m_kImageB
protected ModelImage m_kImageB
DOCUMENT ME!
-
m_kImageDim
protected java.awt.Dimension m_kImageDim
DOCUMENT ME!
-
m_kRendererImageDataA
protected RendererImageData m_kRendererImageDataA
Manages the renderer data for each image.
-
m_kRendererImageDataB
protected RendererImageData m_kRendererImageDataB
DOCUMENT ME!
-
m_kRGBTA
protected ModelRGB m_kRGBTA
model of a RGB Table.
-
m_kRGBTB
protected ModelRGB m_kRGBTB
DOCUMENT ME!
-
m_kVolumeRenderer
protected VolumeRenderer m_kVolumeRenderer
Reference to the ShearWarpVolumeRenderer which hold this as an instance.
-
mode
protected int mode
mode - used to describe the cursor mode.
-
raySpaceSize
protected int raySpaceSize
Default ray tracing space size.
-
rayStepSize
protected int rayStepSize
Default ray tracing step size.
-
rayTracerA
protected Renderer rayTracerA
DOCUMENT ME!
-
rayTracerB
protected Renderer rayTracerB
DOCUMENT ME!
-
renBufferA
protected int[] renBufferA
Buffer used to store ARGB images of the image presently being displayed.
-
renBufferB
protected int[] renBufferB
DOCUMENT ME!
-
renderingMode
protected int renderingMode
Default rending mode, MIP mode.
-
timeSlice
protected int timeSlice
Time sliders value.
-
timeSliceA
protected int timeSliceA
DOCUMENT ME!
-
timeSliceB
protected int timeSliceB
DOCUMENT ME!
-
transformBU
protected javax.media.j3d.Transform3D transformBU
Current updated transform.
-
transformCounter
protected int transformCounter
Transform counter, used to reduce the rendering frequency.
-
m_aiPaintBuffer
private int[] m_aiPaintBuffer
buffer used for image to draw to display.
-
m_kAxisAngle
private javax.vecmath.AxisAngle4f m_kAxisAngle
Axis angle vector.
-
m_kV0
private javax.vecmath.Vector3f m_kV0
temporary variables to avoid 'new' calls.
-
m_kV1
private javax.vecmath.Vector3f m_kV1
temporary variables to avoid 'new' calls.
-
m_kVCross
private javax.vecmath.Vector3f m_kVCross
temporary variables to avoid 'new' calls.
-
-
Constructor Detail
-
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 Detail
-
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
public java.awt.image.BufferedImage getImage()
Gets the Java image.- Returns:
- Java image
- See Also:
Image
-
getImageA
public ModelImage getImageA()
Returns the imageA.- Returns:
- imageA Model image A.
-
getImageB
public ModelImage getImageB()
Returns the imageB.- Returns:
- imageB Model image B.
-
getLUTa
public ModelLUT getLUTa()
Accessor that returns the model lut for the imageA.- Returns:
- LUTa the model LUT for imageA
-
getLUTb
public ModelLUT 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
public Renderer 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
public ModelRGB getRGBTA()
Accessor that returns the ModelRGB RGBTA for imageA.- Returns:
- DOCUMENT ME!
-
getRGBTB
public ModelRGB 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
public void mouseClicked(java.awt.event.MouseEvent kEvent)
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
public void mouseDragged(java.awt.event.MouseEvent kEvent)
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 interfacejava.awt.event.MouseMotionListener- Parameters:
kEvent- the event generated by the mouse dragging
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent kEvent)
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
public void mouseExited(java.awt.event.MouseEvent kEvent)
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
public void mouseMoved(java.awt.event.MouseEvent kEvent)
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 interfacejava.awt.event.MouseMotionListener- Parameters:
kEvent- the event generated by a mouse movement
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent kEvent)
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
public void mouseReleased(java.awt.event.MouseEvent kEvent)
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
public void setBackgroundColor(java.awt.Color color)
Sets the background color for the frame and rendered image.- Parameters:
color- Color RGBA color to use as the background color.
-
setImageA
public void setImageA(ModelImage image)
Sets component's ImageA.- Parameters:
image- DOCUMENT ME! assumes dimensionality same as image B's for now
-
setImageB
public void setImageB(ModelImage image)
Sets component's ImageB !!!!!! assumes dimensionality same as image A's for now will fix soon.- Parameters:
image- imageB
-
setLUTa
public void setLUTa(ModelLUT LUT)
Accessor that sets the model LUT for the imageA.- Parameters:
LUT- the model LUT
-
setLUTb
public void setLUTb(ModelLUT LUT)
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
public void setRGBTA(ModelRGB kRGBT)
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
public void setRGBTB(ModelRGB kRGBT)
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
public boolean updateLighting(SoftwareLightSet kLightSet, SoftwareMaterial kMaterial)
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
protected void finalize() throws java.lang.ThrowableCalls dispose.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable- DOCUMENT ME!
-
-