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