r591: Added Center-Detector length to scanning and reconstruction
[ctsim.git] / src / threadproj.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          threadproj.h
5 **   Purpose:       Header file for thread reconstructions
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  February 2001
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id: threadproj.h,v 1.4 2001/03/01 07:30:49 kevin Exp $
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifndef _THREADPROJ_H
29 #define _THREADPROJ_H
30
31 #include <vector>
32 #include <wx/thread.h>
33 #include <wx/progdlg.h>
34 #include "timer.h"
35 #include "backgroundsupr.h"
36
37
38 class Reconstructor;
39 class ImageFile;
40 class PhantomFileDocument;
41 class ProjectorWorker;
42 class ProjectionFileView;
43
44 class ProjectorSupervisorThread : public SupervisorThread {
45 private:
46   PhantomFileView* m_pPhantomView;
47   const int m_iNDet;
48   const int m_iNView;
49   const std::string m_strGeometry;
50   const int m_iNSample;
51   const double m_dRotation;
52   const double m_dFocalLength;
53   const double m_dCenterDetectorLength;
54   const double m_dViewRatio;
55   const double m_dScanRatio;
56   const std::string m_strLabel;
57
58 public:
59   ProjectorSupervisorThread(PhantomFileView* pProjView, int iNDet, int iNView, 
60    const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
61    double dViewRatio, double dScanRatio, const char* const pszLabel);
62
63   virtual wxThread::ExitCode Entry();
64
65   virtual void OnExit();
66 };
67
68
69
70 class ProjectorSupervisor : public BackgroundSupervisor {
71 private:
72
73   std::vector<Projections*> m_vecpChildProjections;
74   PhantomFileDocument* m_pPhantomDoc;
75   PhantomFileView* m_pPhantomView;
76   Scanner* m_pScanner;
77   
78   const int m_iNDet;
79   const int m_iNView;
80   const char* const m_pszGeometry;
81   const int m_iNSample;
82   const double m_dRotation;
83   const double m_dFocalLength;
84   const double m_dCenterDetectorLength;
85   const double m_dViewRatio;
86   const double m_dScanRatio;
87   const char* const m_pszLabel;
88
89
90 public:
91    ProjectorSupervisor (SupervisorThread* pThread, PhantomFileView* pProjView, int iNDet, int iNView, 
92    const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
93    double dViewRatio, double dScanRatio, const char* const pszLabel);
94
95    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
96
97    virtual ~ProjectorSupervisor ();
98
99   void onDone();
100
101   Projections* getProjections();
102
103 };
104
105
106
107
108 class ProjectorWorker : public BackgroundWorkerThread {
109 private:
110   PhantomFileView* m_pPhantomView;
111   Projections* m_pProjections;
112   Scanner* m_pScanner;
113   int m_iNDet;
114   int m_iNView;
115   const char* m_pszGeometry;
116   int m_iNSample;
117   double m_dRotation;
118   double m_dFocalLength;
119   double m_dCenterDetectorLength;
120   double m_dViewRatio;
121   double m_dScanRatio;
122
123
124 public:
125   ProjectorWorker (ProjectorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews) 
126     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
127   {}
128   
129   void SetParameters (PhantomFileView* pPhantomFile, Projections* pProjections, Scanner* pScanner, 
130    int iNDet, int iView, 
131    const char* const pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
132    double dViewRatio, double dScanRatio);
133
134   virtual wxThread::ExitCode Entry();      // thread execution starts here
135
136   virtual void OnExit();
137 };
138
139
140 #endif
141