Update copyright date; remove old CVS keyword
[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-2009 Kevin Rosenberg
11 **
12 **  This program is free software; you can redistribute it and/or modify
13 **  it under the terms of the GNU General Public License (version 2) as
14 **  published by the Free Software Foundation.
15 **
16 **  This program is distributed in the hope that it will be useful,
17 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 **  GNU General Public License for more details.
20 **
21 **  You should have received a copy of the GNU General Public License
22 **  along with this program; if not, write to the Free Software
23 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 ******************************************************************************/
25
26 #ifndef _THREADPROJ_H
27 #define _THREADPROJ_H
28
29 #ifdef HAVE_WXTHREADS
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 int m_iOffsetView;
50   const std::string m_strGeometry;
51   const int m_iNSample;
52   const double m_dRotation;
53   const double m_dFocalLength;
54   const double m_dCenterDetectorLength;
55   const double m_dViewRatio;
56   const double m_dScanRatio;
57   const wxString m_strLabel;
58
59 public:
60   ProjectorSupervisorThread(PhantomFileView* pProjView, int iNDet, int iNView, int iOffsetView,
61    const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
62    double dViewRatio, double dScanRatio, wxChar const* strLabel);
63
64   virtual wxThread::ExitCode Entry();
65
66   virtual void OnExit();
67 };
68
69
70
71 class ProjectorSupervisor : public BackgroundSupervisor {
72 private:
73
74   std::vector<Projections*> m_vecpChildProjections;
75   PhantomFileView* m_pPhantomView;
76   PhantomFileDocument* m_pPhantomDoc;
77   Scanner* m_pScanner;
78
79   const int m_iNDet;
80   const int m_iNView;
81   const int m_iOffsetView;
82   const char* const m_pszGeometry;
83   const int m_iNSample;
84   const double m_dRotation;
85   const double m_dFocalLength;
86   const double m_dCenterDetectorLength;
87   const double m_dViewRatio;
88   const double m_dScanRatio;
89   const wxString m_strLabel;
90
91
92 public:
93    ProjectorSupervisor (SupervisorThread* pThread, PhantomFileView* pProjView, int iNDet, int iNView,  int iOffsetView,
94    const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
95    double dViewRatio, double dScanRatio, wxChar const* pszLabel);
96
97    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
98
99    virtual ~ProjectorSupervisor ();
100
101   void onDone();
102
103   Projections* getProjections();
104
105 };
106
107
108
109
110 class ProjectorWorker : public BackgroundWorkerThread {
111 private:
112   PhantomFileView* m_pPhantomView;
113   Projections* m_pProjections;
114   Scanner* m_pScanner;
115   int m_iNDet;
116   int m_iNView;
117   int m_iOffsetView;
118   const char* m_pszGeometry;
119   int m_iNSample;
120   double m_dRotation;
121   double m_dFocalLength;
122   double m_dCenterDetectorLength;
123   double m_dViewRatio;
124   double m_dScanRatio;
125
126
127 public:
128   ProjectorWorker (ProjectorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
129     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
130   {}
131
132   void SetParameters (PhantomFileView* pPhantomFile, Projections* pProjections, Scanner* pScanner,
133    int iNDet, int iView, int iOffsetView,
134    const char* const pszGeometry, int iNSample, double dRotation, double dFocalLength, double dCenterDetectorLength,
135    double dViewRatio, double dScanRatio);
136
137   virtual wxThread::ExitCode Entry();      // thread execution starts here
138
139   virtual void OnExit();
140 };
141
142
143 #endif // HAVE_WXTHREADS
144 #endif // _THREADPROJ_H_
145