r598: no message
[ctsim.git] / src / threadraster.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          threadraster.h
5 **   Purpose:       Header file for threaded rasterizations
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: threadraster.h,v 1.2 2001/03/02 21:11:50 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 _THREADRASTER_H
29 #define _THREADRASTER_H
30
31 #ifdef HAVE_WXTHREADS
32
33 #include <vector>
34 #include <wx/thread.h>
35 #include <wx/progdlg.h>
36 #include "timer.h"
37 #include "backgroundsupr.h"
38
39
40 class Reconstructor;
41 class ImageFile;
42 class PhantomFileDocument;
43 class RasterizerWorker;
44 class ImageFileView;
45
46 class RasterizerSupervisorThread : public SupervisorThread {
47 private:
48   PhantomFileView* m_pPhantomView;
49   const int m_iNX;
50   const int m_iNY;
51   const int m_iNSample;
52   const double m_dViewRatio;
53   const std::string m_strLabel;
54
55 public:
56   RasterizerSupervisorThread(PhantomFileView* pProjView, int iNX, int iNY, int iNSample, double dViewRatio, const char* const pszLabel);
57
58   virtual wxThread::ExitCode Entry();
59
60   virtual void OnExit();
61 };
62
63
64
65 class RasterizerSupervisor : public BackgroundSupervisor {
66 private:
67
68   std::vector<ImageFile*> m_vecpChildImageFiles;
69   PhantomFileDocument* m_pPhantomDoc;
70   PhantomFileView* m_pPhantomView;
71   
72   const int m_iNX;
73   const int m_iNY;
74   const int m_iNSample;
75   const double m_dViewRatio;
76   const char* const m_pszLabel;
77
78
79 public:
80    RasterizerSupervisor (SupervisorThread* pThread, PhantomFileView* pProjView, int iNX, int iNY, 
81    int iNSample, double dViewRatio, const char* const pszLabel);
82
83    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
84
85    virtual ~RasterizerSupervisor ();
86
87   void onDone();
88
89   ImageFile* getImageFile();
90
91 };
92
93
94
95
96 class RasterizerWorker : public BackgroundWorkerThread {
97 private:
98   PhantomFileView* m_pPhantomView;
99   ImageFile* m_pImageFile;
100   int m_iNX;
101   int m_iNY;
102   int m_iNSample;
103   double m_dViewRatio;
104
105
106 public:
107   RasterizerWorker (RasterizerSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews) 
108     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
109   {}
110   
111   void SetParameters (PhantomFileView* pPhantomFile, ImageFile* pImageFile, int iNX, int iY, 
112    int iNSample, double dViewRatio);
113
114   virtual wxThread::ExitCode Entry();      // thread execution starts here
115
116   virtual void OnExit();
117 };
118
119 #endif // HAVE_WXTHREADS
120 #endif // _THREADRASTER_H_
121