r570: 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.29 2001/02/22 00:56: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 #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       bool bVerboseLogging, bool bStartupTips);
117     virtual ~DialogPreferences ();
118
119     bool getAdvancedOptions ();
120     bool getAskDeleteNewDocs ();
121     bool getVerboseLogging ();
122     bool getStartupTips ();
123
124  private:
125     wxCheckBox* m_pCBAdvancedOptions;
126     wxCheckBox* m_pCBAskDeleteNewDocs;
127     wxCheckBox* m_pCBVerboseLogging;
128     wxCheckBox* m_pCBStartupTips;
129 };
130
131
132 class ImageFile;
133 class DialogGetMinMax : public wxDialog
134 {
135  public:
136     DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin = 0., double dDefaultMax = 0.);
137     virtual ~DialogGetMinMax ();
138
139     double getMinimum ();
140     double getMaximum ();
141
142  private:
143     wxTextCtrl* m_pTextCtrlMin;
144     wxTextCtrl* m_pTextCtrlMax;
145
146     double m_dDefaultMin;
147     double m_dDefaultMax;
148 };
149
150
151 class DialogGetRasterParameters : public wxDialog
152 {
153  public:
154     DialogGetRasterParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
155       int iDefaultNSamples = 1, double dDefaultViewRatio = 1);
156     virtual ~DialogGetRasterParameters ();
157
158     unsigned int getXSize ();
159     unsigned int getYSize ();
160     unsigned int getNSamples ();
161     double getViewRatio();
162
163  private:
164     wxTextCtrl* m_pTextCtrlXSize;
165     wxTextCtrl* m_pTextCtrlYSize;
166     wxTextCtrl* m_pTextCtrlNSamples;
167     wxTextCtrl* m_pTextCtrlViewRatio;
168
169     int m_iDefaultXSize;
170     int m_iDefaultYSize;
171     int m_iDefaultNSamples;
172     double m_dDefaultViewRatio;
173 };
174
175
176 class DialogGetProjectionParameters : public wxDialog
177 {
178  public:
179     DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet = 0, 
180       int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., 
181       double dDefaultFocalLength = 1, double dDefaultViewRatio = 1., 
182       double dDefaultScanRatio = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
183     ~DialogGetProjectionParameters ();
184
185     unsigned int getNDet ();
186     unsigned int getNView ();
187     unsigned int getNSamples ();
188     int getTrace ();
189
190     double getRotAngle ();
191     double getViewRatio ();
192     double getScanRatio ();
193     double getFocalLengthRatio ();
194     const char* getGeometry();
195
196  private:
197     wxTextCtrl* m_pTextCtrlNDet;
198     wxTextCtrl* m_pTextCtrlNView;
199     wxTextCtrl* m_pTextCtrlNSamples;
200     wxTextCtrl* m_pTextCtrlRotAngle;
201     wxTextCtrl* m_pTextCtrlFocalLength;
202     wxTextCtrl* m_pTextCtrlViewRatio;
203     wxTextCtrl* m_pTextCtrlScanRatio;
204     StringValueAndTitleRadioBox* m_pRadioBoxGeometry;
205     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
206
207     int m_iDefaultNDet;
208     int m_iDefaultNView;
209     int m_iDefaultNSamples;
210     int m_iDefaultTrace;
211     int m_iDefaultGeometry;
212     double m_dDefaultRotAngle;
213     double m_dDefaultFocalLength;
214     double m_dDefaultViewRatio;
215     double m_dDefaultScanRatio;
216 };
217
218
219 #include "backprojectors.h"
220 class DialogGetReconstructionParameters : public wxDialog
221 {
222  public:
223     DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
224       int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., 
225       int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, 
226       int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT, 
227       int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, 
228       int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF, 
229       int iDefaultTrace = Trace::TRACE_NONE);
230     virtual ~DialogGetReconstructionParameters ();
231
232     unsigned int getXSize();
233     unsigned int getYSize();
234     const char* getFilterName();
235     double getFilterParam();
236     const char* getFilterMethodName();
237     unsigned int getZeropad();
238     const char* getFilterGenerationName();
239     const char* getInterpName();
240     unsigned int getInterpParam();
241     const char* getBackprojectName();
242     int getTrace ();
243
244  private:
245     wxTextCtrl* m_pTextCtrlXSize;
246     wxTextCtrl* m_pTextCtrlYSize;
247     wxTextCtrl* m_pTextCtrlZeropad;
248     wxTextCtrl* m_pTextCtrlFilterParam;
249     wxTextCtrl* m_pTextCtrlInterpParam;
250
251     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
252     StringValueAndTitleRadioBox* m_pRadioBoxFilterMethod;
253     StringValueAndTitleRadioBox* m_pRadioBoxFilterGeneration;
254     StringValueAndTitleRadioBox* m_pRadioBoxInterp;
255     StringValueAndTitleRadioBox* m_pRadioBoxBackproject;
256     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
257
258     int m_iDefaultXSize;
259     int m_iDefaultYSize;
260     double m_dDefaultFilterParam;
261     int m_iDefaultZeropad;
262     int m_iDefaultInterpParam;
263     int m_iDefaultTrace;
264 };
265
266
267 class DialogGetFilterParameters : public wxDialog
268 {
269  public:
270     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.);
271     virtual ~DialogGetFilterParameters ();
272
273     unsigned int getXSize();
274     unsigned int getYSize();
275     const char* getFilterName();
276     const char* getDomainName();
277     double getFilterParam();
278     double getInputScale();
279     double getOutputScale();
280     double getBandwidth();
281
282  private:
283     wxTextCtrl* m_pTextCtrlXSize;
284     wxTextCtrl* m_pTextCtrlYSize;
285     wxTextCtrl* m_pTextCtrlFilterParam;
286     wxTextCtrl* m_pTextCtrlOutputScale;
287     wxTextCtrl* m_pTextCtrlInputScale;
288     wxTextCtrl* m_pTextCtrlBandwidth;
289
290     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
291     StringValueAndTitleRadioBox* m_pRadioBoxDomain;
292
293     int m_iDefaultXSize;
294     int m_iDefaultYSize;
295     double m_dDefaultFilterParam;
296     double m_dDefaultBandwidth;
297     double m_dDefaultOutputScale;
298     double m_dDefaultInputScale;
299     int m_iDefaultDomain;
300 };
301
302 class DialogExportParameters : public wxDialog
303 {
304  public:
305     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
306     virtual ~DialogExportParameters () {}
307
308     const char* getFormatName();
309
310  private:
311     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
312 };
313
314 class DialogAutoScaleParameters : public wxDialog
315 {
316  public:
317     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
318     virtual ~DialogAutoScaleParameters() {}
319
320     bool getMinMax (double* pMin, double* pMax);
321     double getAutoScaleFactor ();
322
323  private:
324     const double m_dMean;
325         const double m_dMode;
326         const double m_dMedian;
327         const double m_dStdDev;
328
329     wxTextCtrl* m_pTextCtrlStdDevFactor;
330     wxRadioBox* m_pRadioBoxCenter;
331 };
332
333 class DialogGetXYSize : public wxDialog
334 {
335  public:
336     DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
337     virtual ~DialogGetXYSize ();
338
339     unsigned int getXSize ();
340     unsigned int getYSize ();
341
342  private:
343     wxTextCtrl* m_pTextCtrlXSize;
344     wxTextCtrl* m_pTextCtrlYSize;
345
346     unsigned int m_iDefaultXSize;
347     unsigned int m_iDefaultYSize;
348 };
349
350
351 class DialogGetConvertPolarParameters : public wxDialog
352 {
353  public:
354    DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 0, 
355      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR, 
356      int iDefaultZeropad = 1);
357    virtual ~DialogGetConvertPolarParameters ();
358
359     unsigned int getXSize();
360     unsigned int getYSize();
361     const char* getInterpolationName();
362     unsigned int getZeropad();
363
364  private:
365     wxTextCtrl* m_pTextCtrlXSize;
366     wxTextCtrl* m_pTextCtrlYSize;
367     wxTextCtrl* m_pTextCtrlZeropad;
368
369     StringValueAndTitleRadioBox* m_pRadioBoxInterpolation;
370
371     int m_iDefaultXSize;
372     int m_iDefaultYSize;
373     int m_iDefaultZeropad;
374 };
375
376
377 #endif
378