r94: finished c++ conversions
[ctsim.git] / include / ir.h
index 9c8f92e8dc5fe1b9d8379a2b505d9862094523c6..ffa83fb63d156cb3891d212ae8091f860a31b578 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ir.h,v 1.25 2000/06/10 22:33:11 kevin Exp $
+**  $Id: ir.h,v 1.26 2000/06/13 16:20:31 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
 #define IR_H
 
 
-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;
-
-/*---------------------------------------------------------------------------*/
-
 static const int POINTS_PER_CIRCLE=90;
 #define MAXREMARK  99
 
@@ -51,7 +41,10 @@ typedef enum {
   SEGMENT
 } PElmType;
 
-struct pelm_st {
+
+class PhmElement
+{
+ public:
     PElmType type;          /* pelm type (box, ellipse, etc) */
     double atten;           /* X-ray attenuation coefficient */
     double cx,cy;           /* center of pelm */
@@ -63,9 +56,9 @@ struct pelm_st {
     double radius;          /*   "   */
     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 */
-    struct pelm_st *next;    /* pointer to next pelm in phantom */
+    class PhmElement *next;    /* pointer to next pelm in phantom */
 };
-typedef struct pelm_st PELM;
+typedef class PhmElement PELM;
 
 typedef enum {
   P_PELMS,        /* Phantom made of Pelms */
@@ -73,14 +66,18 @@ typedef enum {
   P_FILTER       /* defined only by this type */
 } PhmType;
 
-struct phm_st {                           /* Phantom structure */
+
+/* Phantom class */
+class Phantom
+{
+public:
     PELM *pelm_list;               /* pelm linked-list */
     PhmType type;
     int n_pelm;                           /* number of pelms in phantom */
     double xmin, xmax, ymin, ymax; /* extent of pelms in pelm coordinates */
     double radius;                 /*      " "    */
 };
-typedef struct phm_st    PHANTOM;
+typedef class Phantom    PHANTOM;
 
 
 /*----------------------------------------------------------------------*/
@@ -93,12 +90,13 @@ typedef struct phm_st    PHANTOM;
 
 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 detarray_st DETARRAY;
+typedef struct DetectorArray DETARRAY;
 
 
 typedef enum {
@@ -107,7 +105,10 @@ typedef enum {
     DETECTOR_EQUILINEAR
 } ScannerGeometry;
   
-struct detector_st {
+
+class Detector
+{
+ public:
   ScannerGeometry geometry;     /* Geometry of detectory */
   int ndet;                    /* Number of detectors in array */
   int nview;                   /* Number of rotated views */
@@ -125,14 +126,17 @@ struct detector_st {
     double angle;              /* Starting angle */
   } init;
 };
-typedef struct detector_st DETECTOR;
+typedef class Detector DETECTOR;
+
 
-struct raysum_st {
+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 detarray_st **view;   /* Pointer to array of detarray_st pointers */
+  struct DetectorArray **view; /* Pointer to array of detarray_st pointers */
 
   char remark[MAXREMARK+1];    /* description of raysum data */
   double calctime;             /* time required to calculate raysums */
@@ -146,7 +150,8 @@ struct raysum_st {
   double det_inc;              /* increment between detectors */
   double phmlen;               /* Length of PHANTOM edge (phm is square) */
 };
-typedef struct raysum_st   RAYSUM;
+typedef class Projections  RAYSUM;
+
 
 /*----------------------------------------------------------------------*/
 /*                             USER SYMBOLS                            */
@@ -279,21 +284,21 @@ const static int RAYSUM_TRACE_ROW_CURR_VIEW=17;
 const static int RAYSUM_TRACE_ROW_ATTEN=18;
 
 
+
 /*************************************************************************
  *  FUNCTION DECLARATIONS
  ************************************************************************/
 
-/* convolve.c */
+/* convolve.cpp */
 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 */
+/* dialogs.cpp */
 int phm_add_pelm_kb (PHANTOM *phm);
 PHANTOM *phm_select (void);
 int interpolation_select (void);
 int filter_select (double *filter_param);
 
-/* filter.c */
+/* 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);
@@ -301,7 +306,7 @@ double filter_frequency_response (int filt_type, double u, double bw, double par
 double sinc (double x, double mult);
 double integral_abscos(double u, double w);
 
-/* options.c */
+/* options.cpp */
 int opt_set_trace(const char *optarg);
 const char *name_of_phantom(const int phmid);
 int opt_set_phantom(const char *optarg);
@@ -314,7 +319,7 @@ const char *name_of_filter_domain(const DomainType domain);
 BackprojType opt_set_backproj(const char *optarg);
 const char *name_of_backproj(const BackprojType backproj);
 
-/* phm.c */
+/* phm.cpp */
 PHANTOM *phm_create(const int phmid);
 PHANTOM *phm_create_from_file(const char *fname);
 PHANTOM *phm_init(void);
@@ -335,12 +340,12 @@ void phm_show(const PHANTOM *phm);
 void phm_draw(const PHANTOM *phm);
 #endif
 
-/* phmstd.c */
+/* phmstd.cpp */
 void phm_std_herman (PHANTOM *phm);
 void phm_std_rowland (PHANTOM *phm);
 void phm_std_rowland_bordered (PHANTOM *phm);
 
-/* raycollect.c */
+/* 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);
@@ -348,11 +353,11 @@ double pelm_ray_attenuation (PELM *pelm, const double x1, const double y1, const
 int pelm_clip_line (const PELM *pelm, 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 */
+/* scanner.cpp */
 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 */
+/* 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_open(const char *filename);