** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ir.h,v 1.7 2000/05/03 19:51:41 kevin Exp $
+** $Id: ir.h,v 1.9 2000/05/04 04:29:18 kevin Exp $
** $Log: ir.h,v $
+** 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
**
float calctime; /* time to calculate voxels in seconds */
};
-struct phmelem_st {
- int type; /* phmelem type (box, ellipse, etc) */
+struct phmelm_st {
+ int type; /* phmelm type (box, ellipse, etc) */
double atten; /* X-ray attenuation coefficient */
- double cx,cy; /* center of phmelem */
- double u,v; /* size of phmelem */
- double rot; /* phmelem rotation angle (in radians) */
+ 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; /* phmelem limits */
+ double xmin, xmax, ymin, ymax; /* phmelm limits */
double radius; /* " */
struct { /* transform matrices */
- GRFMTX_2D p_to_o; /* map from phantom to standard phmelem coords */
- GRFMTX_2D o_to_p; /* map from std phmelem coords to phantom coords */
+ 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 phmelem_st *next; /* pointer to next phmelem in phantom */
+ struct phmelm_st *next; /* pointer to next phmelm in phantom */
};
-typedef struct phmelem_st PHMELEM;
+typedef struct phmelm_st PHMELM;
struct phm_st { /* Phantom structure */
- PHMELEM *objlist; /* phmelem list */
+ PHMELM *phmelm_list; /* phmelm linked-list */
int type;
- int n_pelem; /* number of phmelems in phantom */
- double xmin, xmax, ymin, ymax; /* extent of phmelems in phmelem coordinates */
+ 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_PHMELEMS 0 /* PHANTOM made of phmelems */
-#define P_UNIT_PULSE 1 /* Special PHANTOM, not made of phmelems */
+#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 */
/*----------------------------------------------------------------------*/
/* USER SYMBOLS */
/*----------------------------------------------------------------------*/
-/* codes for phmelem types, passed to add_obj() */
+/* codes for phmelm types, passed to add_obj() */
#define O_RECTANGLE 1
#define O_TRIANGLE 2
#define O_SEGMENT 5
/* Codes for Coordinate Types */
-/* Defines coords for inside_obj() */
+/* Defines coords for pelm_is_point_inside() */
-#define OBJ_COORD -1 /* Normalized Phmelem Coordinates */
+#define PELM_COORD -1 /* Normalized Phmelm Coordinates */
#define PHM_COORD -2 /* User's PHANTOM Coordinates */
/* Codes for Filter types */
/* Constants for sizing PHANTOM */
#define PERCENT_PHM_SIZE_INCR 0.0 /* Fractional increase in PHANTOM */
- /* limits compared to phmelem size */
+ /* limits compared to phmelm size */
#define N_EXTRA_DETECTORS 4 /* Number of extra detectors */
/* widths when calculating detlen */
#define O_BPROJ_DIFF2_STR "diff2"
#define O_BPROJ_IDIFF2_STR "idiff2"
-#define RS_TRACE_ROW_TITLE 1
-#define RS_TRACE_ROW_TITLE2 2
-#define RS_TRACE_ROW_PHANT_ID 4
-#define RS_TRACE_ROW_CHROMATIC 7
-#define RS_TRACE_ROW_SCATTER 8
-#define RS_TRACE_ROW_PHOT_STAT 9
-#define RS_TRACE_ROW_NDET 12
-#define RS_TRACE_ROW_NVIEW 13
-#define RS_TRACE_ROW_SAMPLES 14
-#define RS_TRACE_ROW_CURR_VIEW 17
-#define RS_TRACE_ROW_ATTEN 18
+#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
/*----------------------------------------------------------------------*/
/* 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);
void xlat2d(double x[], double y[], int pts, double xoffset, double yoffset);
void scale2d(double x[], double y[], int pts, double xfact, double yfact);
int circle_pts(double theta);
+
/* dialogs.c */
-int phm_add_pelem_kb(PHANTOM *phm);
+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);
-double abscos_int(double u, double w);
+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);
const char *name_of_phantom(const int phmid);
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_pelem_file(PHANTOM *phm, const char *fname);
-void phm_add_pelem (PHANTOM *phm, const int type, const double cx, const double cy,
+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 pelem_make_points(PHMELEM *obj);
-void pelem_make_xform (PHMELEM *obj);
-PHMELEM *pelem_alloc(void);
+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);
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 inside_obj(const PHMELEM *obj, double x, double y, const int coord_type);
+int pelm_is_point_inside(const PHMELM *obj, double x, double y, const int coord_type);
+
/* phmstd.c */
-void herm_head(PHANTOM *phm);
-void row_head(PHANTOM *phm);
-void row_bord_head(PHANTOM *phm);
-/* ray.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);
+void raysum_trace_show_param (const char *label, const char *fmt, int row, int color, ...);
+
+/* scanner.c */
DETECTOR *detect_create(const PHANTOM *phm, int ndet, int nview, int nsample, const double rot_anglen);
void detect_free(DETECTOR *det);
-double calc_rsum(const PHANTOM *phm, const double x1, const double y1, const double x2, const double y2);
-double calc_objsum(const PHMELEM *obj, const double x1, const double y1, const double x2, const double y2);
-int clipobj(const PHMELEM *obj, double *x1, double *y1, double *x2, double *y2);
-/* 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);
-void rs_trace_showprm (const char *label, const char *fmt, int row, int color, ...);
+
/* rayio.c */
RAYSUM *raysum_create(const char *fname, const int nview, const int ndet);
RAYSUM *raysum_create_from_det(const char *fname, const DETECTOR *det);