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