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.19 2001/01/03 22:00:46 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 (int startView, int endView);
49 void printProjectionData ();
50 void printScanInfo (std::ostringstream& os) const;
52 bool read (const std::string& fname);
53 bool read (const char* fname);
54 bool write (const char* fname);
55 bool write (const std::string& fname);
56 bool detarrayRead (fnetorderstream& fs, DetectorArray& darray, const int view_num);
57 bool detarrayWrite (fnetorderstream& fs, const DetectorArray& darray, const int view_num);
59 bool convertPolar (ImageFile& rIF, int iInterpolation);
60 bool convertFFTPolar (ImageFile& rIF, int iInterpolation, int iZeropad);
62 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;
64 void setNView (int nView); // used in MPI to restrict # of views
65 void setRotInc (double rotInc) { m_rotInc = rotInc;}
66 void setDetInc (double detInc) { m_detInc = detInc;}
67 void setPhmLen (double phmLen) { m_phmLen = phmLen;}
68 void setCalcTime (double calcTime) {m_calcTime = calcTime;}
69 void setRemark (const char* remark) {m_remark = remark; m_label.setLabelString(remark);}
70 void setRemark (const std::string& remark) {setRemark(remark.c_str());}
72 double detStart() const {return m_detStart;}
73 double rotStart() const {return m_rotStart;}
74 double calcTime() const {return m_calcTime;}
75 double phmLen() const {return m_phmLen;}
76 const char* remark() const {return m_remark.c_str();}
77 double detInc() const {return m_detInc;}
78 double rotInc() const {return m_rotInc;}
79 int nDet() const {return m_nDet;}
80 int nView() const {return m_nView;}
81 int geometry() const {return m_geometry;}
82 double focalLength() const {return m_focalLength;}
83 double fieldOfView() const {return m_fieldOfView;}
85 const std::string& getFilename() const {return m_filename;}
86 Array2dFileLabel& getLabel() {return m_label;}
87 const Array2dFileLabel& getLabel() const {return m_label;}
89 DetectorArray& getDetectorArray (const int iview)
90 { return (*m_projData[iview]); }
92 const DetectorArray& getDetectorArray (const int iview) const
93 { return (*m_projData[iview]); }
95 static bool copyHeader (const char* const filename, std::ostream& os);
96 static bool copyHeader (const std::string& filename, std::ostream& os);
98 static bool copyViewData (const char* const filename, std::ostream& os, int startView, int endView);
99 static bool copyViewData (const std::string& filename, std::ostream& os, int startView, int endView);
102 int m_headerSize; // Size of disk file header
103 int m_geometry; // Geometry of scanner
104 class DetectorArray **m_projData; // Pointer to array of detarray_st pointers
105 std::string m_remark; // description of raysum data
106 int m_nDet; // number of detectors in array
107 int m_nView; // number of rotated views
108 double m_calcTime; // time required to calculate raysums
109 double m_rotStart; // starting view rotation
110 double m_rotInc; // angle between rotations
111 double m_detStart; // distance of beginning detector to center phantom
112 double m_detInc; // increment between detectors
113 double m_phmLen; // Length of phantom edge (phm is square)
114 double m_focalLength;
115 double m_fieldOfView;
116 kuint32 m_year; // Creation date & time
122 std::string m_filename;
123 Array2dFileLabel m_label;
125 const static kuint16 m_signature;
127 bool headerWrite (fnetorderstream& fs);
128 bool headerRead (fnetorderstream& fs);
130 void deleteProjData ();
132 void init (const int nView, const int nDet);
134 // prevent default methods
135 Projections& operator= (const Projections& rhs); // assignment
136 Projections(const Projections& rhs); // copy