r582: 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.9 2001/02/25 10:52:55 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 #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 ProjectionFileDocument;
41 class ReconstructorWorker;
42 class ProjectionFileView;
43
44 class ReconstructorSupervisorThread : public SupervisorThread {
45 private:
46   ProjectionFileView* m_pProjView;
47   ImageFile* m_pImageFile;
48   const int m_iNX;
49   const int m_iNY;
50   const std::string m_strFilterName;
51   const double m_dFilterParam;
52   const std::string m_strFilterMethod;
53   const int m_iZeropad;
54   const std::string m_strFilterGenerationName;
55   const std::string m_strInterpName;
56   const int m_iInterpParam;
57   const std::string m_strBackprojectName;
58   const std::string m_strLabel;
59
60 public:
61   ReconstructorSupervisorThread(ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, 
62    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, 
63    const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel);
64
65   virtual wxThread::ExitCode Entry();
66
67   virtual void OnExit();
68 };
69
70
71
72 class ReconstructorSupervisor : public BackgroundSupervisor {
73 private:
74
75   std::vector<ImageFile*> m_vecpChildImageFile;
76   ProjectionFileDocument* m_pProjDoc;
77   ProjectionFileView* m_pProjView;
78     
79   const int m_iImageNX;
80   const int m_iImageNY;
81
82   const char* const m_pszFilterName;
83   const double m_dFilterParam;
84   const char* const m_pszFilterMethod;
85   const int m_iZeropad;
86   const char* const m_pszFilterGenerationName;
87   const char* const m_pszInterpName;
88   const int m_iInterpParam;
89   const char* const m_pszBackprojectName;
90   const char* const m_pszLabel;
91
92 public:
93    ReconstructorSupervisor (ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, 
94    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, 
95    const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel);
96
97    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
98
99    virtual ~ReconstructorSupervisor ();
100
101   void onDone();
102
103   ImageFile* getImageFile();
104
105 };
106
107
108
109
110 class ReconstructorWorker : public BackgroundWorkerThread {
111 private:
112   ProjectionFileView* m_pProjView;
113   ImageFile* m_pImageFile;
114   const char* m_pszFilterName;
115   double m_dFilterParam;
116   const char* m_pszFilterMethod;
117   int m_iZeropad;
118   const char* m_pszFilterGenerationName;
119   const char* m_pszInterpName;
120   int m_iInterpParam;
121   const char* m_pszBackprojectName;
122
123 public:
124   ReconstructorWorker (ReconstructorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews) 
125     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
126   {}
127   
128   void SetParameters (ProjectionFileView* pProjFile, ImageFile* pImageFile, 
129    const char* const pszFilterName, double dFilterParam, const char* const pszFilterMethod, 
130    int iZeropad, const char* const pszFilterGenerationName, const char* const pszInterpName, int iInterpParam,
131    const char* pszBackprojectName);
132
133   virtual wxThread::ExitCode Entry();      // thread execution starts here
134
135   virtual void OnExit();
136 };
137
138
139 #endif
140