From 2f71224f911d19adaa941d7553a9462a1aef7293 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 4 May 2000 18:16:34 +0000 Subject: [PATCH] r38: renamed filter definitions --- ChangeLog | 6 +++- include/ir.h | 74 ++++++++++++++++++++++++------------------------- include/kmath.h | 37 ++++++++++++++++++------- src/ctrec.c | 9 ++++-- src/phm2rs.c | 9 ++++-- 5 files changed, 80 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index e67686f..77f7ebc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,12 @@ +0.5.2-b4 - 5/4/2000 + Renamed pictures to phantoms, objects to phantom elements + Continued code cleanup + 0.5.2-b3 - 4/30/200 More code cleanup with reorganizing libraries Added --log and --exp to sdf-1 Allowed negative numbers for window levels in CGI interface - + 0.5.2-b2 - 4/30/200 Continued code cleanup diff --git a/include/ir.h b/include/ir.h index cd801f3..cae88b6 100644 --- a/include/ir.h +++ b/include/ir.h @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ir.h,v 1.9 2000/05/04 04:29:18 kevin Exp $ +** $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 *** ** @@ -103,30 +106,30 @@ struct image_st { }; 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 */ + 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 */ + 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 */ + 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 */ +struct phm_st { /* Phantom structure */ + PHMELM *phmelm_list; /* phmelm linked-list */ int type; - int n_pelm; /* number of phmelms in phantom */ + int n_pelm; /* number of phmelms in phantom */ double xmin, xmax, ymin, ymax; /* extent of phmelms in phmelm coordinates */ - double radius; /* " " */ + double radius; /* " " */ }; typedef struct image_st IMAGE; @@ -156,7 +159,7 @@ struct detarray_st { #define DETECTOR_EQUIANGLE 2 #define DETECTOR_EQUILINEAR 3 -struct detect_st { +struct detector_st { int geometry; /* Geometry of detectory */ int ndet; /* Number of detectors in array */ int nview; /* Number of rotated views */ @@ -179,6 +182,7 @@ 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 */ @@ -195,7 +199,7 @@ struct raysum_st { }; typedef struct detarray_st DETARRAY; -typedef struct detect_st DETECTOR; +typedef struct detector_st DETECTOR; typedef struct raysum_st RAYSUM; /*----------------------------------------------------------------------*/ @@ -218,18 +222,16 @@ typedef struct raysum_st RAYSUM; /* Codes for Filter types */ -#define W_BANDLIMIT 1 /* filter types for genfilter() */ -#define W_SINC 2 -#define W_G_HAMMING 3 -#define W_COSINE 4 -#define W_TRIANGLE 5 - -#define W_A_BANDLIMIT 11 /* filters times abs() of function */ -#define W_A_SINC 12 -#define W_AG_HAMMING 13 -#define W_A_COSINE 14 - -#define W_SHEPP 21 +#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 /* function domains */ @@ -400,10 +402,6 @@ int bspline(int samples, int zoom_factor, int spline_order, double input[], doub /* 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 rotate2d(double x[], double y[], int pts, double angle); -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_pelm_kb(PHANTOM *phm); @@ -452,6 +450,7 @@ 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); @@ -477,8 +476,8 @@ int pelm_clip_line (const PHMELM *obj, double *x1, double *y1, double *x2, doubl 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); +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 */ RAYSUM *raysum_create(const char *fname, const int nview, const int ndet); @@ -498,5 +497,4 @@ 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); - #endif diff --git a/include/kmath.h b/include/kmath.h index b8b359e..2a81454 100644 --- a/include/kmath.h +++ b/include/kmath.h @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: kmath.h,v 1.6 2000/05/02 20:00:25 kevin Exp $ +** $Id: kmath.h,v 1.7 2000/05/04 18:16:34 kevin Exp $ ** $Log: kmath.h,v $ +** Revision 1.7 2000/05/04 18:16:34 kevin +** renamed filter definitions +** ** Revision 1.6 2000/05/02 20:00:25 kevin ** *** empty log message *** ** @@ -166,37 +169,45 @@ typedef struct matrix_st *MTXP; ))))) */ +/* clip.c */ +int clip_rect(double *x1, double *y1, double *x2, double *y2, const double rect[4]); +int clip_segment(double *x1, double *y1, double *x2, double *y2, const double u, const double v); +int clip_sector(double *x1, double *y1, double *x2, double *y2, const double u, const double v); +int clip_circle(double *x1, double *y1, double *x2, double *y2, const double cx, const double cy, const double radius, double t1, double t2); +int clip_triangle(double *x1, double *y1, double *x2, double *y2, const double u, const double v, const int clip_xaxis); + +/* lnearest.c */ +long int lnearest(double x); + /* minmax.c */ double fmax(const double a, const double b); void minmax_dvector(const double array[], const int pts, double *xmin, double *xmax); -/* cliprect.c */ -int cliprect(double *x1, double *y1, double *x2, double *y2, const double rect[4]); -/* lnearest.c */ -long int lnearest(double x); + /* mtx_disp.c */ void mtx_show(const MTX *mtx); void mtx_prt(const MTX *mtx, FILE *fp); int mtx_prt_elem(const MTX *mtx, FILE *fp, unsigned int x, unsigned int y, unsigned int z); + /* mtx_elem.c */ int mtx_get_elem(const MTX *mtx, MTX_ELEM_VAL *me, const int x, const int y, const int z); int mtx_put_elem(MTX *mtx, const MTX_ELEM_VAL *me, unsigned int x, unsigned int y, unsigned int z); + /* mtx_inp.c */ int mtx_inp_elem(const char *prompt, MTX_ELEM_VAL *mev, const int dtype); + /* mtx_main.c */ MTX *mtx_init(const unsigned int order, const unsigned int elem_type, const unsigned int nx, const unsigned int ny, const unsigned int nz); MTX *mtx_clr(MTX *mtx); int mtx_free(MTX *mtx); int mtx_elem_size(const int dt); int mtx_check(const MTX *mtx, const char *func_name); + /* norm_ang.c */ double norm_ang(double theta); + /* simpson.c */ double simpson(const double xmin, const double xmax, const double *y, const int np); -/* clip.c */ -int clipsegment(double *x1, double *y1, double *x2, double *y2, const double u, const double v); -int clipsector(double *x1, double *y1, double *x2, double *y2, const double u, const double v); -int clipcircle(double *x1, double *y1, double *x2, double *y2, const double cx, const double cy, const double radius, double t1, double t2); -int cliptriangle(double *x1, double *y1, double *x2, double *y2, const double u, const double v, const int clip_xaxis); + /* xform.c */ void indent_mtx2(GRFMTX_2D m); void xlat_mtx2(GRFMTX_2D m, const double x, const double y); @@ -204,5 +215,11 @@ void scale_mtx2(GRFMTX_2D m, const double sx, const double sy); void rot_mtx2(GRFMTX_2D m, const double theta); void mult_mtx2(GRFMTX_2D m1, GRFMTX_2D m2, GRFMTX_2D result); void xform_mtx2(GRFMTX_2D const m, double *x, double *y); +void rotate2d(double x[], double y[], int pts, double angle); +void xlat2d(double x[], double y[], int pts, double xoffset, double yoffset); +void scale2d(double x[], double y[], int pts, double xfact, double yfact); + + + #endif diff --git a/src/ctrec.c b/src/ctrec.c index 8b66459..fb23af9 100644 --- a/src/ctrec.c +++ b/src/ctrec.c @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctrec.c,v 1.7 2000/05/03 08:49:50 kevin Exp $ +** $Id: ctrec.c,v 1.8 2000/05/04 18:16:34 kevin Exp $ ** $Log: ctrec.c,v $ +** Revision 1.8 2000/05/04 18:16:34 kevin +** renamed filter definitions +** ** Revision 1.7 2000/05/03 08:49:50 kevin ** Code cleanup ** @@ -144,7 +147,7 @@ main (const int argc, char *const argv[]) int opt_debug = 0; int opt_trace = TRACE_NONE; double opt_filter_param = 1; - int opt_filter = W_A_BANDLIMIT; + int opt_filter = FILTER_ABS_BANDLIMIT; int opt_interp = I_LINEAR; int opt_interp_param = 1; int opt_backproj = O_BPROJ_DIFF2; @@ -242,7 +245,7 @@ main (const int argc, char *const argv[]) nx = strtol(argv[optind + 2], &endptr, 10); ny = strtol(argv[optind + 3], &endptr, 10); - if (opt_filter == W_G_HAMMING || opt_filter == W_AG_HAMMING) + if (opt_filter == FILTER_G_HAMMING || opt_filter == FILTER_ABS_G_HAMMING) sprintf (filt_name, "%s: alpha = %.2f", name_of_filter (opt_filter), opt_filter_param); else diff --git a/src/phm2rs.c b/src/phm2rs.c index 3c4217d..6076995 100644 --- a/src/phm2rs.c +++ b/src/phm2rs.c @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phm2rs.c,v 1.7 2000/05/03 08:49:50 kevin Exp $ +** $Id: phm2rs.c,v 1.8 2000/05/04 18:16:34 kevin Exp $ ** $Log: phm2rs.c,v $ +** Revision 1.8 2000/05/04 18:16:34 kevin +** renamed filter definitions +** ** Revision 1.7 2000/05/03 08:49:50 kevin ** Code cleanup ** @@ -293,7 +296,7 @@ main (const int argc, char *const argv[]) #endif opt_rotangle *= PI; - det = detect_create (phm, opt_ndet, opt_nview, opt_nray, opt_rotangle); + det = detector_create (phm, DETECTOR_PARALLEL, opt_ndet, opt_nview, opt_nray, opt_rotangle); #ifdef MPI_CT mpi_ct_calc_work_units(opt_nview); @@ -363,7 +366,7 @@ main (const int argc, char *const argv[]) raysum_close (rs_global); #endif - detect_free (det); + detector_free (det); if (opt_trace >= TRACE_PHM) { -- 2.34.1