r631: no message
[ctsim.git] / src / threadrecon.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          threadrecon.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: threadrecon.h,v 1.13 2001/03/11 15:27:30 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 _THREADRECON_H
29 #define _THREADRECON_H
30
31 #ifdef HAVE_WXTHREADS
32
33
34 #include <vector>
35 #include <wx/thread.h>
36 #include <wx/progdlg.h>
37 #include "timer.h"
38 #include "backgroundsupr.h"
39
40
41 class Reconstructor;
42 class ImageFile;
43 class ProjectionFileDocument;
44 class ReconstructorWorker;
45 class ProjectionFileView;
46 struct ReconstructionROI;
47
48 class ReconstructorSupervisorThread : public SupervisorThread {
49 private:
50   ProjectionFileView* m_pProjView;
51   ImageFile* m_pImageFile;
52   const int m_iNX;
53   const int m_iNY;
54   const std::string m_strFilterName;
55   const double m_dFilterParam;
56   const std::string m_strFilterMethod;
57   const int m_iZeropad;
58   const std::string m_strFilterGenerationName;
59   const std::string m_strInterpName;
60   const int m_iInterpParam;
61   const std::string m_strBackprojectName;
62   const std::string m_strLabel;
63   ReconstructionROI m_reconROI;
64
65 public:
66   ReconstructorSupervisorThread(ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, 
67    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, 
68    const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel,
69    ReconstructionROI* pROI);
70
71   virtual wxThread::ExitCode Entry();
72
73   virtual void OnExit();
74 };
75
76
77
78 class ReconstructorSupervisor : public BackgroundSupervisor {
79 private:
80
81   std::vector<ImageFile*> m_vecpChildImageFile;
82   ProjectionFileView* m_pProjView;
83   ProjectionFileDocument* m_pProjDoc;
84     
85   const int m_iImageNX;
86   const int m_iImageNY;
87
88   const char* const m_pszFilterName;
89   const double m_dFilterParam;
90   const char* const m_pszFilterMethod;
91   const int m_iZeropad;
92   const char* const m_pszFilterGenerationName;
93   const char* const m_pszInterpName;
94   const int m_iInterpParam;
95   const char* const m_pszBackprojectName;
96   const char* const m_pszLabel;
97   ReconstructionROI* m_pReconROI;
98
99 public:
100    ReconstructorSupervisor (SupervisorThread* pMyThread, ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, 
101    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, 
102    const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel,
103    ReconstructionROI* pReconROI);
104
105    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
106
107    virtual ~ReconstructorSupervisor ();
108
109   void onDone();
110
111   ImageFile* getImageFile();
112
113 };
114
115
116
117
118 class ReconstructorWorker : public BackgroundWorkerThread {
119 private:
120   ProjectionFileView* m_pProjView;
121   ImageFile* m_pImageFile;
122   const char* m_pszFilterName;
123   double m_dFilterParam;
124   const char* m_pszFilterMethod;
125   int m_iZeropad;
126   const char* m_pszFilterGenerationName;
127   const char* m_pszInterpName;
128   int m_iInterpParam;
129   const char* m_pszBackprojectName;
130   ReconstructionROI* m_pReconROI;
131
132 public:
133   ReconstructorWorker (ReconstructorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews) 
134     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
135   {}
136   
137   void SetParameters (ProjectionFileView* pProjFile, ImageFile* pImageFile, 
138    const char* const pszFilterName, double dFilterParam, const char* const pszFilterMethod, 
139    int iZeropad, const char* const pszFilterGenerationName, const char* const pszInterpName, int iInterpParam,
140    const char* pszBackprojectName, ReconstructionROI* pROI);
141
142   virtual wxThread::ExitCode Entry();      // thread execution starts here
143
144   virtual void OnExit();
145 };
146
147 #endif // HAVE_WXTHREADS
148 #endif // _THREADRECON_H_
149