Higher Level Questions of OptiX and Medical Imaging Applications

Hello there!

I’ve been orienting myself with OptiX, debating whether it’s appropriate to explore using in my work. I am asking if the following application would see a substantial increase using OptiX vs CUDA.

Presently I use CUDA to do the following program, which is very common in medical physics and radiation transport methods. It’s to calculate a line integral along a ray, where the summed values are sampled from a 3D Voxellized dataset

With parameter N_Steps, a Voxelized 3D data set, and N Rays
For each Ray (R_i)
integral[ray_i] = 0
For i to N_Steps
Calculate position = ray_i_start + (i / N_Steps) * (ray_i_end - ray_i_start)
value = sampling_fuction(voxellized_dataset, position)
integral[ray_i] += value * distance(ray_i_start, ray_i_end) / N_Steps

return integral[ray_i]

Where the sampling function can be trilinear or tricubic interpolation. Presently I do this using CUDA, and either perform the trilinear interpolation manually, or use a 3D texture for the voxellized data and perform a texture look up, tex3D(data, position). This is calculated using one thread for each ray.

Would OptiX lend itself to a substantial speed improvement over a pure CUDA implementation? I have seen work where the 3D data is a triangular mesh, and there is a definite speed up, as I understand OptiX is specifically designed for such applications. However for volumetric voxellized 3D data, I haven’t found much to indicate whether OptiX would be worth pursuing.

I would be very interested in learning whether a speed increase would be expected, and what hardware features OptiX provides vs CUDA that give that speed increase. For example, the texture lookup functions in CUDA typically give me 2-3x speed improvement over doing the trilinear interpolation manually (with some precision cost).

Hi anovack and thanks for your interest in the OptiX API. Though the algorithm you describe can quite easily be implemented in OptiX, the regular sampling of volume data along a ray does by itself not benefit from using OptiX. The OptiX volume sample in the SDK shows how integrating a volume density along a ray can be implemented using OptiX and NanoVDB (for the volume representation). The sampling is done using NanoVDB’s CUDA based 3D hierarchical DDA algorithm. The sample demonstrates how “empty space”, i.e. zero-density regions can be skipped using OptiX’ hardware accelerated ray-bounding-box intersection tests, but the performance gains of this technique are rather small for typical data.

1 Like

Thank you for your comment @fjargstorff ! I missed that example and will check it out.

Good to know it’s possible to do volumetric sampling even if there are no dramatic performance gains.