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