r97: Converted Scanner and Projections to C++
[ctsim.git] / include / backprojectors.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **      Name:         backproject.h
5 **      Purpose:      Backprojection classes
6 **      Programmer:   Kevin Rosenberg
7 **      Date Started: June 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: backprojectors.h,v 1.3 2000/06/17 20:12:14 kevin Exp $
13 **  $Log: backprojectors.h,v $
14 **  Revision 1.3  2000/06/17 20:12:14  kevin
15 **  Converted Scanner and Projections to C++
16 **
17 **  Revision 1.2  2000/06/13 16:20:31  kevin
18 **  finished c++ conversions
19 **
20 **  Revision 1.1  2000/06/10 23:00:17  kevin
21 **  *** empty log message ***
22 **
23 **
24 **  This program is free software; you can redistribute it and/or modify
25 **  it under the terms of the GNU General Public License (version 2) as
26 **  published by the Free Software Foundation.
27 **
28 **  This program is distributed in the hope that it will be useful,
29 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
30 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31 **  GNU General Public License for more details.
32 **
33 **  You should have received a copy of the GNU General Public License
34 **  along with this program; if not, write to the Free Software
35 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
36 ******************************************************************************/
37
38 class Backproject
39 {
40  public:
41     Backproject (const Projections& proj, ImageFile& im, InterpolationType interpType);
42
43     virtual ~Backproject ();
44
45     virtual void BackprojectView (const double* const t, const double view_angle) {};
46
47  protected:
48     void ScaleImageByRotIncrement (void);
49     void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double r, double phi, double L, int ni);
50     void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int ni);
51
52     InterpolationType interpType;
53     const Projections& proj;
54     ImageFile& im;
55     ImageFileArray v;
56     kuint32 nx;
57     kuint32 ny;
58     double detInc;
59     double rotInc;
60     int iDetCenter;             // index refering to L=0 projection 
61     int nDet;
62     double xMin, xMax, yMin, yMax;     // Retangular coords of phantom
63     double xInc, yInc;  // size of cells
64
65  private:
66     Backproject (const Backproject& rhs);
67     Backproject& operator= (const Backproject& rhs);
68 };
69
70
71 class BackprojectTrig : public Backproject
72 {
73  public:
74   BackprojectTrig (const Projections& proj, ImageFile& im, InterpolationType interpType)
75       : Backproject::Backproject (proj, im, interpType)
76       {}
77
78   void BackprojectView (const double* const t, double view_angle);
79 };
80
81
82 class BackprojectTable : public Backproject
83 {
84  public:
85   BackprojectTable (const Projections& proj, ImageFile& im, InterpolationType interpType);
86   ~BackprojectTable ();
87
88   void BackprojectView (const double* const t, double view_angle);
89
90  private:
91   Array2d<kfloat64> arrayR;
92   Array2d<kfloat64> arrayPhi;
93   kfloat64** r;
94   kfloat64** phi;
95 };
96
97
98 class BackprojectDiff : public Backproject
99 {
100  public:
101   BackprojectDiff (const Projections& proj, ImageFile& im, InterpolationType interpType);
102   ~BackprojectDiff ();
103
104   void BackprojectView (const double* const t, double view_angle);
105
106  protected:
107   double start_r;
108   double start_phi;
109   double im_xinc, im_yinc;
110 };
111
112 class BackprojectDiff2 : public BackprojectDiff
113 {
114  public:
115   BackprojectDiff2 (const Projections& proj, ImageFile& im, InterpolationType interpType)
116     :  BackprojectDiff::BackprojectDiff (proj, im, interpType)
117     {}
118
119   void BackprojectView (const double* const t, double view_angle);
120 };
121
122 class BackprojectIntDiff2 : public BackprojectDiff
123 {
124  public:
125   BackprojectIntDiff2 (const Projections& proj, ImageFile& im, InterpolationType interpType)
126     :  BackprojectDiff::BackprojectDiff (proj, im, interpType)
127     {}
128   
129   void BackprojectView (const double* const t, double view_angle);
130 };
131
132
133 Backproject* selectBackprojector (BackprojType type, const Projections& proj, ImageFile& im, InterpolationType interpType);