r1018: *** empty log message ***
[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.7 2001/09/24 09:40:42 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 #ifdef HAVE_WXTHREADS
32
33 #include <vector>
34 #include <wx/thread.h>
35 #include <wx/progdlg.h>
36 #include "timer.h"
37 #include "backgroundsupr.h"
38
39
40 class Reconstructor;
41 class ImageFile;
42 class PhantomFileDocument;
43 class ProjectorWorker;
44 class ProjectionFileView;
45
46 class ProjectorSupervisorThread : public SupervisorThread {
47 private:
48   PhantomFileView* m_pPhantomView;
49   const int m_iNDet;
50   const int m_iNView;
51   const int m_iOffsetView;
52   const std::string m_strGeometry;
53   const int m_iNSample;
54   const double m_dRotation;
55   const double m_dFocalLength;
56   const double m_dCenterDetectorLength;
57   const double m_dViewRatio;
58   const double m_dScanRatio;
59   const std::string m_strLabel;
60
61 public:
62   ProjectorSupervisorThread(PhantomFileView* pProjView, int iNDet, int iNView, int iOffsetView, 
63    const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
64    double dViewRatio, double dScanRatio, const char* const pszLabel);
65
66   virtual wxThread::ExitCode Entry();
67
68   virtual void OnExit();
69 };
70
71
72
73 class ProjectorSupervisor : public BackgroundSupervisor {
74 private:
75
76   std::vector<Projections*> m_vecpChildProjections;
77   PhantomFileView* m_pPhantomView;
78   PhantomFileDocument* m_pPhantomDoc;
79   Scanner* m_pScanner;
80   
81   const int m_iNDet;
82   const int m_iNView;
83   const int m_iOffsetView;
84   const char* const m_pszGeometry;
85   const int m_iNSample;
86   const double m_dRotation;
87   const double m_dFocalLength;
88   const double m_dCenterDetectorLength;
89   const double m_dViewRatio;
90   const double m_dScanRatio;
91   const char* const m_pszLabel;
92
93
94 public:
95    ProjectorSupervisor (SupervisorThread* pThread, PhantomFileView* pProjView, int iNDet, int iNView,  int iOffsetView,
96    const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
97    double dViewRatio, double dScanRatio, const char* const pszLabel);
98
99    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
100
101    virtual ~ProjectorSupervisor ();
102
103   void onDone();
104
105   Projections* getProjections();
106
107 };
108
109
110
111
112 class ProjectorWorker : public BackgroundWorkerThread {
113 private:
114   PhantomFileView* m_pPhantomView;
115   Projections* m_pProjections;
116   Scanner* m_pScanner;
117   int m_iNDet;
118   int m_iNView;
119   int m_iOffsetView;
120   const char* m_pszGeometry;
121   int m_iNSample;
122   double m_dRotation;
123   double m_dFocalLength;
124   double m_dCenterDetectorLength;
125   double m_dViewRatio;
126   double m_dScanRatio;
127
128
129 public:
130   ProjectorWorker (ProjectorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews) 
131     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
132   {}
133   
134   void SetParameters (PhantomFileView* pPhantomFile, Projections* pProjections, Scanner* pScanner, 
135    int iNDet, int iView, int iOffsetView,
136    const char* const pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
137    double dViewRatio, double dScanRatio);
138
139   virtual wxThread::ExitCode Entry();      // thread execution starts here
140
141   virtual void OnExit();
142 };
143
144
145 #endif // HAVE_WXTHREADS
146 #endif // _THREADPROJ_H_
147