Projection Demo

This demo illustrates the forward projection capabilities of OpenRecon.

OpenRecon Home

Contents

NOTE

This documentation is automatically generated through execution of the following script in the OpenRecon source-code distribution:

 demos/demo_xprj.m

It is recommended that you run the same program on your local machine (i.e. after installing OpenRecon), and compare with the results in this document. Furthermore you should tweak the settings in the Config file to see how your changes affect the results.

Initialization

To use OpenRecon, we need to add the folder for OpenRecon to the MATLAB path. We use the Shepp-Logan phantom for testing OpenRecon forward projection algorithms.

clear; clc; close all;
addpath('/Users/kritisen/Documents/Coding/openrecon/');
addpath('/Users/kritisen/Documents/Coding/openrecon/utilities/');

N = 256;
I = phantom(N);

Forward projection

In this section, we generate forward projections for the Shepp-Logan phantom in parallel- and fan-beam modes. Other configuration parameters (e.g. projection angles, source-distance) are listed in the Config files. At this point, it is good to have a look at the Config files (available in the same folder as this M-file)

P1 = xprj(I, 'sampleConfig_Proj_PARA.cfg');
P3 = xprj(I, 'sampleConfig_Proj_FAN_ED.cfg');
scrsz = get(0,'ScreenSize');
figure('Position',[1 scrsz(4)/2 scrsz(3)/2 scrsz(4)*0.3]),
subplot(1,3,1), imshow(I, []); title('Shepp-Logan phantom');
subplot(1,3,2), imshow(P1, []); title('Parallel-beam projections');
subplot(1,3,3), imshow(P3, []); title('Fan-beam projections');
number of angles (from a0, dAng, angN): 180 
Computing projections ..................Done.
number of angles (from a0, dAng, angN): 180 
Computing projections ..................Done.

Automatic config file generation (Parallel-beam)

In this section, we show a demo of OpenRecon's automatic Config file generation utility. Using this utility, the configuration parameters relating to scanner geometry, projection angles need to be specified in the M-file. Invoking the utility function creates the OpenRecon Config file in the correct format. First, we define settings for projection acquisition in the M-file. Next we need to generate config file by OpenRecon utility. Finally we generate the projections by the generated Config file.

a0 = 0;     % start angle
dAng = 1;   % angular increment
aN = 179;   % end angle
theta = a0: dAng: aN;
numAng = length(theta);     % total number of angles
pxlW = 1; pxlH = pxlW;      % pixel width and height (equal)
detN = floor(N*sqrt(2))+20; % detector length (calculated as slightly
                            % larger than diagonal of the image to be
                            % projected)

filename = 'sampleConfig_Proj_PARA_autogen.cfg';
createPrjCFGPara(filename, I, pxlW, pxlH, ...
    a0, dAng, numAng, 'detN', detN);

P2 = xprj(I, filename);
number of angles (from a0, dAng, angN): 180 
Computing projections ..................Done.

Automatic config file generation (Fan-beam)

In this section, we repeat the same as last section but for parallel beam case. We add a few more attributes which are required in the fan-beam case

scanR = 500; % Distance from source to rotation axis (if unit of pixel
                % width is um, then scanR = 50000 um = 50 mm
detrR = 0; % Distance from rotation axis to detector (Setting this to 0
            % does not change the scan geometry)

filename = 'sampleConfig_Proj_FAN_ED_autogen.cfg';
createPrjCFGFanED(filename, I, scanR, detrR, pxlW, pxlH, ...
    a0, dAng, numAng, 'detN', detN);
P4 = xprj(I, filename);
scrsz = get(0,'ScreenSize');
figure('Position',[1 scrsz(4)/2 scrsz(3)/2 scrsz(4)*0.3]),
subplot(1,3,1), imshow(I, []); title('Shepp-Logan phantom');
subplot(1,3,2), imshow(P2, []); title('Auto Config file PARA');
subplot(1,3,3), imshow(P4, []); title('Auto Config file FAN\_ED');
number of angles (from a0, dAng, angN): 180 
Computing projections ..................Done.

Non-linearly spaced projection angles

In this section, we demonstrate the capability of OpenRecon to handle non-linearly spaced projection angles. In the above examples, the linearly spaced projection angles were specified using start-angle (a0), end-angle (aN) and angle increment (dAng).

Non-linearly spaced projection angles, can be specified in a text-file which is then passed to OpenRecon through the Angle_Filename attribute. Note that for this case, the Config file must be created manually, and the following entry added:

 Angle_Filename (do not use //) = anglefile1.txt

For this case, it is recommended that you:

  1. View the Config file demos/..._nonlinearprojangles.cfg to note how the relevant text file has been specified.
  2. View the text-file (demos/anglefile1.txt in this case) to note the angular discontinuities (e.g. between projection #'s 29 and 30)
filename = 'sampleConfig_Proj_FAN_ED_nonlinearprojangles.cfg';
P5 = xprj(I, filename);
figure,
subplot(1,2,1), imshow(P4, []); title('Linearly spaced angles');
subplot(1,2,2), imshow(P5, []); title('Non-linearly spaced angles');
Angle file: anglefile1.txt
number of angles (from anglefile): 134 
Computing projections ..............Done.

OpenRecon Home