Class RayCastColorDRR

  • All Implemented Interfaces:
    RendererInterfaceColor

    public class RayCastColorDRR
    extends RayCastColor
    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_kNormalizeB

        protected java.lang.Float m_kNormalizeB
        DOCUMENT ME!
      • m_kNormalizeG

        protected java.lang.Float m_kNormalizeG
        DOCUMENT ME!
      • m_kNormalizeR

        protected java.lang.Float m_kNormalizeR
        Factor used to scale the computed sum along each ray for the purpose of normalizing the integral.
    • Constructor Detail

      • RayCastColorDRR

        public RayCastColorDRR​(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
    • Method Detail

      • disposeLocal

        public void disposeLocal()
        Clean memory.
        Overrides:
        disposeLocal in class Renderer
      • setInput

        public void setInput​(byte[] acImageR,
                             byte[] acImageG,
                             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 RendererInterfaceColor
        Overrides:
        setInput in class RayCastColor
        Parameters:
        acImageR - byte[] Array of byte red values for volume.
        acImageG - byte[] Array of byte green values for volume.
        acImageB - byte[] Array of byte blue 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.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Calls dispose.
        Overrides:
        finalize in class RayCastColor
        Throws:
        java.lang.Throwable - DOCUMENT ME!
      • processRay

        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. 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. 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. P0 and P1 are used for multi-thread 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

        Specified by:
        processRay in class RayCastRenderer
        Parameters:
        p0 - ray trace starting point
        p1 - ray trace stopping point
        iIndex - int the index of the pixel corresponding to the processed ray
        rayTraceStepSize - int size of steps to take along ray being traced
      • 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

        Specified by:
        processRay in class RayCastRenderer
        Parameters:
        iIndex - index of the pixel corresponding to the processed ray
        rayTraceStepSize - DOCUMENT ME!
      • traceInit

        protected void traceInit()
        Called at the beginning of the trace methods.
        Overrides:
        traceInit in class Renderer