0553b1afa6e201f4eaea1629c6910c23e1ab09e5
[ctsim.git] / src / dialogs.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          dialogs.h
5 **   Purpose:       Header file for Dialogs of CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: dialogs.h,v 1.19 2001/01/03 22:01: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
29 #ifndef __DIALOGSH__
30 #define __DIALOGSH__
31
32 #include "wx/wx.h"
33 #include <string>
34 #include "ctsupport.h"
35 #include "scanner.h"
36 #include "phantom.h"
37 #include "procsignal.h"
38 #include "filter.h"
39
40
41 // CLASS StringValueAndTitleListBox
42 //
43 // A superclass of wxListBox that can handle string values and titles
44 // and by displaying the title in the list box and returning the string value
45
46 class StringValueAndTitleListBox : public wxListBox
47 {
48  public:
49   StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]);
50
51     const char* getSelectionStringValue () const;
52
53  private:
54     const char** m_ppszValues;
55 };
56
57
58 class DialogGetPhantom : public wxDialog
59 {
60  public:
61     DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN);
62     virtual ~DialogGetPhantom () {}
63
64     const char* getPhantom ();
65
66  private:
67     StringValueAndTitleListBox* m_pListBoxPhantom;
68 };
69
70
71 #include <vector>
72 class ImageFileDocument;
73 class DialogGetComparisonImage : public wxDialog
74 {
75  public:
76    DialogGetComparisonImage (wxFrame* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference);
77     virtual ~DialogGetComparisonImage () {}
78
79     ImageFileDocument* getImageFileDocument ();
80
81     bool getMakeDifferenceImage();
82
83  private:
84     wxListBox* m_pListBoxImageChoices;
85     wxCheckBox* m_pMakeDifferenceImage;
86     const std::vector<ImageFileDocument*>& m_rVecIF;
87 };
88
89
90 class ImageFile;
91 class DialogGetMinMax : public wxDialog
92 {
93  public:
94     DialogGetMinMax (wxFrame* pParent, const char* const pszTitle, double dDefaultMin = 0., double dDefaultMax = 0.);
95     virtual ~DialogGetMinMax ();
96
97     double getMinimum ();
98     double getMaximum ();
99
100  private:
101     wxTextCtrl* m_pTextCtrlMin;
102     wxTextCtrl* m_pTextCtrlMax;
103
104     double m_dDefaultMin;
105     double m_dDefaultMax;
106 };
107
108
109 class DialogGetRasterParameters : public wxDialog
110 {
111  public:
112     DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultNSamples = 1);
113     virtual ~DialogGetRasterParameters ();
114
115     unsigned int getXSize ();
116     unsigned int getYSize ();
117     unsigned int getNSamples ();
118
119  private:
120     wxTextCtrl* m_pTextCtrlXSize;
121     wxTextCtrl* m_pTextCtrlYSize;
122     wxTextCtrl* m_pTextCtrlNSamples;
123
124     int m_iDefaultXSize;
125     int m_iDefaultYSize;
126     int m_iDefaultNSamples;
127 };
128
129
130 class DialogGetProjectionParameters : public wxDialog
131 {
132  public:
133     DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., double dDefaultFocalLength = 1, double dDefaultFieldOfView = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
134     ~DialogGetProjectionParameters ();
135
136     unsigned int getNDet ();
137     unsigned int getNView ();
138     unsigned int getNSamples ();
139     int getTrace ();
140
141     double getRotAngle ();
142     double getFieldOfViewRatio ();
143     double getFocalLengthRatio ();
144     const char* getGeometry();
145
146  private:
147     wxTextCtrl* m_pTextCtrlNDet;
148     wxTextCtrl* m_pTextCtrlNView;
149     wxTextCtrl* m_pTextCtrlNSamples;
150     wxTextCtrl* m_pTextCtrlRotAngle;
151     wxTextCtrl* m_pTextCtrlFocalLength;
152     wxTextCtrl* m_pTextCtrlFieldOfView;
153
154     StringValueAndTitleListBox* m_pListBoxGeometry;
155     StringValueAndTitleListBox* m_pListBoxTrace;
156
157     int m_iDefaultNDet;
158     int m_iDefaultNView;
159     int m_iDefaultNSamples;
160     int m_iDefaultTrace;
161     int m_iDefaultGeometry;
162     double m_dDefaultRotAngle;
163     double m_dDefaultFocalLength;
164     double m_dDefaultFieldOfView;
165 };
166
167
168 #include "backprojectors.h"
169 class DialogGetReconstructionParameters : public wxDialog
170 {
171  public:
172     DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_INVALID, int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF3, int iDefaultTrace = Trace::TRACE_NONE);
173     virtual ~DialogGetReconstructionParameters ();
174
175     unsigned int getXSize();
176     unsigned int getYSize();
177     const char* getFilterName();
178     double getFilterParam();
179     const char* getFilterMethodName();
180     unsigned int getZeropad();
181     const char* getFilterGenerationName();
182     const char* getInterpName();
183     unsigned int getInterpParam();
184     const char* getBackprojectName();
185     int getTrace ();
186
187  private:
188     wxTextCtrl* m_pTextCtrlXSize;
189     wxTextCtrl* m_pTextCtrlYSize;
190     wxTextCtrl* m_pTextCtrlZeropad;
191     wxTextCtrl* m_pTextCtrlFilterParam;
192     wxTextCtrl* m_pTextCtrlInterpParam;
193
194     StringValueAndTitleListBox* m_pListBoxFilter;
195     StringValueAndTitleListBox* m_pListBoxFilterMethod;
196     StringValueAndTitleListBox* m_pListBoxFilterGeneration;
197     StringValueAndTitleListBox* m_pListBoxInterp;
198     StringValueAndTitleListBox* m_pListBoxBackproject;
199     StringValueAndTitleListBox* m_pListBoxTrace;
200
201     int m_iDefaultXSize;
202     int m_iDefaultYSize;
203     double m_dDefaultFilterParam;
204     int m_iDefaultZeropad;
205     int m_iDefaultInterpParam;
206     int m_iDefaultTrace;
207 };
208
209
210 class DialogGetFilterParameters : public wxDialog
211 {
212  public:
213     DialogGetFilterParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultFilterID = SignalFilter::FILTER_BANDLIMIT, double dDefaultFilterParam = 1., double dDefaultBandwidth = 1., int iDefaultDomain = SignalFilter::DOMAIN_SPATIAL, double dDefaultInputScale = 1., double dDefaultOutputScale = 1.);
214     virtual ~DialogGetFilterParameters ();
215
216     unsigned int getXSize();
217     unsigned int getYSize();
218     const char* getFilterName();
219     const char* getDomainName();
220     double getFilterParam();
221     double getInputScale();
222     double getOutputScale();
223     double getBandwidth();
224
225  private:
226     wxTextCtrl* m_pTextCtrlXSize;
227     wxTextCtrl* m_pTextCtrlYSize;
228     wxTextCtrl* m_pTextCtrlFilterParam;
229     wxTextCtrl* m_pTextCtrlOutputScale;
230     wxTextCtrl* m_pTextCtrlInputScale;
231     wxTextCtrl* m_pTextCtrlBandwidth;
232
233     StringValueAndTitleListBox* m_pListBoxFilter;
234     StringValueAndTitleListBox* m_pListBoxDomain;
235
236     int m_iDefaultXSize;
237     int m_iDefaultYSize;
238     double m_dDefaultFilterParam;
239     double m_dDefaultBandwidth;
240     double m_dDefaultOutputScale;
241     double m_dDefaultInputScale;
242     int m_iDefaultDomain;
243 };
244
245 class DialogExportParameters : public wxDialog
246 {
247  public:
248     DialogExportParameters (wxFrame* pParent, int iDefaultFormatID);
249     virtual ~DialogExportParameters () {}
250
251     const char* getFormatName();
252
253  private:
254     StringValueAndTitleListBox* m_pListBoxFormat;
255 };
256
257 class DialogAutoScaleParameters : public wxDialog
258 {
259  public:
260     DialogAutoScaleParameters (wxFrame* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
261     virtual ~DialogAutoScaleParameters() {}
262
263     bool getMinMax (double* pMin, double* pMax);
264     double getAutoScaleFactor ();
265
266  private:
267     const double m_dMean;
268         const double m_dMode;
269         const double m_dMedian;
270         const double m_dStdDev;
271
272     wxTextCtrl* m_pTextCtrlStdDevFactor;
273     wxListBox* m_pListBoxCenter;
274 };
275
276 class DialogGetXYSize : public wxDialog
277 {
278  public:
279     DialogGetXYSize (wxFrame* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
280     virtual ~DialogGetXYSize ();
281
282     unsigned int getXSize ();
283     unsigned int getYSize ();
284
285  private:
286     wxTextCtrl* m_pTextCtrlXSize;
287     wxTextCtrl* m_pTextCtrlYSize;
288
289     unsigned int m_iDefaultXSize;
290     unsigned int m_iDefaultYSize;
291 };
292
293
294 #endif
295