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