r101: *** empty log message ***
[ctsim.git] / include / scanner.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          scanner.h
5 **   Purpose:       Scanner header file
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 1, 1984
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: scanner.h,v 1.3 2000/06/19 17:58:20 kevin Exp $
13 **
14 **
15 **  This program is free software; you can redistribute it and/or modify
16 **  it under the terms of the GNU General Public License (version 2) as
17 **  published by the Free Software Foundation.
18 **
19 **  This program is distributed in the hope that it will be useful,
20 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 **  GNU General Public License for more details.
23 **
24 **  You should have received a copy of the GNU General Public License
25 **  along with this program; if not, write to the Free Software
26 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27 ******************************************************************************/
28
29 #ifndef SCANNER_H
30 #define SCANNER_H
31
32 #include "projections.h"
33
34 // Projections are collected along an array of ndet detectors.  The data
35 // for these detectors is stored in the class DetectorArray
36
37 typedef float DetectorValue;
38
39 class DetectorArray
40 {
41  public:
42   DetectorArray (const int ndet);
43   ~DetectorArray (void);
44
45   const int nDet(void) const {return m_nDet;}
46   const double viewAngle(void) const {return m_viewAngle;}
47   DetectorValue* detValues(void) {return m_detValues;}
48   const DetectorValue* detValues(void) const {return m_detValues;}
49
50   void setViewAngle (double viewAngle)
51       { m_viewAngle = viewAngle; }
52
53  private:
54   DetectorValue* m_detValues;   /* Pointer to array of values recorded by detector */
55   int m_nDet;           /* Number of detectors in array */
56   double m_viewAngle;    /* View angle in radians */
57
58   DetectorArray& operator=(const DetectorArray& rhs);
59   DetectorArray& operator()(const DetectorArray& rhs);
60 };
61
62 typedef enum {
63     DETECTOR_PARALLEL,
64     DETECTOR_EQUIANGLE,
65     DETECTOR_EQUILINEAR
66 } ScannerGeometry;
67   
68
69 class Scanner
70 {
71  public:
72   Scanner (const Phantom& phm, const ScannerGeometry geometry, int nDet, int nView, int nSample, const double rot_anglen);
73   ~Scanner();
74   
75   void collectProjections (Projections& proj, const Phantom& phm, const int start_view, const int trace);
76
77   void setNView (int nView);
78   const unsigned int nDet(void) const {return m_nDet;}
79   const unsigned int nView(void) const {return m_nView;}
80   const double phmLen(void) const {return m_phmLen;}
81   const double rotInc(void) const {return m_rotInc;}
82   const double detInc(void) const {return m_detInc;}
83   const double radius(void) const {return m_radius;}
84
85
86  private:
87   void projectSingleView (const Phantom& phm, DetectorArray& darray, const double xd1, const double yd1, const double xd2, const double yd2, const double xs1, const double ys1, const double xs2, const double ys2);
88
89   double projectSingleLine (const Phantom& phm, const double x1, const double y1, const double x2, const double y2);
90
91   double projectLineAgainstPElem (const PhantomElement& pelem, const double x1, const double y1, const double x2, const double y2);
92
93   void traceShowParam (const char *label, const char *fmt, int row, int color, ...);
94
95
96   ScannerGeometry m_geometry;     /* Geometry of detectory */
97   unsigned int m_nDet;                  /* Number of detectors in array */
98   unsigned int m_nView;                 /* Number of rotated views */
99   unsigned int m_nSample;                       /* Number of rays per detector */
100   double m_detLen;              /* Total length of detector array */
101   double m_rotLen;              /* Rotation angle length in radians (norm 2PI) */
102   double m_detInc;              /* Increment between centers of detectors */
103   double m_rotInc;              /* Increment in rotation angle between views */
104   double m_radius;              /* Radius of rotation.  Distance from */
105                                 /*   center of phm to center of det */
106   double m_phmLen;                /* Maximum Length of phantom or area of interest */
107
108   struct {
109     double xd1,yd1,xd2,yd2;     /* Coordinates of detector endpoints */
110     double xs1,ys1,xs2,ys2;     /* Coordinates of source endpoints */
111     double angle;               /* Starting angle */
112   } m_initPos;
113
114   static const int N_EXTRA_DETECTORS=4;           /* Number of extra detectors widths when calculating detlen */
115
116   int m_trace;
117
118 };
119
120 const static int RAYSUM_TRACE_ROW_TITLE=1;
121 const static int RAYSUM_TRACE_ROW_TITLE2=2;
122 const static int RAYSUM_TRACE_ROW_PHANT_ID=4;
123 const static int RAYSUM_TRACE_ROW_CHROMATIC=7;
124 const static int RAYSUM_TRACE_ROW_SCATTER=8;
125 const static int RAYSUM_TRACE_ROW_PHOT_STAT=9;
126 const static int RAYSUM_TRACE_ROW_NDET=12;
127 const static int RAYSUM_TRACE_ROW_NVIEW=13;
128 const static int RAYSUM_TRACE_ROW_SAMPLES=14;
129 const static int RAYSUM_TRACE_ROW_CURR_VIEW=17;
130 const static int RAYSUM_TRACE_ROW_ATTEN=18;
131
132
133
134 #endif