Class RayCastIntensityDRRBresenham

  • All Implemented Interfaces:
    RendererInterfaceIntensity

    public class RayCastIntensityDRRBresenham
    extends RayCastIntensityDRR
    A sample ray tracer that extends RayTrace. The only two necessary member functions are a constructor and an override of 'processRay'. This sample shows how to do a very inexpensive ray trace by computing the nearest voxel locations for the line segment ray-box intersection and using Bresenham's line drawing algorithm to traverse only voxel locations and accumulate image values.
    • Constructor Detail

      • RayCastIntensityDRRBresenham

        public RayCastIntensityDRRBresenham​(ModelImage kImage,
                                            int iRBound,
                                            int[] aiRImage)
        The constructor for the ray tracer. Currently, the only client of this class is VolumeRenderer.
        Parameters:
        kImage - the 3D image
        iRBound - the rendered image dimension (image is square)
        aiRImage - The rendered image data stored in row-major order. Each integer pixel represents an RGB color in the format B | (G
    • Method Detail

      • usesNormals

        public boolean usesNormals()
        Return indication as to whether or not the particular renderer uses normal vectors as part of its implementation.
        Overrides:
        usesNormals in class RayCastIntensityDRR
        Returns:
        boolean True if the implementation uses normals.
      • 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 Bresenham's line drawing algorithm to numerically integrate the image (at a coarse level) along 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

        Overrides:
        processRay in class RayCastIntensityDRR
        Parameters:
        iIndex - index of the pixel corresponding to the processed ray
        rayTraceStepSize - DOCUMENT ME!