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