1 /*****************************************************************************
5 ** Purpose: Header file for Projections class
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 1, 1984
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: projections.h,v 1.14 2000/09/02 05:10:39 kevin Exp $
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.
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.
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 ******************************************************************************/
34 class Array2dFileLabel;
41 Projections (const int nView, const int nDet);
42 Projections (const Scanner& scanner);
46 void initFromScanner (const Scanner& scanner);
48 void printProjectionData ();
49 void printScanInfo (ostringstream& os) const;
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);
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;
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; m_label.setLabelString(remark);}
66 void setRemark (const string& remark) {setRemark(remark.c_str());}
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;}
81 const string& getFilename() const {return m_filename;}
82 Array2dFileLabel& getLabel() {return m_label;}
83 const Array2dFileLabel& getLabel() const {return m_label;}
85 DetectorArray& getDetectorArray (const int iview)
86 { return (*m_projData[iview]); }
88 const DetectorArray& getDetectorArray (const int iview) const
89 { return (*m_projData[iview]); }
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
113 Array2dFileLabel m_label;
115 const static kuint16 m_signature = ('P'*256 + 'J');
119 bool headerRead (fnetorderstream& fs);
120 bool headerWrite (fnetorderstream& fs);
122 void deleteProjData ();
124 void init (const int nView, const int nDet);
126 // prevent default methods
127 Projections& operator= (const Projections& rhs); // assignment
128 Projections(const Projections& rhs); // copy