r521: no message
[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-2001 Kevin Rosenberg
11 **
12 **  $Id: dialogs.h,v 1.25 2001/02/11 21:57:08 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 #include "projections.h"
40
41
42 // CLASS StringValueAndTitleListBox
43 //
44 // A superclass of wxListBox that can handle string values and titles
45 // and by displaying the title in the list box and returning the string value
46
47 class StringValueAndTitleListBox : public wxListBox
48 {
49  public:
50   StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]);
51
52     const char* getSelectionStringValue () const;
53
54  private:
55     const char** m_ppszValues;
56 };
57
58
59 class DialogGetPhantom : public wxDialog
60 {
61  public:
62     DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN);
63     virtual ~DialogGetPhantom () {}
64
65     const char* getPhantom ();
66
67  private:
68     StringValueAndTitleListBox* m_pListBoxPhantom;
69 };
70
71
72 #include <vector>
73 class ImageFileDocument;
74 class DialogGetComparisonImage : public wxDialog
75 {
76  public:
77    DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference);
78     virtual ~DialogGetComparisonImage () {}
79
80     ImageFileDocument* getImageFileDocument ();
81
82     bool getMakeDifferenceImage();
83
84  private:
85     wxListBox* m_pListBoxImageChoices;
86     wxCheckBox* m_pMakeDifferenceImage;
87     const std::vector<ImageFileDocument*>& m_rVecIF;
88 };
89
90
91 class DialogPreferences : public wxDialog
92 {
93  public:
94     DialogPreferences (wxWindow* pParent, const char* const pszTitle, bool bAdvanced, bool bAskNewDocs);
95     virtual ~DialogPreferences ();
96
97     bool getAdvancedOptions ();
98     bool getAskDeleteNewDocs ();
99
100  private:
101     wxCheckBox* m_pCBAdvancedOptions;
102     wxCheckBox* m_pCBAskDeleteNewDocs;
103 };
104
105
106 class ImageFile;
107 class DialogGetMinMax : public wxDialog
108 {
109  public:
110     DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin = 0., double dDefaultMax = 0.);
111     virtual ~DialogGetMinMax ();
112
113     double getMinimum ();
114     double getMaximum ();
115
116  private:
117     wxTextCtrl* m_pTextCtrlMin;
118     wxTextCtrl* m_pTextCtrlMax;
119
120     double m_dDefaultMin;
121     double m_dDefaultMax;
122 };
123
124
125 class DialogGetRasterParameters : public wxDialog
126 {
127  public:
128     DialogGetRasterParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
129       int iDefaultNSamples = 1, double dDefaultViewRatio = 1);
130     virtual ~DialogGetRasterParameters ();
131
132     unsigned int getXSize ();
133     unsigned int getYSize ();
134     unsigned int getNSamples ();
135     double getViewRatio();
136
137  private:
138     wxTextCtrl* m_pTextCtrlXSize;
139     wxTextCtrl* m_pTextCtrlYSize;
140     wxTextCtrl* m_pTextCtrlNSamples;
141     wxTextCtrl* m_pTextCtrlViewRatio;
142
143     int m_iDefaultXSize;
144     int m_iDefaultYSize;
145     int m_iDefaultNSamples;
146     double m_dDefaultViewRatio;
147 };
148
149
150 class DialogGetProjectionParameters : public wxDialog
151 {
152  public:
153     DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet = 0, 
154       int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., 
155       double dDefaultFocalLength = 1, double dDefaultViewRatio = 1., 
156       double dDefaultScanRatio = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
157     ~DialogGetProjectionParameters ();
158
159     unsigned int getNDet ();
160     unsigned int getNView ();
161     unsigned int getNSamples ();
162     int getTrace ();
163
164     double getRotAngle ();
165     double getViewRatio ();
166     double getScanRatio ();
167     double getFocalLengthRatio ();
168     const char* getGeometry();
169
170  private:
171     wxTextCtrl* m_pTextCtrlNDet;
172     wxTextCtrl* m_pTextCtrlNView;
173     wxTextCtrl* m_pTextCtrlNSamples;
174     wxTextCtrl* m_pTextCtrlRotAngle;
175     wxTextCtrl* m_pTextCtrlFocalLength;
176     wxTextCtrl* m_pTextCtrlViewRatio;
177     wxTextCtrl* m_pTextCtrlScanRatio;
178     StringValueAndTitleListBox* m_pListBoxGeometry;
179     StringValueAndTitleListBox* m_pListBoxTrace;
180
181     int m_iDefaultNDet;
182     int m_iDefaultNView;
183     int m_iDefaultNSamples;
184     int m_iDefaultTrace;
185     int m_iDefaultGeometry;
186     double m_dDefaultRotAngle;
187     double m_dDefaultFocalLength;
188     double m_dDefaultViewRatio;
189     double m_dDefaultScanRatio;
190 };
191
192
193 #include "backprojectors.h"
194 class DialogGetReconstructionParameters : public wxDialog
195 {
196  public:
197     DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
198       int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., 
199       int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, 
200       int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT, 
201       int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, 
202       int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF, 
203       int iDefaultTrace = Trace::TRACE_NONE);
204     virtual ~DialogGetReconstructionParameters ();
205
206     unsigned int getXSize();
207     unsigned int getYSize();
208     const char* getFilterName();
209     double getFilterParam();
210     const char* getFilterMethodName();
211     unsigned int getZeropad();
212     const char* getFilterGenerationName();
213     const char* getInterpName();
214     unsigned int getInterpParam();
215     const char* getBackprojectName();
216     int getTrace ();
217
218  private:
219     wxTextCtrl* m_pTextCtrlXSize;
220     wxTextCtrl* m_pTextCtrlYSize;
221     wxTextCtrl* m_pTextCtrlZeropad;
222     wxTextCtrl* m_pTextCtrlFilterParam;
223     wxTextCtrl* m_pTextCtrlInterpParam;
224
225     StringValueAndTitleListBox* m_pListBoxFilter;
226     StringValueAndTitleListBox* m_pListBoxFilterMethod;
227     StringValueAndTitleListBox* m_pListBoxFilterGeneration;
228     StringValueAndTitleListBox* m_pListBoxInterp;
229     StringValueAndTitleListBox* m_pListBoxBackproject;
230     StringValueAndTitleListBox* m_pListBoxTrace;
231
232     int m_iDefaultXSize;
233     int m_iDefaultYSize;
234     double m_dDefaultFilterParam;
235     int m_iDefaultZeropad;
236     int m_iDefaultInterpParam;
237     int m_iDefaultTrace;
238 };
239
240
241 class DialogGetFilterParameters : public wxDialog
242 {
243  public:
244     DialogGetFilterParameters (wxWindow* 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.);
245     virtual ~DialogGetFilterParameters ();
246
247     unsigned int getXSize();
248     unsigned int getYSize();
249     const char* getFilterName();
250     const char* getDomainName();
251     double getFilterParam();
252     double getInputScale();
253     double getOutputScale();
254     double getBandwidth();
255
256  private:
257     wxTextCtrl* m_pTextCtrlXSize;
258     wxTextCtrl* m_pTextCtrlYSize;
259     wxTextCtrl* m_pTextCtrlFilterParam;
260     wxTextCtrl* m_pTextCtrlOutputScale;
261     wxTextCtrl* m_pTextCtrlInputScale;
262     wxTextCtrl* m_pTextCtrlBandwidth;
263
264     StringValueAndTitleListBox* m_pListBoxFilter;
265     StringValueAndTitleListBox* m_pListBoxDomain;
266
267     int m_iDefaultXSize;
268     int m_iDefaultYSize;
269     double m_dDefaultFilterParam;
270     double m_dDefaultBandwidth;
271     double m_dDefaultOutputScale;
272     double m_dDefaultInputScale;
273     int m_iDefaultDomain;
274 };
275
276 class DialogExportParameters : public wxDialog
277 {
278  public:
279     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
280     virtual ~DialogExportParameters () {}
281
282     const char* getFormatName();
283
284  private:
285     StringValueAndTitleListBox* m_pListBoxFormat;
286 };
287
288 class DialogAutoScaleParameters : public wxDialog
289 {
290  public:
291     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
292     virtual ~DialogAutoScaleParameters() {}
293
294     bool getMinMax (double* pMin, double* pMax);
295     double getAutoScaleFactor ();
296
297  private:
298     const double m_dMean;
299         const double m_dMode;
300         const double m_dMedian;
301         const double m_dStdDev;
302
303     wxTextCtrl* m_pTextCtrlStdDevFactor;
304     wxListBox* m_pListBoxCenter;
305 };
306
307 class DialogGetXYSize : public wxDialog
308 {
309  public:
310     DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
311     virtual ~DialogGetXYSize ();
312
313     unsigned int getXSize ();
314     unsigned int getYSize ();
315
316  private:
317     wxTextCtrl* m_pTextCtrlXSize;
318     wxTextCtrl* m_pTextCtrlYSize;
319
320     unsigned int m_iDefaultXSize;
321     unsigned int m_iDefaultYSize;
322 };
323
324
325 class DialogGetConvertPolarParameters : public wxDialog
326 {
327  public:
328    DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 0, 
329      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR, 
330      int iDefaultZeropad = 1);
331    virtual ~DialogGetConvertPolarParameters ();
332
333     unsigned int getXSize();
334     unsigned int getYSize();
335     const char* getInterpolationName();
336     unsigned int getZeropad();
337
338  private:
339     wxTextCtrl* m_pTextCtrlXSize;
340     wxTextCtrl* m_pTextCtrlYSize;
341     wxTextCtrl* m_pTextCtrlZeropad;
342
343     StringValueAndTitleListBox* m_pListBoxInterpolation;
344
345     int m_iDefaultXSize;
346     int m_iDefaultYSize;
347     int m_iDefaultZeropad;
348 };
349
350
351 #endif
352