1 /*****************************************************************************
5 ** Purpose: Header file for thread reconstructions
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: February 2001
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2009 Kevin Rosenberg
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.
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.
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 ******************************************************************************/
26 #ifndef _THREADRECON_H
27 #define _THREADRECON_H
33 #include <wx/thread.h>
34 #include <wx/progdlg.h>
36 #include "backgroundsupr.h"
41 class ProjectionFileDocument;
42 class ReconstructorWorker;
43 class ProjectionFileView;
44 struct ReconstructionROI;
46 class ReconstructorSupervisorThread : public SupervisorThread {
48 ProjectionFileView* m_pProjView;
49 ImageFile* m_pImageFile;
52 const std::string m_strFilterName;
53 const double m_dFilterParam;
54 const std::string m_strFilterMethod;
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;
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);
70 virtual wxThread::ExitCode Entry();
72 virtual void OnExit();
77 class ReconstructorSupervisor : public BackgroundSupervisor {
80 std::vector<ImageFile*> m_vecpChildImageFile;
81 const Projections* m_pProj;
82 ProjectionFileView* m_pProjView;
83 ProjectionFileDocument* m_pProjDoc;
88 const char* const m_pszFilterName;
89 const double m_dFilterParam;
90 const char* const m_pszFilterMethod;
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;
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);
105 virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
107 virtual ~ReconstructorSupervisor ();
111 ImageFile* getImageFile();
116 class ReconstructorWorker : public BackgroundWorkerThread {
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;
125 const char* m_pszFilterGenerationName;
126 const char* m_pszInterpName;
128 const char* m_pszBackprojectName;
129 ReconstructionROI* m_pReconROI;
132 ReconstructorWorker (ReconstructorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
133 : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
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);
141 virtual wxThread::ExitCode Entry(); // thread execution starts here
143 virtual void OnExit();
146 #endif // HAVE_WXTHREADS
147 #endif // _THREADRECON_H_