Class RayCastIntensityDRR
- java.lang.Object
-
- gov.nih.mipav.view.renderer.J3D.volumeview.Renderer
-
- gov.nih.mipav.view.renderer.J3D.volumeview.RayCastRenderer
-
- gov.nih.mipav.view.renderer.J3D.volumeview.RayCastIntensity
-
- gov.nih.mipav.view.renderer.J3D.volumeview.RayCastIntensityDRR
-
- All Implemented Interfaces:
RendererInterfaceIntensity
- Direct Known Subclasses:
RayCastIntensityDRRBresenham
public class RayCastIntensityDRR extends RayCastIntensity
A ray tracer for 3D images. Either a parallel or perspective camera model can be selected to form the rays. In the parallel case, zooming is accomplished by changing the size of the viewport. In the perspective case, zooming is accomplished by moving the eye point. The line segment of intersection (if it exists) of a ray with the bounding box of the image is computed. An integration of the image values along the segment is computed and used as the gray scale value for the volume rendering. The image is trilinearly interpolated to allow subvoxel evaluations.The camera coordinate system has eye point is E = (0,0,z). The direction vector is D = (0,0,1), the up vector is U = (0,1,0), and the right vector is R = (1,0,0). Only the eye point is allowed to change. Since the 3D image can be arbitrarily rotated (via a virtual trackball), any portion of the image can be viewed either close up or far away.
The view plane has normal D and origin at E+n*D (n=near). The view frustum is orthogonal and has no far plane. For a perspective camera, the field of view is given as an angle A subtended at the eye point. In camera coordinates, the view port is the square [-e,e]^2 where e = n*tan(A/2). In world coordinates, the corners of the square are E+n*D+s*e*U+t*e*R where |s| = |t| = 1 (four choices on sign). For a parallel camera, there is no field of view.
The mapping between the viewport [-e,e]^2 and the B-by-B render image is the following. If (i,j) is a pixel in the image, then the corresponding viewport point is (r,u) = (-e+2*e*i/(B-1),-e+2*e*j/(B-1)).
-
-
Field Summary
Fields Modifier and Type Field Description protected float
m_fNormalize
Factor used to scale the computed sum along each ray for the purpose of normalizing the integral.-
Fields inherited from class gov.nih.mipav.view.renderer.J3D.volumeview.RayCastIntensity
m_acImageA, m_acImageB, m_kMap
-
Fields inherited from class gov.nih.mipav.view.renderer.J3D.volumeview.RayCastRenderer
blue, clipRegionXNeg, clipRegionXPos, clipRegionYNeg, clipRegionYPos, clipRegionZNeg, clipRegionZPos, fXDelta, fYDelta, fZDelta, green, m_fInvXDelta, m_fInvYDelta, m_fInvZDelta, m_kExtent, m_kMDir, m_kMOrig, m_kP0, m_kP1, m_kPDiff, m_kV, m_kWDir, m_kWOrig, opacityFunctA, opacityFunctB, red, vertexDiffuse, vertexSpecular, xLUTa, xLUTb, yLUTa, yLUTb
-
Fields inherited from class gov.nih.mipav.view.renderer.J3D.volumeview.Renderer
m_aiRImage, m_akAxis, m_akNormal, m_bParallel, m_bReloadInput, m_fAngle, m_fExtreme, m_fFMult, m_fGamma, m_fNear, m_fRScaleX, m_fRScaleY, m_fXTrn, m_fYTrn, m_fZoom, m_iMaxBound, m_iMinBound, m_iRBound, m_iXBound, m_iXBoundM1, m_iXBoundM2, m_iXYProduct, m_iXYZProduct, m_iYBound, m_iYBoundM1, m_iYBoundM2, m_iZBound, m_iZBoundM1, m_iZBoundM2, m_kBackgroundColor, m_kEyeModel, m_kEyeWorld, m_kImage, m_kLightSet, m_kMaterial, m_kRotate
-
-
Constructor Summary
Constructors Constructor Description RayCastIntensityDRR(ModelImage kImage, int iRBound, int[] aiRImage)
The constructor for the ray tracer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
processRay(int iIndex, int rayTraceStepSize)
Process a ray that has intersected the oriented bounding box of the 3D image.protected void
processRay(javax.vecmath.Point3f p0, javax.vecmath.Point3f p1, int iIndex, int rayTraceStepSize)
Process a ray that has intersected the oriented bounding box of the 3D image.void
setInput(byte[] acImageB, byte[] acImageA)
Specify the input volume to use for rendering.boolean
usesNormals()
Return indication as to whether or not the particular renderer uses normal vectors as part of its implementation.-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.volumeview.RayCastIntensity
disposeLocal, finalize, hasInputData, hasInputMap, setInputMap
-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.volumeview.RayCastRenderer
getAxis, interpolate, rotateBy, rotateFrameBy, setAxis, setBlurFlag, setDiffuse, setOpacityFunctions, setSpecular, setXBoundNeg, setXBoundPos, setYBoundNeg, setYBoundPos, setZBoundNeg, setZBoundPos, trace, traceBlockRays
-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.volumeview.Renderer
computeIntegralNormalizationFactor, convertWorldToModel, disposeLocal, getAngle, getBackgroundColor, getExtreme, getEyeDist, getEyePoint, getGamma, getMaxBound, getMinBound, getNear, getParallel, getXBound, getXTranslate, getYBound, getYTranslate, getZBound, getZoom, hasNormals, orthonormalize, reloadInputData, reloadInputData, setAngle, setBackgroundColor, setExtreme, setEyeDist, setGamma, setLighting, setMaterialShininess, setNear, setNearAndAngle, setNormals, setParallel, setXTranslate, setYTranslate, setZoom, traceInit
-
-
-
-
Constructor Detail
-
RayCastIntensityDRR
public RayCastIntensityDRR(ModelImage kImage, int iRBound, int[] aiRImage)
The constructor for the ray tracer.- Parameters:
kImage
- the 3D imageiRBound
- the dimension of the square 2D renderer imageaiRImage
- The rendered image data stored in row-major order. Each integer pixel represents an RGB color in the format B | (G << 8) | (R << 16).
-
-
Method Detail
-
setInput
public void setInput(byte[] acImageB, byte[] acImageA)
Specify the input volume to use for rendering. The image data stored in order of slice indices, each slice stored in row-major order. That is, slice z=0 is stored first, slice z=1 is stored next, and so on. In slice z=0, the y=0 row is stored first, the y=1 row is stored next, and so on.- Specified by:
setInput
in interfaceRendererInterfaceIntensity
- Overrides:
setInput
in classRayCastIntensity
- Parameters:
acImageB
- byte[] Array of byte intensity values for volume.acImageA
- byte[] Array of byte alpha values for volume.
-
usesNormals
public boolean usesNormals()
Return indication as to whether or not the particular renderer uses normal vectors as part of its implementation.- Specified by:
usesNormals
in classRenderer
- Returns:
- boolean True if the implementation uses normals.
-
processRay
protected void processRay(javax.vecmath.Point3f p0, javax.vecmath.Point3f p1, int iIndex, int rayTraceStepSize)
Description copied from class:RayCastRenderer
Process a ray that has intersected the oriented bounding box of the 3D image. The method is only called if there is a line segment of intersection. The 'intersectsBox' stores the end points of the line segment in the class members P0 and P1 in image coordinates. The local P0 and p1 are used for the multi-theading rendering.The function sets the color of the pixel corresponding to the processed ray. The RGB value is stored as an integer in the format B | (G << 8) | (R << 16). This method always returns a gray scale value (B = G = R). However, the function can be overridden in a subclass to produce other rendering effects. For example, the color can be set to a non-gray value if the ray intersects a level region bounded by a level surface. See SurfaceRayTrace.java for an example.
- Specified by:
processRay
in classRayCastRenderer
- Parameters:
p0
- Local starting point.p1
- Local ending pointiIndex
- index of the pixel corresponding to the processed rayrayTraceStepSize
- raycast step size.
-
processRay
protected void processRay(int iIndex, int rayTraceStepSize)
Process a ray that has intersected the oriented bounding box of the 3D image. The method is only called if there is a line segment of intersection. The 'intersectsBox' stores the end points of the line segment in the class members m_kP0 and m_kP1 in image coordinates. This method uses the Trapezoid Rule to numerically integrates the image along the line segment. The number of integration samples is chosen to be proportional to the length of the line segment.The function sets the color of the pixel corresponding to the processed ray. The RGB value is stored as an integer in the format B | (G << 8) | (R << 16). This method always returns a gray scale value (B = G = R). However, the function can be overridden in a subclass to produce other rendering effects. For example, the color can be set to a non-gray value if the ray intersects a level region bounded by a level surface. See SurfaceRayTrace.java for an example.
- Specified by:
processRay
in classRayCastRenderer
- Parameters:
iIndex
- index of the pixel corresponding to the processed rayrayTraceStepSize
- DOCUMENT ME!
-
-