Applied initial patches for wx2.8 compatibility
[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$
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 wxString m_strLabel;
63   ReconstructionROI m_reconROI;
64   const bool m_bRebinToParallel;
65
66 public:
67   ReconstructorSupervisorThread(ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName,
68    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName,
69    const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, wxChar const* pszLabel,
70    ReconstructionROI* pROI, bool bRebinToParallel);
71
72   virtual wxThread::ExitCode Entry();
73
74   virtual void OnExit();
75 };
76
77
78
79 class ReconstructorSupervisor : public BackgroundSupervisor {
80 private:
81
82   std::vector<ImageFile*> m_vecpChildImageFile;
83   const Projections* m_pProj;
84   ProjectionFileView* m_pProjView;
85   ProjectionFileDocument* m_pProjDoc;
86
87   const int m_iImageNX;
88   const int m_iImageNY;
89
90   const char* const m_pszFilterName;
91   const double m_dFilterParam;
92   const char* const m_pszFilterMethod;
93   const int m_iZeropad;
94   const char* const m_pszFilterGenerationName;
95   const char* const m_pszInterpName;
96   const int m_iInterpParam;
97   const char* const m_pszBackprojectName;
98   const wxString m_strLabel;
99   ReconstructionROI* m_pReconROI;
100
101 public:
102    ReconstructorSupervisor (SupervisorThread* pMyThread, Projections* pProj, ProjectionFileView* pProjView,
103    int iNX, int iNY, const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad,
104    const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam,
105    const char* pszBackprojectName, wxChar const* pszLabel, ReconstructionROI* pReconROI);
106
107    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
108
109    virtual ~ReconstructorSupervisor ();
110
111   void onDone();
112
113   ImageFile* getImageFile();
114
115 };
116
117
118 class ReconstructorWorker : public BackgroundWorkerThread {
119 private:
120   const Projections* m_pProj;
121   ProjectionFileView* m_pProjView;
122   ImageFile* m_pImageFile;
123   const char* m_pszFilterName;
124   double m_dFilterParam;
125   const char* m_pszFilterMethod;
126   int m_iZeropad;
127   const char* m_pszFilterGenerationName;
128   const char* m_pszInterpName;
129   int m_iInterpParam;
130   const char* m_pszBackprojectName;
131   ReconstructionROI* m_pReconROI;
132
133 public:
134   ReconstructorWorker (ReconstructorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
135     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
136   {}
137
138   void SetParameters (const Projections* pProj, ProjectionFileView* pProjFile, ImageFile* pImageFile,
139    const char* const pszFilterName, double dFilterParam, const char* const pszFilterMethod,
140    int iZeropad, const char* const pszFilterGenerationName, const char* const pszInterpName, int iInterpParam,
141    const char* pszBackprojectName, ReconstructionROI* pROI);
142
143   virtual wxThread::ExitCode Entry();      // thread execution starts here
144
145   virtual void OnExit();
146 };
147
148 #endif // HAVE_WXTHREADS
149 #endif // _THREADRECON_H_
150