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