CT Projection Simulator

Computes the parallel beam 2D projections of an object specified as a set of geometric shapes
1.1K Downloads
Updated 21 Sep 2011

View License

Specifying an object as a shape results in fewer edge artifacts in the reconstructed image than with projections from radon.m, which specifies the object as an image.

A comparison of reconstructed images with CTProjSim and radon.m is given at
http://aprendtech.com/wordpress/?p=89

The object starts as empty and then shapes with specified dimensions and density can be added.
The projections are the product of the length through the instances of all shape times their density.
Different instances of each shape can have different density.
The density can be a vector quantity so the projections are a
(ndetectors, nangles, ndensity) matrix.

The shapes are specified by optional parameters of one or more pairs
'shape',spec where shape can be one of 'ellipse', 'gaussian', or 'polygon'
the spec parameter depends on the shape--see the function help
The lines are equally spaced around the origin and start parallel to the y-axis.

Here is an example of a Shepp-Logan phantom with a square in the middle

% projections for Shepp-Logan phantom
% the spec is for phantom in air .. not water
s = [ ...
0,0,0.92,0.69,90,2; ...
0,-0.0184,0.874,0.6624,90,-0.98; ...
0.22,0,0.31,0.11,72,-0.02; ...
-0.22,0,0.41,0.16,108,-0.02; ...
0,0.35,0.25,0.21,90,0.01; ...
0,0.1,0.046,0.046,0,0.01; ...
0,-0.1,0.046,0.046,0,0.01; ...
-0.08,-0.605,0.046,0.023,0,0.01; ...
0,-0.605,0.023,0.023,0,0.01; ...
0.06,-0.605,0.046,0.023,90,0.01; ...
];

% add a small square at the center
% polygon vertexes are specified as complex vectors: x + iy
% exp(1i*pi/4) rotates the square by 45 degrees
pgon.vertex = 0.1*exp(1i*linspace(0,2*pi,5))*exp(1i*pi/4);
pgon.density = -0.1;

pjn = CTProjSim(0.0025,240,'ellipse',s,'polygon',pgon);

img = CTrecon(pjn); % see http://aprendtech.com/wordpress/?p=74 for CTrecon code
% can also use iradon but it will be slow
% nangles = 240;
% angles = linspace(0,180,nangles+1);
% img = iradon(pjn,angles(1:end-1));
imshow(img,[0.8 1.2])
-------
for more information see
http://aprendtech.com/wordpress/?p=159
http://aprendtech.com/wordpress/?p=166

Cite As

Robert Alvarez (2024). CT Projection Simulator (https://www.mathworks.com/matlabcentral/fileexchange/32925-ct-projection-simulator), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
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
1.2.0.0

fixed a bug with the ndetectors parameter
demo code tests for CTrecon function and uses iradon if not available

1.1.0.0

I added a link to a comparison of reconstructed images with CTProjSim.m and radon.m

1.0.0.0