r87: Upgraded from MPI to MPI++
[ctsim.git] / include / ir.h
index 3cc918a6da7d3f226217716ad8049a7ed9ed6db1..e1661dbf42f0e90f4d0ac3574356675f4849ad1a 100644 (file)
@@ -2,8 +2,23 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ir.h,v 1.18 2000/06/05 01:32:45 kevin Exp $
+**  $Id: ir.h,v 1.23 2000/06/07 10:12:09 kevin Exp $
 **  $Log: ir.h,v $
+**  Revision 1.23  2000/06/07 10:12:09  kevin
+**  Upgraded from MPI to MPI++
+**
+**  Revision 1.22  2000/06/07 07:43:39  kevin
+**  *** empty log message ***
+**
+**  Revision 1.21  2000/06/07 03:49:54  kevin
+**  *** empty log message ***
+**
+**  Revision 1.20  2000/06/07 02:30:27  kevin
+**  Added C++ image files
+**
+**  Revision 1.19  2000/06/07 00:59:38  kevin
+**  added imagefiles
+**
 **  Revision 1.18  2000/06/05 01:32:45  kevin
 **  Added C++ compatibility
 **
 #ifndef IR_H
 #define IR_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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) */
@@ -117,19 +111,6 @@ typedef struct histo_st HISTOGRAM;
 static const int POINTS_PER_CIRCLE=90;
 #define MAXREMARK  99
 
-typedef FMTX_2D         IMAGE_ARRAY;    /* use 2d floating point matrix */
-typedef float           IMAGE_ELEM_VAL;        /* use floats for image storing */
-
-struct image_st {
-    IMAGE_ARRAY 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[MAXREMARK+1];          /* description of voxel data */
-    float calctime;                    /* time to calculate voxels in seconds */
-};
-typedef struct image_st  IMAGE;
-
 typedef enum {
   RECTANGLE,
   TRIANGLE,
@@ -268,12 +249,12 @@ static const char D_FREQ_STR[]=    "freq";
 static const char D_SPATIAL_STR[]= "spatial";
  
 typedef enum {
-  D_FREQ,
+  D_FREQ = 1,
   D_SPATIAL 
 } DomainType;
 
 typedef enum {
-    FUNC_EVEN,    /* function types, f[-n] = f[n] */
+    FUNC_EVEN = 1,    /* function types, f[-n] = f[n] */
     FUNC_ODD,     /* f[-n] = -f[n] */
     FUNC_BOTH    /* function has both odd & even components */
 } FunctionSymmetry;
@@ -281,7 +262,7 @@ typedef enum {
 /* interpolation methods */
 #undef HAVE_BSPLINE_INTERP
 typedef enum {     /* Interpolation methods */
-  I_NEAREST,       /* Nearest neighbor */
+  I_NEAREST = 1,       /* Nearest neighbor */
 #if HAVE_BSPLINE_INTERP
   I_BSPLINE,
   I_1BSPLINE,      /* 1st order B-Spline */
@@ -369,84 +350,58 @@ const static int RAYSUM_TRACE_ROW_ATTEN=18;
 /*************************************************************************
  *  FUNCTION DECLARATIONS
  ************************************************************************/
-void usage (const char *program);
 
-/* From reconstr.c */
-IMAGE *image_reconst (IMAGE *im, RAYSUM *rs, const FilterType filt_type, double filt_param, InterpolationType interp_type, int interp_param, const BackprojType backproj_type, int const ir_trace);
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
 
-/* From bproj.c */
-void backproj_init (const RAYSUM *rs, IMAGE *im, const BackprojType 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);
+#ifdef HAVE_MPI
+#define CT_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 [CT_MPI_MAX_PROCESS];
+  int start_work_unit [CT_MPI_MAX_PROCESS];
+  MPI::Intracomm comm;
+};
 
-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);
+extern struct mpi_ct_st mpi_ct;
+void mpi_ct_calc_work_units(const unsigned int global_work_units);
+#endif
 
-/* 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 FunctionSymmetry func_type);
-double convolve_both(const double f1[], const double f2[], const double dx, const int n, const int np);
+double convolve (const double f1[], const double f2[], const double dx, const int n, const int np, const FunctionSymmetry 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);
+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(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 *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, const DomainType domain, double bw, const FilterType filt_type, double filt_param, const int opt_trace);
-int image_display (const IMAGE *im);
-int image_display_scale (const IMAGE *im, const int scale, const double pmin, const double pmax);
-
 /* options.c */
 int opt_set_trace(const char *optarg);
 const char *name_of_phantom(const int phmid);
 int opt_set_phantom(const char *optarg);
-int opt_set_interpolation(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);
+FilterType opt_set_filter(const char *optarg);
 const char *name_of_filter(const int filter);
 DomainType opt_set_filter_domain(const char *optarg);
 const char *name_of_filter_domain(const DomainType domain);
-int opt_set_backproj(const char *optarg);
+BackprojType opt_set_backproj(const char *optarg);
 const char *name_of_backproj(const BackprojType backproj);
 
 /* phm.c */
@@ -470,11 +425,6 @@ 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(PELM *obj, const double x, const double y, const CoordType coord_type);
-
 /* phmstd.c */
 void phm_std_herman (PHANTOM *phm);
 void phm_std_rowland (PHANTOM *phm);
@@ -489,7 +439,7 @@ int pelm_clip_line (const PELM *pelm, double *x1, double *y1, double *x2, double
 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);
+DETECTOR *detector_create(const PHANTOM *phm, const ScannerGeometry geometry, int ndet, int nview, int nsample, const double rot_anglen);
 void detector_free(DETECTOR *det);
 
 /* rayio.c */
@@ -512,6 +462,51 @@ int raysum_print(const RAYSUM *rs);
 
 #ifdef __cplusplus
 } 
+
+/* 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);
+int pelm_is_point_inside(PELM *obj, const double x, const double y, const CoordType coord_type);
+
+/* 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 /* __cplusplus */
 
+
 #endif