Cone beam CT simulation

To simulate a CBCT system by computing the 2D X-ray projection images.
Updated 27 Jan 2011

View License

Cone beam CT simulation

By: Deshan Yang, PhD
Department of radiation oncology, school of medicine, Washington University in Saint Louis

compute_projections.m - the main program, to compute all projection and save the 2D projection images into a folder
compute_one_projection.m - Called by the main program to compute only one projection image
straight_line_integral.m - The core function to compute a line integral through a 3D matrix
A lot of lines are commented out in this file because the file was originally written
in MATLAB only, and laterly rewritten into c for speed improvement.
straight_line_integral_inner.c - This is what rewritten in C from the straight_line_integral.m
sort_ts1_ts2.c - A utility function to combine two sorted array into one sorted array.
It is written in c to improve the speed

create_CSV_file_for_OSCaR.m - To create the CSV file which is used in OSCaR CBCT reconstruction
However, OSCaR does not support the saved mat data files without modification.
I have the modified OSCaR functions.

load_all_projection_images.m - Loading all projection images from a folder into a 3D volume
make_sure_positive.m - A small utility function

Binary files:
*.mexw32, *.mexw64 The compiled binary MEX files for 32-bit and 64-bit windows

Other files: - For different ways to compute projections. They are not in use anymore because
they are either much slower or less accurate

How to setup the 3D data:
You need to prepare an image 3D volume as the digital phantom (or patient, or object, whatever you call it).
For this main function: compute_projections(xs,ys,zs,data3d,mode,output_folder)
xs: the x coordinates of the image pixels in an array
ys: the y coordinates of the image pixels in an array
zs: the z coordinates of the image pixels in an array

xs, ys and zs should be centered at [0,0,0] which is the CBCT isocenter.

About computation performance:
The straight_line_integral function is partially written in c. It is very accurate and fairly fast.
The computation of projection implemented here is both faster and more accurate than the radon transformation code in MATLAB.
For a 3D matrix (512x512x176), it takes about 35 seconds to compute one 2D projection in resolution of 512x384 on a DELL with 2.33 GHz CPU.
Computation does not need a lot of RAM from my understanding.

Cite As

Deshan Yang (2024). Cone beam CT simulation (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes