Class 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 Detail

      • m_fNormalize

        protected float m_fNormalize
        Factor used to scale the computed sum along each ray for the purpose of normalizing the integral.
    • Constructor Detail

      • RayCastIntensityDRR

        public RayCastIntensityDRR​(ModelImage kImage,
                                   int iRBound,
                                   int[] aiRImage)
        The constructor for the ray tracer.
        Parameters:
        kImage - the 3D image
        iRBound - the dimension of the square 2D renderer image
        aiRImage - 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 interface RendererInterfaceIntensity
        Overrides:
        setInput in class RayCastIntensity
        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 class Renderer
        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 class RayCastRenderer
        Parameters:
        p0 - Local starting point.
        p1 - Local ending point
        iIndex - index of the pixel corresponding to the processed ray
        rayTraceStepSize - 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 class RayCastRenderer
        Parameters:
        iIndex - index of the pixel corresponding to the processed ray
        rayTraceStepSize - DOCUMENT ME!