Update copyright date; remove old CVS keyword
[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-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 _THREADRECON_H
27 #define _THREADRECON_H
28
29 #ifdef HAVE_WXTHREADS
30
31
32 #include <vector>
33 #include <wx/thread.h>
34 #include <wx/progdlg.h>
35 #include "timer.h"
36 #include "backgroundsupr.h"
37
38
39 class Reconstructor;
40 class ImageFile;
41 class ProjectionFileDocument;
42 class ReconstructorWorker;
43 class ProjectionFileView;
44 struct ReconstructionROI;
45
46 class ReconstructorSupervisorThread : public SupervisorThread {
47 private:
48   ProjectionFileView* m_pProjView;
49   ImageFile* m_pImageFile;
50   const int m_iNX;
51   const int m_iNY;
52   const std::string m_strFilterName;
53   const double m_dFilterParam;
54   const std::string m_strFilterMethod;
55   const int m_iZeropad;
56   const std::string m_strFilterGenerationName;
57   const std::string m_strInterpName;
58   const int m_iInterpParam;
59   const std::string m_strBackprojectName;
60   const wxString m_strLabel;
61   ReconstructionROI m_reconROI;
62   const bool m_bRebinToParallel;
63
64 public:
65   ReconstructorSupervisorThread(ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName,
66    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName,
67    const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, wxChar const* pszLabel,
68    ReconstructionROI* pROI, bool bRebinToParallel);
69
70   virtual wxThread::ExitCode Entry();
71
72   virtual void OnExit();
73 };
74
75
76
77 class ReconstructorSupervisor : public BackgroundSupervisor {
78 private:
79
80   std::vector<ImageFile*> m_vecpChildImageFile;
81   const Projections* m_pProj;
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 wxString m_strLabel;
97   ReconstructionROI* m_pReconROI;
98
99 public:
100    ReconstructorSupervisor (SupervisorThread* pMyThread, Projections* pProj, ProjectionFileView* pProjView,
101    int iNX, int iNY, const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad,
102    const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam,
103    const char* pszBackprojectName, wxChar const* pszLabel, 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 class ReconstructorWorker : public BackgroundWorkerThread {
117 private:
118   const Projections* m_pProj;
119   ProjectionFileView* m_pProjView;
120   ImageFile* m_pImageFile;
121   const char* m_pszFilterName;
122   double m_dFilterParam;
123   const char* m_pszFilterMethod;
124   int m_iZeropad;
125   const char* m_pszFilterGenerationName;
126   const char* m_pszInterpName;
127   int m_iInterpParam;
128   const char* m_pszBackprojectName;
129   ReconstructionROI* m_pReconROI;
130
131 public:
132   ReconstructorWorker (ReconstructorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
133     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
134   {}
135
136   void SetParameters (const Projections* pProj, ProjectionFileView* pProjFile, ImageFile* pImageFile,
137    const char* const pszFilterName, double dFilterParam, const char* const pszFilterMethod,
138    int iZeropad, const char* const pszFilterGenerationName, const char* const pszInterpName, int iInterpParam,
139    const char* pszBackprojectName, ReconstructionROI* pROI);
140
141   virtual wxThread::ExitCode Entry();      // thread execution starts here
142
143   virtual void OnExit();
144 };
145
146 #endif // HAVE_WXTHREADS
147 #endif // _THREADRECON_H_
148