** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ir.h,v 1.13 2000/05/08 20:00:48 kevin Exp $
+** $Id: ir.h,v 1.21 2000/06/07 03:49:54 kevin Exp $
** $Log: ir.h,v $
+** 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
+**
+** Revision 1.17 2000/06/03 06:29:08 kevin
+** *** empty log message ***
+**
+** Revision 1.16 2000/05/24 22:48:17 kevin
+** First functional version of SDF library for X-window
+**
+** Revision 1.15 2000/05/16 04:33:17 kevin
+** Updated documentation
+**
+** Revision 1.14 2000/05/11 14:07:00 kevin
+** Added support for Windows NT
+**
** Revision 1.13 2000/05/08 20:00:48 kevin
** ANSI C changes
**
#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) */
typedef struct detector_st DETECTOR;
struct raysum_st {
- int fd;
- int file_mode;
- int header_size;
- int geometry;
+ 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 */
char remark[MAXREMARK+1]; /* description of raysum data */
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;
/* interpolation methods */
+#undef HAVE_BSPLINE_INTERP
typedef enum { /* Interpolation methods */
- I_NEAREST, /* Nearest neighbor */
- I_LINEAR, /* Linear interpolation */
+ I_NEAREST = 1, /* Nearest neighbor */
+#if HAVE_BSPLINE_INTERP
I_BSPLINE,
I_1BSPLINE, /* 1st order B-Spline */
I_2BSPLINE,
- I_3BSPLINE
+ I_3BSPLINE,
+#endif
+ I_LINEAR /* Linear interpolation */
} InterpolationType;
/* Constants for sizing PHANTOM */
/*************************************************************************
* FUNCTION DECLARATIONS
************************************************************************/
-
-void usage (const char *program);
+
+#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
+
/* From reconstr.c */
-IMAGE *image_reconst (IMAGE *im, RAYSUM *rs, int filt_type, double filt_param, int interp_type, int interp_param, const int backproj_type, int ir_trace);
+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);
/* From bproj.c */
void backproj_init (const RAYSUM *rs, IMAGE *im, const BackprojType bproj_method);
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, DomainType domain, int numint);
+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);
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);
+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 *program);
+int opt_set_trace(const char *optarg);
const char *name_of_phantom(const int phmid);
-int opt_set_phantom(const char *optarg, const char *program);
-int opt_set_interpolation(const char *optarg, const char *program);
+int opt_set_phantom(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, const char *program);
+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 *program);
+DomainType opt_set_filter_domain(const char *optarg);
const char *name_of_filter_domain(const DomainType domain);
-int opt_set_backproj(const char *optarg, const char *program);
+BackprojType opt_set_backproj(const char *optarg);
const char *name_of_backproj(const BackprojType backproj);
/* phm.c */
PHANTOM *phm_create(const int phmid);
PHANTOM *phm_create_from_file(const char *fname);
PHANTOM *phm_init(void);
+void phm_free (PHANTOM *phm);
int phm_add_pelm_file(PHANTOM *phm, const char *fname);
void phm_add_pelm (PHANTOM *phm, const char *type, const double cx, const double cy,
const double u, const double v, const double rot, const double atten);
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
+#if HAVE_SGP
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);
+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 */
#ifdef __cplusplus
}
+
+void phm_to_imagefile (const PHANTOM *phm, ImageFile& im, const int col_start, const int col_count, const int nsample, const int trace);
+
#endif /* __cplusplus */
+
#endif