r40: made c++ compatible
[ctsim.git] / include / ir.h
index b7c6496e3518516e59c09983685278a27f810745..fbab3fc5d4d7450f52eafb5589166697f33d2fb5 100644 (file)
@@ -2,8 +2,20 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ir.h,v 1.8 2000/05/04 04:25:55 kevin Exp $
+**  $Id: ir.h,v 1.12 2000/05/07 12:46:19 kevin Exp $
 **  $Log: ir.h,v $
+**  Revision 1.12  2000/05/07 12:46:19  kevin
+**  made c++ compatible
+**
+**  Revision 1.11  2000/05/05 02:37:31  kevin
+**  renamed phmelm to pelm
+**
+**  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
 **
 #ifndef IR_H
 #define IR_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 #ifdef MPI_CT
 #define MPI_MAX_PROCESS 128
 struct mpi_ct_st
@@ -99,38 +115,38 @@ struct image_st {
     float calctime;                    /* time to calculate voxels in seconds */
 };
 
-struct phmelem_st {
-    int type;                     /* phmelem 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 *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 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 */
+struct pelm_st {
+    int type;               /* pelm type (box, ellipse, etc) */
+    double atten;           /* X-ray attenuation coefficient */
+    double cx,cy;           /* center of pelm */
+    double u,v;                     /* size of pelm */
+    double rot;                     /* pelm 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; /* pelm limits */
+    double radius;          /*   "   */
+    struct {                /* transform matrices      */
+       GRFMTX_2D p_to_o;    /* map from phantom to standard pelm coords */
+       GRFMTX_2D o_to_p;    /* map from std pelm coords to phantom coords */
     } xform;
-    struct phmelem_st *next;     /* pointer to next phmelem in phantom */
+    struct pelm_st *next;  /* pointer to next pelm in phantom */
 };
 
-typedef struct phmelem_st PHMELEM;
+typedef struct pelm_st PELM;
 
-struct phm_st {                           /* Phantom structure */
-    PHMELEM *phmelem_list;        /* phmelem linked-list */
+struct phm_st {                     /* Phantom structure */
+    PELM *pelm_list;       /* pelm linked-list */
     int type;
-    int n_pelm;                           /* number of phmelems in phantom */
-    double xmin, xmax, ymin, ymax; /* extent of phmelems in phmelem coordinates */
-    double radius;                /*     " "    */
+    int n_pelm;                     /* number of pelms in phantom */
+    double xmin, xmax, ymin, ymax; /* extent of pelms in pelm 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_PELMS        0       /* Phantom made of pelms */
+#define P_UNIT_PULSE   1       /* Special PHANTOM, not made of pelms */
 #define P_FILTER       9       /* defined only by a type */
 
 /*----------------------------------------------------------------------*/
@@ -153,7 +169,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 */
@@ -176,6 +192,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 */
@@ -192,14 +209,14 @@ struct raysum_st {
 };
 
 typedef struct detarray_st DETARRAY;
-typedef struct detect_st   DETECTOR;
+typedef struct detector_st DETECTOR;
 typedef struct raysum_st   RAYSUM;
 
 /*----------------------------------------------------------------------*/
 /*                             USER SYMBOLS                            */
 /*----------------------------------------------------------------------*/
 
-/* codes for phmelem types, passed to add_obj() */
+/* codes for pelm types, passed to phm_add_pelm() */
 
 #define O_RECTANGLE  1
 #define O_TRIANGLE   2
@@ -210,23 +227,21 @@ typedef struct raysum_st   RAYSUM;
 /* Codes for Coordinate Types      */
 /* Defines coords for pelm_is_point_inside() */
 
-#define PELM_COORD -1          /* Normalized Phmelem Coordinates */
+#define PELM_COORD -1          /* Normalized Pelm Coordinates */
 #define PHM_COORD -2           /* User's PHANTOM Coordinates */
 
 /* 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 */
 
@@ -254,7 +269,7 @@ typedef struct raysum_st   RAYSUM;
 /* Constants for sizing PHANTOM */
 
 #define PERCENT_PHM_SIZE_INCR   0.0    /* Fractional increase in PHANTOM */
-                                       /* limits compared to phmelem size */
+                                       /* limits compared to pelm size */
 #define N_EXTRA_DETECTORS         4    /* Number of extra detectors */
                                        /* widths when calculating detlen */
 
@@ -397,10 +412,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);
@@ -443,12 +454,13 @@ 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(PHMELEM *obj);
-void pelm_make_xform (PHMELEM *obj);
-PHMELEM *pelm_alloc(void);
+int pelm_make_points(PELM *obj);
+void pelm_make_xform (PELM *obj);
+PELM *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);
@@ -458,7 +470,7 @@ void phm_draw(const PHANTOM *phm);
 /* 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 PHMELEM *obj, double x, double y, const int coord_type);
+int pelm_is_point_inside(const PELM *obj, double x, double y, const int coord_type);
 
 /* phmstd.c */
 void phm_std_herman (PHANTOM *phm);
@@ -469,13 +481,13 @@ void phm_std_rowland_bordered (PHANTOM *phm);
 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 PHMELEM *obj, const double x1, const double y1, const double x2, const double y2);
-int pelm_clip_line (const PHMELEM *obj, double *x1, double *y1, double *x2, double *y2);
+double pelm_ray_attenuation (const PELM *obj, const double x1, const double y1, const double x2, const double y2);
+int pelm_clip_line (const PELM *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);
+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);
@@ -495,5 +507,8 @@ 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);
 
+#ifdef __cplusplus
+} 
+#endif /* __cplusplus */
 
 #endif