/*****************************************************************************
-** This is part of the CTSim program
-** Copyright (C) 1983-2000 Kevin Rosenberg
-**
-** $Id: ir.h,v 1.10 2000/05/04 18:16:34 kevin Exp $
-** $Log: ir.h,v $
-** Revision 1.10 2000/05/04 18:16:34 kevin
-** renamed filter definitions
-**
-** Revision 1.9 2000/05/04 04:29:18 kevin
-** *** empty log message ***
-**
-** Revision 1.8 2000/05/04 04:25:55 kevin
-** Renamed phantom and phantom-element functions/variables
-**
-** Revision 1.7 2000/05/03 19:51:41 kevin
-** function renaming for phantoms and phantom elements
+** FILE IDENTIFICATION
**
-** Revision 1.6 2000/05/03 08:49:49 kevin
-** Code cleanup
+** Name: ir.h
+** Purpose: Master Image Reconstruction Header
+** Programmer: Kevin Rosenberg
+** Date Started: July 1, 1984
**
-** Revision 1.5 2000/05/02 20:00:25 kevin
-** *** empty log message ***
-**
-** Revision 1.4 2000/05/02 15:31:39 kevin
-** code cleaning
-**
-** Revision 1.3 2000/04/29 23:24:29 kevin
-** *** empty log message ***
-**
-** Revision 1.2 2000/04/28 14:14:16 kevin
-** *** empty log message ***
-**
-** Revision 1.1.1.1 2000/04/28 13:02:43 kevin
-** Initial CVS import for first public release
+** This is part of the CTSim program
+** Copyright (C) 1983-2000 Kevin Rosenberg
**
+** $Id: ir.h,v 1.27 2000/06/15 19:07:10 kevin Exp $
**
**
** This program is free software; you can redistribute it and/or modify
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
-/* FILE IDENTIFICATION
- *
- * Name: ir.h Header File for Image Reconstruction System
- * Programmer: Kevin Rosenberg
- * Date Started: 7-1-84
- * Last Change: 1-20-85
- */
#ifndef IR_H
#define IR_H
-#ifdef MPI_CT
-#define MPI_MAX_PROCESS 128
-struct mpi_ct_st
-{
- int my_rank;
- int nproc;
- int base_local_work_units;
- int remainder_work_units;
- int local_work_units[MPI_MAX_PROCESS];
- int start_work_unit[MPI_MAX_PROCESS];
- MPI_Comm comm;
-};
-
-extern struct mpi_ct_st mpi_ct;
-void mpi_ct_calc_work_units(const unsigned int global_work_units);
-#endif
-
-
-struct histo_st {
- int *b; /* Histogram array (# of elements in each bin) */
- int nbin; /* Number of histogram bins */
- double xmin, xmax, xinc; /* Limits of histogram boundaries */
-};
-
-typedef struct histo_st HISTOGRAM;
-/*---------------------------------------------------------------------------*/
+#include "phantom.h"
-#define POINTS_PER_CIRCLE 36
-
-#define MAXREMARK 99
-#define LENREMARK (MAXREMARK+1)
-#define IMAGE_VAL FMTX_2D /* use 2d floating point matrix */
-#define IMAGE_ELEM_TYPE DT_FLOAT /* use floats for images */
-typedef float IMAGE_ELEM_VAL; /* use floats for image storing */
-
-struct image_st {
- IMAGE_VAL v; /* values of voxels in matrix form */
- SDF_2D *dfp_2d; /* Pointer to disk image file */
- int nx, ny; /* size of voxel matrix */
- double xmin, xmax, ymin, ymax; /* extent of voxel matrix in phm coord */
- char remark[LENREMARK]; /* description of voxel data */
- float calctime; /* time to calculate voxels in seconds */
-};
-
-struct phmelm_st {
- int type; /* phmelm type (box, ellipse, etc) */
- double atten; /* X-ray attenuation coefficient */
- double cx,cy; /* center of phmelm */
- double u,v; /* size of phmelm */
- double rot; /* phmelm rotation angle (in radians) */
- double *x, *y; /* ptr to array of points in obj world coord */
- int pts; /* number of points in outline arrays */
- double xmin, xmax, ymin, ymax; /* phmelm limits */
- double radius; /* " */
- struct { /* transform matrices */
- GRFMTX_2D p_to_o; /* map from phantom to standard phmelm coords */
- GRFMTX_2D o_to_p; /* map from std phmelm coords to phantom coords */
- } xform;
- struct phmelm_st *next; /* pointer to next phmelm in phantom */
-};
-
-typedef struct phmelm_st PHMELM;
-
-struct phm_st { /* Phantom structure */
- PHMELM *phmelm_list; /* phmelm linked-list */
- int type;
- int n_pelm; /* number of phmelms in phantom */
- double xmin, xmax, ymin, ymax; /* extent of phmelms in phmelm coordinates */
- double radius; /* " " */
-};
-
-typedef struct image_st IMAGE;
-typedef struct phm_st PHANTOM;
-
-#define P_PHMELMS 0 /* Phantom made of phmelms */
-#define P_UNIT_PULSE 1 /* Special PHANTOM, not made of phmelms */
-#define P_FILTER 9 /* defined only by a type */
/*----------------------------------------------------------------------*/
/* RAYSUM SYMBOLS */
* for these detectors is stored in the structure DETECTARRAY
*/
-#define DETECT_TYPE float
+typedef float DETECT_TYPE;
-struct detarray_st {
+struct DetectorArray
+{
DETECT_TYPE *detval; /* Pointer to array of values recorded by detector */
int ndet; /* Number of detectors in array */
double view_angle; /* View angle in radians */
};
+typedef struct DetectorArray DETARRAY;
+
-#define DETECTOR_PARALLEL 1
-#define DETECTOR_EQUIANGLE 2
-#define DETECTOR_EQUILINEAR 3
+typedef enum {
+ DETECTOR_PARALLEL,
+ DETECTOR_EQUIANGLE,
+ DETECTOR_EQUILINEAR
+} ScannerGeometry;
+
-struct detector_st {
- int geometry; /* Geometry of detectory */
+class Detector
+{
+ public:
+ ScannerGeometry geometry; /* Geometry of detectory */
int ndet; /* Number of detectors in array */
int nview; /* Number of rotated views */
int nsample; /* Number of rays per detector */
double rot_inc; /* Increment in rotation angle between views */
double radius; /* Radius of rotation. Distance from */
/* center of phm to center of det */
- double phmlen; /* Maximum Length of PHANTOM or area of interest */
+ double phmlen; /* Maximum Length of phantom or area of interest */
struct {
double xd1,yd1,xd2,yd2; /* Coordinates of detector endpoints */
double xs1,ys1,xs2,ys2; /* Coordinates of source endpoints */
double angle; /* Starting angle */
} init;
+
+ Detector (const Phantom& phm, const ScannerGeometry geometry, int ndet, int nview, int nsample, const double rot_anglen);
+ ~Detector();
+
};
-struct raysum_st {
- int fd;
- int file_mode;
- int header_size;
- int geometry;
- struct detarray_st **view; /* Pointer to array of detarray_st pointers */
- char remark[LENREMARK]; /* description of raysum data */
+class Projections
+{
+ public:
+ int fd; /* Disk file descriptor */
+ int file_mode; /* Current file mode (read or write) */
+ int header_size; /* Size of disk file header */
+ int geometry; /* Geometry of scanner */
+ struct DetectorArray **view; /* Pointer to array of detarray_st pointers */
+
+ string remark; /* description of raysum data */
double calctime; /* time required to calculate raysums */
int ndet; /* number of detectors in array */
double det_inc; /* increment between detectors */
double phmlen; /* Length of PHANTOM edge (phm is square) */
};
-
-typedef struct detarray_st DETARRAY;
-typedef struct detector_st DETECTOR;
-typedef struct raysum_st RAYSUM;
+typedef class Projections RAYSUM;
/*----------------------------------------------------------------------*/
/* USER SYMBOLS */
/*----------------------------------------------------------------------*/
-/* codes for phmelm types, passed to add_obj() */
-
-#define O_RECTANGLE 1
-#define O_TRIANGLE 2
-#define O_ELLIPSE 3
-#define O_SECTOR 4
-#define O_SEGMENT 5
-
-/* Codes for Coordinate Types */
-/* Defines coords for pelm_is_point_inside() */
-
-#define PELM_COORD -1 /* Normalized Phmelm Coordinates */
-#define PHM_COORD -2 /* User's PHANTOM Coordinates */
-
/* Codes for Filter types */
-#define FILTER_BANDLIMIT 1 /* filter types for genfilter() */
-#define FILTER_SINC 2
-#define FILTER_G_HAMMING 3
-#define FILTER_COSINE 4
-#define FILTER_TRIANGLE 5
-#define FILTER_ABS_BANDLIMIT 11 /* filters times abs() of function */
-#define FILTER_ABS_SINC 12
-#define FILTER_ABS_G_HAMMING 13
-#define FILTER_ABS_COSINE 14
-#define FILTER_SHEPP 21
+typedef enum { /* filter types for filter_generate() */
+ FILTER_BANDLIMIT,
+ FILTER_SINC,
+ FILTER_G_HAMMING,
+ FILTER_COSINE,
+ FILTER_TRIANGLE,
+ FILTER_ABS_BANDLIMIT, /* filter times |x| */
+ FILTER_ABS_SINC,
+ FILTER_ABS_G_HAMMING,
+ FILTER_ABS_COSINE,
+ FILTER_SHEPP
+} FilterType;
/* function domains */
-#define O_FREQ_STR "freq"
-#define O_SPATIAL_STR "spatial"
+static const char D_FREQ_STR[]= "freq";
+static const char D_SPATIAL_STR[]= "spatial";
-#define D_FREQ 1 /* Domain names */
-#define D_SPATIAL 2
+typedef enum {
+ D_FREQ = 1,
+ D_SPATIAL
+} DomainType;
-/* function symmetry */
-
-#define FUNC_EVEN 1 /* function types, f[-n] = f[n] */
-#define FUNC_ODD 2 /* f[-n] = -f[n] */
-#define FUNC_BOTH 3 /* function has both odd & even components */
+typedef enum {
+ FUNC_EVEN = 1, /* function types, f[-n] = f[n] */
+ FUNC_ODD, /* f[-n] = -f[n] */
+ FUNC_BOTH /* function has both odd & even components */
+} FunctionSymmetry;
/* interpolation methods */
-
-#define I_NEAREST 1 /* Interpolation methods */
-#define I_LINEAR 2 /* Linear interpolation */
-#define I_BSPLINE 3
-#define I_1BSPLINE 3 /* 1st order B-Spline */
-#define I_2BSPLINE 4
-#define I_3BSPLINE 5
-
-/* Constants for sizing PHANTOM */
-
-#define PERCENT_PHM_SIZE_INCR 0.0 /* Fractional increase in PHANTOM */
- /* limits compared to phmelm size */
-#define N_EXTRA_DETECTORS 4 /* Number of extra detectors */
- /* widths when calculating detlen */
-
-#define O_TRACE_NONE_STR "none"
-#define O_TRACE_TEXT_STR "text"
-#define O_TRACE_PHM_STR "phm"
-#define O_TRACE_RAYS_STR "rays"
-#define O_TRACE_PLOT_STR "plot"
-#define O_TRACE_CLIPPING_STR "clipping"
-
-
-#define TRACE_NONE 0 /* No tracing */
-#define TRACE_TEXT 1 /* Minimal status */
-#define TRACE_PHM 2 /* Show PHANTOM */
-#define TRACE_RAYS 3 /* Show all rays */
-#define TRACE_PLOT 4 /* Plot raysums */
-#define TRACE_CLIPPING 5 /* Plot clipping */
-
-#define O_PHM_HERMAN 1 /* Herman head phantom */
-#define O_PHM_ROWLAND 2 /* Rowland head phantom */
-#define O_PHM_BROWLAND 3 /* Bordered Rowland head phantom */
-#define O_PHM_UNITPULSE 4 /* Unit pulse phantom */
-
-#define O_PHM_HERMAN_STR "herman"
-#define O_PHM_ROWLAND_STR "rowland"
-#define O_PHM_BROWLAND_STR "browland"
-#define O_PHM_UNITPULSE_STR "unitpulse"
-
-#define O_INTERP_NEAREST_STR "nearest"
-#define O_INTERP_LINEAR_STR "linear"
-#define O_INTERP_BSPLINE_STR "bspline"
-
-#define O_FILTER_ABS_BANDLIMIT_STR "abs_bandlimit"
-#define O_FILTER_ABS_SINC_STR "abs_sinc"
-#define O_FILTER_ABS_COS_STR "abs_cos"
-#define O_FILTER_ABS_HAMMING_STR "abs_hamming"
-#define O_FILTER_SHEPP_STR "shepp"
-#define O_FILTER_BANDLIMIT_STR "bandlimit"
-#define O_FILTER_SINC_STR "sinc"
-#define O_FILTER_COS_STR "cos"
-#define O_FILTER_HAMMING_STR "hamming"
-#define O_FILTER_TRIANGLE_STR "triangle"
-
-#define O_BPROJ_TRIG 1
-#define O_BPROJ_TABLE 2
-#define O_BPROJ_DIFF 3
-#define O_BPROJ_DIFF2 4
-#define O_BPROJ_IDIFF2 5
-
-#define O_BPROJ_TRIG_STR "trig"
-#define O_BPROJ_TABLE_STR "table"
-#define O_BPROJ_DIFF_STR "diff"
-#define O_BPROJ_DIFF2_STR "diff2"
-#define O_BPROJ_IDIFF2_STR "idiff2"
-
-#define RAYSUM_TRACE_ROW_TITLE 1
-#define RAYSUM_TRACE_ROW_TITLE2 2
-#define RAYSUM_TRACE_ROW_PHANT_ID 4
-#define RAYSUM_TRACE_ROW_CHROMATIC 7
-#define RAYSUM_TRACE_ROW_SCATTER 8
-#define RAYSUM_TRACE_ROW_PHOT_STAT 9
-#define RAYSUM_TRACE_ROW_NDET 12
-#define RAYSUM_TRACE_ROW_NVIEW 13
-#define RAYSUM_TRACE_ROW_SAMPLES 14
-#define RAYSUM_TRACE_ROW_CURR_VIEW 17
-#define RAYSUM_TRACE_ROW_ATTEN 18
-
-
-/*----------------------------------------------------------------------*/
-/* GRAY SCALE STRUCTURES */
-/*----------------------------------------------------------------------*/
-
-#define GS_MAX_CELL_SIZE 4
-
-typedef int GS_BITMASK[4][4];
-
-struct greyscale_st {
- int dev; /* Device to output to */
- int (*dotfunc)(int x, int y, int color); /* Pointer to dot function for device */
- int cur_x, cur_y; /* Current cell location */
- int nxcell, nycell; /* size of cell in pixels */
- int xmin, ymin; /* starting position of grey scale */
- int num_color; /* Number of primary colors available */
- int num_intens; /* Number of intensities available */
- int max_level; /* gs levels range from 0 to max_level */
- char *fg_color_tbl; /* Hold foreground color for each level */
- char *bg_color_tbl; /* Holds background color */
- char *level_sub_tbl; /* Holds value to subtract for level */
- /* before accessing bit mask */
- GS_BITMASK *bm; /* Holds grey-scale bit mask */
- struct greyscale_st *next_dev; /* Pointer to next open device */
- /* == NULL when no more devices */
+#undef HAVE_BSPLINE_INTERP
+typedef enum { /* Interpolation methods */
+ I_NEAREST = 1, /* Nearest neighbor */
+#if HAVE_BSPLINE_INTERP
+ I_BSPLINE,
+ I_1BSPLINE, /* 1st order B-Spline */
+ I_2BSPLINE,
+ I_3BSPLINE,
+#endif
+ I_LINEAR /* Linear interpolation */
+} InterpolationType;
+
+static const int N_EXTRA_DETECTORS=4; /* Number of extra detectors widths when calculating detlen */
+
+static const char O_TRACE_NONE_STR[]= "none";
+static const char O_TRACE_TEXT_STR[]= "text";
+static const char O_TRACE_PHM_STR[]= "phm";
+static const char O_TRACE_RAYS_STR[]= "rays";
+static const char O_TRACE_PLOT_STR[]= "plot";
+static const char O_TRACE_CLIPPING_STR[]= "clipping";
+
+enum {
+ TRACE_NONE, /* No tracing */
+ TRACE_TEXT, /* Minimal status */
+ TRACE_PHM, /* Show phantom */
+ TRACE_RAYS, /* Show all rays */
+ TRACE_PLOT, /* Plot raysums */
+ TRACE_CLIPPING /* Plot clipping */
};
-typedef struct greyscale_st GREYSCALE;
-
-
-/* From reconstr.c */
-IMAGE *image_reconst (IMAGE *im, RAYSUM *rs, int filt_type, double filt_param, int interp_type, int interp_param, const int backproj_type, int ir_trace);
-
-/* From bproj.c */
-void backproj_init (const RAYSUM *rs, IMAGE *im, const int bproj_method);
-int backproj_calc (const RAYSUM *rs, IMAGE *im, const double *t, const double view_angle,
- const int interp_type, const int bproj_method);
-void backproj_term (const RAYSUM *rs, IMAGE *im, const int bproj_method);
-
-void backproj_init_trig (const RAYSUM *rs, IMAGE *im);
-int backproj_calc_trig (const RAYSUM *rs, IMAGE *im, const double *t,
- const double view_angle, const int interp_type);
-void backproj_term_trig (const RAYSUM *rs, IMAGE *im);
-void backproj_init_table (const RAYSUM *rs, IMAGE *im);
-int backproj_calc_table (const RAYSUM *rs, IMAGE *im, const double *t,
- const double view_angle, const int interp_type);
-void backproj_term_table (const RAYSUM *rs, IMAGE *im);
-void backproj_init_d (const RAYSUM *rs, IMAGE *im);
-int backproj_calc_d (const RAYSUM *rs, IMAGE *im, const double *t,
- const double view_angle, const int interp_type);
-void backproj_term_d (const RAYSUM *rs, IMAGE *im);
-void backproj_init_d2 (const RAYSUM *rs, IMAGE *im);
-int backproj_calc_d2 (const RAYSUM *rs, IMAGE *im, const double *t,
- const double view_angle, const int interp_type);
-void backproj_term_d2 (const RAYSUM *rs, IMAGE *im);
-void backproj_init_id (const RAYSUM *rs, IMAGE *im);
-int backproj_calc_id (const RAYSUM *rs, IMAGE *im, const double *t,
- const double view_angle, const int interp_type);
-void backproj_term_id (const RAYSUM *rs, IMAGE *im);
-void backproj_init_id2 (const RAYSUM *rs, IMAGE *im);
-int backproj_calc_id2 (const RAYSUM *rs, IMAGE *im, const double *t,
- const double view_angle, const int interp_type);
-void backproj_term_id2 (const RAYSUM *rs, IMAGE *im);
-
-void usage (const char *program);
-int main(const int argc, char * const argv[]);
-
-
-
-/* bspline.c */
-int bspline(int samples, int zoom_factor, int spline_order, double input[], double output[]);
-
-/* convolve.c */
-double convolve(const double f1[], const double f2[], const double dx, const int n, const int np, const int func_type);
-double convolve_both(const double f1[], const double f2[], const double dx, const int n, const int np);
-
-/* dialogs.c */
-int phm_add_pelm_kb(PHANTOM *phm);
-PHANTOM *phm_select(void);
-int interpolation_select(void);
-int filter_select(double *filter_param);
-
-/* filter.c */
-double *filter_generate(int filt_type, double bw, double xmin, double xmax, int n, double param, int domain, int numint);
-double filter_spatial_response_calc(int filt_type, double x, double bw, double param, int n);
-double filter_spatial_response_analytic(int filt_type, double x, double bw, double param);
-double filter_frequency_response(int filt_type, double u, double bw, double param);
-double sinc(double x, double mult);
+typedef enum {
+ O_PHM_HERMAN, /* Herman head phantom */
+ O_PHM_ROWLAND, /* Rowland head phantom */
+ O_PHM_BROWLAND, /* Bordered Rowland head phantom */
+ O_PHM_UNITPULSE /* Unit pulse phantom */
+} PhantomType;
+
+static const char O_PHM_HERMAN_STR[]= "herman";
+static const char O_PHM_ROWLAND_STR[]= "rowland";
+static const char O_PHM_BROWLAND_STR[]= "browland";
+static const char O_PHM_UNITPULSE_STR[]= "unitpulse";
+
+static const char O_INTERP_NEAREST_STR[]= "nearest";
+static const char O_INTERP_LINEAR_STR[]= "linear";
+static const char O_INTERP_BSPLINE_STR[]= "bspline";
+
+static const char O_FILTER_ABS_BANDLIMIT_STR[]= "abs_bandlimit";
+static const char O_FILTER_ABS_SINC_STR[]= "abs_sinc";
+static const char O_FILTER_ABS_COS_STR[]= "abs_cos";
+static const char O_FILTER_ABS_HAMMING_STR[]= "abs_hamming";
+static const char O_FILTER_SHEPP_STR[]= "shepp";
+static const char O_FILTER_BANDLIMIT_STR[]= "bandlimit";
+static const char O_FILTER_SINC_STR[]= "sinc";
+static const char O_FILTER_COS_STR[]= "cos";
+static const char O_FILTER_HAMMING_STR[]= "hamming";
+static const char O_FILTER_TRIANGLE_STR[]= "triangle";
+
+typedef enum {
+ O_BPROJ_TRIG,
+ O_BPROJ_TABLE,
+ O_BPROJ_DIFF,
+ O_BPROJ_DIFF2,
+ O_BPROJ_IDIFF2
+} BackprojType;
+
+static const char O_BPROJ_TRIG_STR[]= "trig";
+static const char O_BPROJ_TABLE_STR[]= "table";
+static const char O_BPROJ_DIFF_STR[]= "diff";
+static const char O_BPROJ_DIFF2_STR[]= "diff2";
+static const char O_BPROJ_IDIFF2_STR[]= "idiff2";
+
+const static int RAYSUM_TRACE_ROW_TITLE=1;
+const static int RAYSUM_TRACE_ROW_TITLE2=2;
+const static int RAYSUM_TRACE_ROW_PHANT_ID=4;
+const static int RAYSUM_TRACE_ROW_CHROMATIC=7;
+const static int RAYSUM_TRACE_ROW_SCATTER=8;
+const static int RAYSUM_TRACE_ROW_PHOT_STAT=9;
+const static int RAYSUM_TRACE_ROW_NDET=12;
+const static int RAYSUM_TRACE_ROW_NVIEW=13;
+const static int RAYSUM_TRACE_ROW_SAMPLES=14;
+const static int RAYSUM_TRACE_ROW_CURR_VIEW=17;
+const static int RAYSUM_TRACE_ROW_ATTEN=18;
+
+
+
+/*************************************************************************
+ * FUNCTION DECLARATIONS
+ ************************************************************************/
+
+/* convolve.cpp */
+double convolve (const double f1[], const double f2[], const double dx, const int n, const int np, const FunctionSymmetry func_type);
+
+/* dialogs.cpp */
+bool phm_add_pelem_kb (Phantom& phm);
+const Phantom& phm_select (Phantom& phm);
+int interpolation_select (void);
+int filter_select (double *filter_param);
+
+/* filter.cpp */
+double *filter_generate (const FilterType filt_type, double bw, double xmin, double xmax, int n, double param, const DomainType domain, int numint);
+double filter_spatial_response_calc (int filt_type, double x, double bw, double param, int n);
+double filter_spatial_response_analytic (int filt_type, double x, double bw, double param);
+double filter_frequency_response (int filt_type, double u, double bw, double param);
+double sinc (double x, double mult);
double integral_abscos(double u, double w);
-/* image.c */
-IMAGE *image_create(const char *fname, const int nx, const int ny);
-int image_clear(IMAGE *im);
-int image_save(IMAGE *im);
-IMAGE *image_load(const char *fname);
-void image_filter_response(IMAGE *im, int domain, double bw, int filt_type, double filt_param, int opt_trace);
-
-/* options.c */
-int opt_set_trace(const char *optarg, const char *program);
+/* options.cpp */
+int opt_set_trace(const char *optarg);
const char *name_of_phantom(const int phmid);
-int opt_set_phantom(const char *optarg, const char *program);
-int opt_set_interpolation(const char *optarg, const char *program);
+int opt_set_phantom(const char *optarg);
+InterpolationType opt_set_interpolation(const char *optarg);
const char *name_of_interpolation(int interp_type);
-int opt_set_filter(const char *optarg, const char *program);
+FilterType opt_set_filter(const char *optarg);
const char *name_of_filter(const int filter);
-int opt_set_filter_domain(const char *optarg, const char *program);
-const char *name_of_filter_domain(const int domain);
-int opt_set_backproj(const char *optarg, const char *program);
-const char *name_of_backproj(const int backproj);
-
-/* phm.c */
-PHANTOM *phm_create(const int phmid);
-PHANTOM *phm_create_from_file(const char *fname);
-PHANTOM *phm_init(void);
-int phm_add_pelm_file(PHANTOM *phm, const char *fname);
-void phm_add_pelm (PHANTOM *phm, const int type, const double cx, const double cy,
- const double u, const double v, const double rot, const double atten);
-int pelm_make_points(PHMELM *obj);
-void pelm_make_xform (PHMELM *obj);
-PHMELM *pelm_alloc(void);
-void calc_arc(double x[], double y[], const int pts, const double xcent, const double ycent,
- const double r, const double start, const double stop);
-void calc_ellipse(double x[], double y[], const int pts, const double u, const double v);
-int circle_pts(double theta);
-void phm_print(PHANTOM *phm);
-#if HAVE_INTERACTIVE_GRAPHICS
-void phm_show(const PHANTOM *phm);
-void phm_draw(const PHANTOM *phm);
-#endif
-
-/* phm2image.c */
-void phm_to_image(const PHANTOM *phm, IMAGE *im, const int col_start, const int col_count,
- const int nsample, const int trace);
-int pelm_is_point_inside(const PHMELM *obj, double x, double y, const int coord_type);
-
-/* phmstd.c */
-void phm_std_herman (PHANTOM *phm);
-void phm_std_rowland (PHANTOM *phm);
-void phm_std_rowland_bordered (PHANTOM *phm);
-
-/* raycollect.c */
-int raysum_collect(RAYSUM *rs, const DETECTOR *det, const PHANTOM *phm, const int start_view, const int trace, const int unit_pulse);
-void rayview(const PHANTOM *phm, DETARRAY *darray, const DETECTOR *det, const double xd1, const double yd1, const double xd2, const double yd2, const double xs1, const double ys1, const double xs2, const double ys2, const int unit_pulse);
-double phm_ray_attenuation (const PHANTOM *phm, const double x1, const double y1, const double x2, const double y2);
-double pelm_ray_attenuation (const PHMELM *obj, const double x1, const double y1, const double x2, const double y2);
-int pelm_clip_line (const PHMELM *obj, double *x1, double *y1, double *x2, double *y2);
+DomainType opt_set_filter_domain(const char *optarg);
+const char *name_of_filter_domain(const DomainType domain);
+BackprojType opt_set_backproj(const char *optarg);
+const char *name_of_backproj(const BackprojType backproj);
+
+/* raycollect.cpp */
+int raysum_collect (RAYSUM *rs, const Detector& det, const Phantom& phm, const int start_view, const int trace, const int unit_pulse);
+void rayview (const Phantom& phm, DETARRAY *darray, const Detector& det, const double xd1, const double yd1, const double xd2, const double yd2, const double xs1, const double ys1, const double xs2, const double ys2, const int unit_pulse);
+double phm_ray_attenuation (const Phantom& phm, const double x1, const double y1, const double x2, const double y2);
+double pelem_ray_attenuation (PhantomElement& pelem, const double x1, const double y1, const double x2, const double y2);
void raysum_trace_show_param (const char *label, const char *fmt, int row, int color, ...);
-/* scanner.c */
-DETECTOR *detector_create(const PHANTOM *phm, int geometry, int ndet, int nview, int nsample, const double rot_anglen);
-void detector_free(DETECTOR *det);
-
-/* rayio.c */
+/* rayio.cpp */
RAYSUM *raysum_create(const char *fname, const int nview, const int ndet);
-RAYSUM *raysum_create_from_det(const char *fname, const DETECTOR *det);
+RAYSUM *raysum_create_from_det(const char *fname, const Detector& det);
RAYSUM *raysum_open(const char *filename);
void raysum_alloc_views(RAYSUM *rs);
void raysum_free(RAYSUM *rs);
int raysum_write_header(RAYSUM *rs);
int raysum_read(RAYSUM *rs);
int raysum_write(RAYSUM *rs);
+void raysum_print(const RAYSUM *rs);
+void raysum_print_info(const RAYSUM *rs);
DETARRAY *detarray_alloc(const int n);
void detarray_free(DETARRAY *darray);
int detarray_read(RAYSUM *rs, DETARRAY *darray, const int view_num);
int detarray_write(RAYSUM *rs, const DETARRAY *darray, const int view_num);
-int raysum_print(const RAYSUM *rs);
+
+/* From phm2image.cpp */
+void phm_to_imagefile (const Phantom& phm, ImageFile& im, const int col_start, const int col_count, const int nsample, const int trace);
+
+/* image.cpp */
+void image_filter_response(ImageFile& im, const DomainType domain, double bw, const FilterType filt_type, double filt_param, const int opt_trace);
+int image_display (const ImageFile& im);
+int image_display_scale (const ImageFile& im, const int scale, const double pmin, const double pmax);
+
+/* From reconstr.cpp */
+ImageFile& proj_reconst (ImageFile& im, RAYSUM *rs, const FilterType filt_type, double filt_param, InterpolationType interp_type, int interp_param, const BackprojType backproj_type, int const ir_trace);
+
+/* From bproj.cpp */
+void backproj_init (const RAYSUM *rs, ImageFile& im, const BackprojType bproj_method);
+int backproj_calc (const RAYSUM *rs, ImageFile& im, const double *t, const double view_angle, const int interp_type, const int bproj_method);
+void backproj_term (const RAYSUM *rs, ImageFile& im, const int bproj_method);
+
+void backproj_init_trig (const RAYSUM *rs, ImageFile& im);
+int backproj_calc_trig (const RAYSUM *rs, ImageFile& im, const double *t,
+ const double view_angle, const int interp_type);
+void backproj_term_trig (const RAYSUM *rs, ImageFile& im);
+void backproj_init_table (const RAYSUM *rs, ImageFile& im);
+int backproj_calc_table (const RAYSUM *rs, ImageFile& im, const double *t,
+ const double view_angle, const int interp_type);
+void backproj_term_table (const RAYSUM *rs, ImageFile& im);
+void backproj_init_d (const RAYSUM *rs, ImageFile& im);
+int backproj_calc_d (const RAYSUM *rs, ImageFile& im, const double *t,
+ const double view_angle, const int interp_type);
+void backproj_term_d (const RAYSUM *rs, ImageFile& im);
+void backproj_init_d2 (const RAYSUM *rs, ImageFile& im);
+int backproj_calc_d2 (const RAYSUM *rs, ImageFile& im, const double *t,
+ const double view_angle, const int interp_type);
+void backproj_term_d2 (const RAYSUM *rs, ImageFile& im);
+void backproj_init_id (const RAYSUM *rs, ImageFile& im);
+int backproj_calc_id (const RAYSUM *rs, ImageFile& im, const double *t,
+ const double view_angle, const int interp_type);
+void backproj_term_id (const RAYSUM *rs, ImageFile& im);
+void backproj_init_id2 (const RAYSUM *rs, ImageFile& im);
+int backproj_calc_id2 (const RAYSUM *rs, ImageFile& im, const double *t,
+ const double view_angle, const int interp_type);
+void backproj_term_id2 (const RAYSUM *rs, ImageFile& im);
#endif