  We propose a new algorithm to compute the X-ray transform of an image
represented by unit (pixel/voxel) basis functions. The fundamental issue is
equivalently calculating the intersection lengths of the ray with associated
units. For any given ray, we first derive the sufficient and necessary
condition for non-vanishing intersectability. By this condition, we then
distinguish the units that produce valid intersections with the ray. Only for
those units rather than all the individuals, we calculate the intersection
lengths by the obtained analytic formula. The proposed algorithm is adapted to
2D/3D parallel beam and 2D fan beam. Particularly, we derive the transformation
formulas and generalize the algorithm to 3D circular and helical cone beams.
Moreover, we discuss the intrinsic ambiguities of the problem itself, and
present a solution. The algorithm not only possesses the adaptability with
regard to the center position, scale and size of the image, but also is suited
to parallelize with optimality. The comparison study demonstrates the proposed
algorithm is fast, more complete, and is more flexible with respect to
different scanning geometries and different basis functions. Finally, we
validate the correctness of the algorithm by the aforementioned scanning
geometries.
