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