How to do Ray Tracing in 3D images, such as CT images?

Hi Dear 3DSlicer developers

I want to calculate the length of any ray that propagates from a point source and passes through the CT voxels. In other words, I want to calculate the length of each ray along its path through the voxels. So for each ray I want to calculate two parameters:

  1. The index number of the ray that the ray passes through.

  2. The distance traveled within the voxel.

For a better explanation and understanding, please look at the following figure.

In the above figure, it is assumed that the rays emanated from of a point source are equal to the number of pixels in the imaging system. These rays are lines drawn from the point source to the center of pixel. So if the image matrix is 1024x1024, then there will be 1048576 rays. The figure below is a demonstration of this concept in the sagital slice (2D).

In this particular ray, how can I determine it passes which voxels? What distance has it traveled from each of these voxels? The figure below is the same concept in three dimensions.

What is your proposed solution to perform these calculations?
Does VTK have a library to do it?
Please guide me.
Shahrokh

Excuse me, I must correct the above message:

… for each ray I want to calculate two parameters:

  1. The index number of the voxel that the ray passes through.
  2. The distance traveled within the voxel.

Honestly you should just do this in plastimatch. Use plastimatch drr with the --raytrace-details option. It will create a large file with exactly what you want.

I think this problem has been solved.

Take a look at this journal paper: Siddon, Robert L. “Fast calculation of the exact radiological path for a three‐dimensional CT array.” Medical physics 12.2 (1985): 252-255.
and its implementation at : https://code.google.com/archive/p/drrsuite/downloads

There are also two VTK functions that may help:
vtkFixedPointVolumeRayCastMapper
vtkGPUVolumeRayCastMapper

If they do not work for you, you can check some journal papers on Digitally Reconstructed Radiograph (DRR). I saw that they were trying to solve the same problem as yours.

Hope this help.
Manh