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