For questions, please contact Tom Frese at frese@ecn.purdue.edu


I. GENERAL DESCRIPTION
----------------------------

This directory contains a C program for computing the convolution
backprojection (CBP) image for emission and transmission tomography.

The reconstruction filter can be selected as a ramp filter
with a given frequency cutoff between 0 and 1 or as a 
Generalized Hamming filter with frequency response 

H(omega)= H_ramp(omega) * (0.5 + 0.5*cos(pi*omega/omega_c))
              
where H_ramp is the ideal ramp reconstruction filter and
omega_c is a cutoff frequency parameter. (The actual input
parameter to the program is frequency cutoff between 
0.0 and 1.0 corresponding to 0-100%).


II. Data I/O FORMAT AND COMPILATION ISSUES
-------------------------------------------

The program uses matlab .mat files for data input and output,
however, the computation is done purely in C. 

In order to compile the program, it is necessary to
link in the dynamic libraries found in the matlab
external directories. In addition, it is necessary to
assure that these libraries can be found a runtime (since
they are dynamically and not statically linked). 
The way to do this is architecture dependent and not
always obvious. See the file INSTALL in this directory
for a description for HP-UX, Sun and Linux architectures.

If Matlab I/O is not desired, the code in src/cbp.c can
easily be modified to use your own data format. In that
case compilation becomes easier.



III. COMMAND SYNTAX
-------------------------------------------
cbp [-r <resolution_in_pixels>] [-R] [-f <cutoff_freq>] 
           [-t] [-E <attenuation-file>] 
           <input_file.mat> <output-file.mat>

-r: resolution of reconstructed image, i.e. number of pixels 
    in recon in each direction. If this is not specified,
    it will default to the number of displacements in the
    variable n_t input_file.mat.
    
-R: Use ramp filter instead of generalized Hamming filter

-f: Filter cutoff between 0.0 and 1.0, default=0.8

-t: Transmission mode (default=emission w/o attenuation file)

-E: Allows to specify attenuation file for emission mode,
    if this is done, the attenuation file must be a .mat file
    containing a matrix called 'trn' of the same dimensions as the
    sinogram matrix 'counts' in input_file.mat. All that cbp does
    is to divide counts(i,j)/trn(i,j) before backprojection.
   
The reconstruction always produces a square image.
The field of view of the reconstruction is the same as the
range of displacements of the projections arrays.





IV. DATA INPUT/OUTPUT FORMAT
---------------------------------------------------

a. INPUT:
-----------------------
The input-file.mat must contain the following variables
which should all be of type double in matlab


variable      size         description
--------------------------------------------
n_t            1x1         number of displacements in proj. data

n_theta        1x1         number of projection angles

counts       n_t*n_theta   array of projection data 
                             (can be non-integer values)

delta_t        1x1         physical distance in displacement
                           between two adjacent projections

delta_theta    1x1         increment in rpoj. angle, should be
                           delta_theta = pi/n_theta

theta_0        1x1         first projection angle, i.e. of projections
                           counts(*,1)

t_0            1x1         physical displacement of first projection
                           counts(1,*). Must be NEGATIVE value.
                           Assuming even number of displacements 
                           symmetric about the center, must have
                           t_0 = - delta_t*(n_t-1)/2

scatter        1x1         NOT USED BY cbp.

The attenuation correction file, if used, must contain
a matrix called trn with same dimensions as the counts matrix.
All that cbp does, is divide counts by trn (setting trn entries that
are zero to one).

b. OUTPUT
-------------------------

output-file.mat will contain a matrix called img that 
contains the reconstructed image.







V. EXAMPLE
---------------------------------
The EXAMPLE subdirectory contains a file with simulated
emission data and a few different example of reconstruction
commands using the cbp routines. 
For reference, the directory also contains the output 
files that you should be getting when running the examples. 


