** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ir.h,v 1.27 2000/06/15 19:07:10 kevin Exp $
+** $Id: ir.h,v 1.28 2000/06/17 20:12:14 kevin Exp $
**
**
** This program is free software; you can redistribute it and/or modify
#include "phantom.h"
-
-
-/*----------------------------------------------------------------------*/
-/* RAYSUM SYMBOLS */
-/*----------------------------------------------------------------------*/
-
-/* Ray sums are collected along an array of ndet detectors. The data
- * for these detectors is stored in the structure DETECTARRAY
- */
-
-typedef float DETECT_TYPE;
-
-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 DetectorArray DETARRAY;
-
-
-typedef enum {
- DETECTOR_PARALLEL,
- DETECTOR_EQUIANGLE,
- DETECTOR_EQUILINEAR
-} ScannerGeometry;
-
-
-class Detector
-{
- public:
- ScannerGeometry geometry; /* Geometry of detectory */
- int ndet; /* Number of detectors in array */
- int nview; /* Number of rotated views */
- int nsample; /* Number of rays per detector */
- double detlen; /* Total length of detector array */
- double rotlen; /* Rotation angle length in radians (norm 2PI) */
- double det_inc; /* Increment between centers of detectors */
- double rot_inc; /* Increment in rotation angle between views */
- double radius; /* Radius of rotation. Distance from */
- /* center of phm to center of det */
- double phmlen; /* Maximum Length of phantom or area of interest */
- struct {
- double xd1,yd1,xd2,yd2; /* Coordinates of detector endpoints */
- double xs1,ys1,xs2,ys2; /* Coordinates of source endpoints */
- double angle; /* Starting angle */
- } init;
-
- Detector (const Phantom& phm, const ScannerGeometry geometry, int ndet, int nview, int nsample, const double rot_anglen);
- ~Detector();
-
-};
-
-
-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 DetectorArray **view; /* Pointer to array of detarray_st pointers */
-
- string remark; /* description of raysum data */
- double calctime; /* time required to calculate raysums */
-
- int ndet; /* number of detectors in array */
- int nview; /* number of rotated views */
- double rot_start; /* starting view rotation */
- double rot_inc; /* angle between rotations */
- double det_start; /* distance of beginning detector to center */
- /* of PHANTOM */
- double det_inc; /* increment between detectors */
- double phmlen; /* Length of PHANTOM edge (phm is square) */
-};
-typedef class Projections RAYSUM;
+#include "scanner.h"
+#include "projections.h"
/*----------------------------------------------------------------------*/
/* USER SYMBOLS */
I_LINEAR /* Linear interpolation */
} InterpolationType;
-static const int N_EXTRA_DETECTORS=4; /* Number of extra detectors widths when calculating detlen */
-
static const char O_TRACE_NONE_STR[]= "none";
static const char O_TRACE_TEXT_STR[]= "text";
static const char O_TRACE_PHM_STR[]= "phm";
BackprojType opt_set_backproj(const char *optarg);
const char *name_of_backproj(const BackprojType backproj);
-/* 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);
-double pelem_ray_attenuation (PhantomElement& pelem, const double x1, const double y1, const double x2, const double y2);
-void raysum_trace_show_param (const char *label, const char *fmt, int row, int color, ...);
-
-/* 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);
-void raysum_alloc_views(RAYSUM *rs);
-void raysum_free(RAYSUM *rs);
-int raysum_is_open(RAYSUM *rs);
-int raysum_close(RAYSUM *rs);
-int raysum_read_header(RAYSUM *rs);
-int raysum_write_header(RAYSUM *rs);
-int raysum_read(RAYSUM *rs);
-int raysum_write(RAYSUM *rs);
-void raysum_print(const RAYSUM *rs);
-void raysum_print_info(const RAYSUM *rs);
-DETARRAY *detarray_alloc(const int n);
-void detarray_free(DETARRAY *darray);
-int detarray_read(RAYSUM *rs, DETARRAY *darray, const int view_num);
-int detarray_write(RAYSUM *rs, const DETARRAY *darray, const int view_num);
-
/* 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 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);
+ImageFile& proj_reconst (ImageFile& im, Projections& rs, const FilterType filt_type, double filt_param, InterpolationType interp_type, int interp_param, const BackprojType backproj_type, int const ir_trace);
#endif