r244: *** empty log message ***
[ctsim.git] / include / projections.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          projections.h
5 **   Purpose:       Header file for Projections class
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: projections.h,v 1.15 2000/12/04 05:36:57 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 PROJECTIONS_H
30 #define PROJECTIONS_H
31
32 class Scanner;
33 class DetectorArray;
34 class Array2dFileLabel;
35 \r
36 #include <sstream>\r
37
38
39 // Projections
40 class Projections
41 {
42  public:
43   Projections (const int nView, const int nDet);
44   Projections (const Scanner& scanner);
45   Projections ();
46   ~Projections ();
47
48   void initFromScanner (const Scanner& scanner);
49
50   void printProjectionData ();
51   void printScanInfo (ostringstream& os) const;
52
53   bool read (const string& fname);
54   bool read (const char* fname);
55   bool write (const char* fname);
56   bool write (const string& fname);
57   bool detarrayRead (fnetorderstream& fs, DetectorArray& darray, const int view_num);
58   bool detarrayWrite (fnetorderstream& fs, const DetectorArray& darray, const int view_num);
59
60   bool reconstruct (ImageFile& im, const char* const filterName, double filt_param, const char* const filterMethodName, const int zeropad, const char* frequencyFilterName, const char* const interpName, int interp_param, const char* const backprojName, const int trace) const;
61
62   void setNView (int nView);  // used in MPI to restrict # of views
63   void setRotInc (double rotInc) { m_rotInc = rotInc;}
64   void setDetInc (double detInc) { m_detInc = detInc;}
65   void setPhmLen (double phmLen) { m_phmLen = phmLen;}
66   void setCalcTime (double calcTime) {m_calcTime = calcTime;}
67   void setRemark (const char* remark) {m_remark = remark; m_label.setLabelString(remark);}
68   void setRemark (const string& remark) {setRemark(remark.c_str());}
69
70   double detStart() const {return m_detStart;}
71   double rotStart() const {return m_rotStart;}
72   double calcTime() const {return m_calcTime;}
73   double phmLen() const {return m_phmLen;}
74   const char*  remark() const {return m_remark.c_str();}
75   double detInc() const {return m_detInc;}
76   double rotInc() const {return m_rotInc;}
77   int nDet() const {return m_nDet;}
78   int nView() const {return m_nView;}
79   int geometry() const {return m_geometry;}
80   double focalLength() const {return m_focalLength;}
81   double fieldOfView() const {return m_fieldOfView;}
82
83   const string& getFilename() const {return m_filename;}
84   Array2dFileLabel& getLabel() {return m_label;}
85   const Array2dFileLabel& getLabel() const {return m_label;}
86
87   DetectorArray& getDetectorArray (const int iview)
88       { return (*m_projData[iview]); }
89   
90   const DetectorArray& getDetectorArray (const int iview) const
91       { return (*m_projData[iview]); }
92   
93  private:
94   int m_headerSize;             // Size of disk file header 
95   int m_geometry;               // Geometry of scanner 
96   class DetectorArray **m_projData;     // Pointer to array of detarray_st pointers 
97   string m_remark;              // description of raysum data 
98   int m_nDet;                   // number of detectors in array 
99   int m_nView;                  // number of rotated views 
100   double m_calcTime;            // time required to calculate raysums 
101   double m_rotStart;            // starting view rotation
102   double m_rotInc;              // angle between rotations 
103   double m_detStart;            // distance of beginning detector to center phantom
104   double m_detInc;              // increment between detectors 
105   double m_phmLen;              // Length of phantom edge (phm is square) 
106   double m_focalLength;
107   double m_fieldOfView;
108   kuint32 m_year;                   // Creation date & time
109   kuint32 m_month;
110   kuint32 m_day;
111   kuint32 m_hour;
112   kuint32 m_minute;
113   kuint32 m_second;
114   string m_filename;
115   Array2dFileLabel m_label;
116
117   const static kuint16 m_signature;
118
119   bool headerRead ();
120   bool headerWrite ();
121   bool headerRead (fnetorderstream& fs);
122   bool headerWrite (fnetorderstream& fs);
123   void newProjData ();
124   void deleteProjData ();
125
126   void init (const int nView, const int nDet);
127
128   // prevent default methods
129   Projections& operator= (const Projections& rhs);   // assignment
130   Projections(const Projections& rhs);               // copy
131 };
132
133
134 #endif