Revert "Update package dependency from libwxgtk3.0-dev to libwxgtk3.0-gtk3-dev for...
[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-2009 Kevin Rosenberg
11 **
12 **  This program is free software; you can redistribute it and/or modify
13 **  it under the terms of the GNU General Public License (version 2) as
14 **  published by the Free Software Foundation.
15 **
16 **  This program is distributed in the hope that it will be useful,
17 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 **  GNU General Public License for more details.
20 **
21 **  You should have received a copy of the GNU General Public License
22 **  along with this program; if not, write to the Free Software
23 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 ******************************************************************************/
25
26
27 #ifndef __DIALOGSH__
28 #define __DIALOGSH__
29
30 #include "wx/wx.h"
31 #include <string>
32 #include "ctsupport.h"
33 #include "scanner.h"
34 #include "phantom.h"
35 #include "procsignal.h"
36 #include "filter.h"
37 #include "projections.h"
38 #include "ctsim-map.h"
39
40
41 class CTSimHelpButton : public wxButton
42 {
43 public:
44   CTSimHelpButton (wxWindow* parent, int id)
45     : wxButton (parent, id, _T("Help"))
46   {}
47 };
48
49
50 // CLASS StringValueAndTitleListBox
51 //
52 // A superclass of wxListBox that can handle string values and titles
53 // and by displaying the title in the list box and returning the string value
54
55 class StringValueAndTitleListBox : public wxListBox
56 {
57  public:
58   StringValueAndTitleListBox (wxDialog* pParent, int nChoices, wxChar const* const* asTitle,
59                               char const* const aszValue[]);
60 #if 0
61   StringValueAndTitleListBox (wxDialog* pParent, int nChoices, wxChar const* title,
62                               char const* const* aszTitle, char const* const* aszValue);
63 #endif
64   StringValueAndTitleListBox (wxDialog* pParent, int nChoices, wxChar const* title,
65                               wxChar const* const* asTitle, char const* const* aszValue);
66
67     const char* getSelectionStringValue () const;
68
69  private:
70     const char* const* m_ppszValues;
71 };
72
73
74 class StringValueAndTitleRadioBox : public wxRadioBox
75 {
76  public:
77   StringValueAndTitleRadioBox (wxDialog* pParent, wxChar const* strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[]);
78
79   const char* getSelectionStringValue () const;
80
81  private:
82   const char* const* m_ppszValues;
83 };
84
85
86 class DialogGetPhantom : public wxDialog
87 {
88  public:
89     DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN);
90     virtual ~DialogGetPhantom () {}
91
92     const char* getPhantom ();
93
94  private:
95     StringValueAndTitleRadioBox* m_pRadioBoxPhantom;
96 };
97
98 class DialogGetThetaRange : public wxDialog
99 {
100  public:
101    DialogGetThetaRange (wxWindow* pParent, int iDefaultThetaRange = ParallelRaysums::THETA_RANGE_UNCONSTRAINED);
102     virtual ~DialogGetThetaRange () {}
103
104     int getThetaRange ();
105
106  private:
107     wxRadioBox* m_pRadioBoxThetaRange;
108 };
109
110
111 #include <vector>
112 class ImageFileDocument;
113 class DialogGetComparisonImage : public wxDialog
114 {
115  public:
116    DialogGetComparisonImage (wxWindow* pParent, wxChar const * pwszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference);
117     virtual ~DialogGetComparisonImage () {}
118
119     ImageFileDocument* getImageFileDocument ();
120
121     bool getMakeDifferenceImage();
122
123  private:
124     wxListBox* m_pListBoxImageChoices;
125     wxCheckBox* m_pMakeDifferenceImage;
126     const std::vector<ImageFileDocument*>& m_rVecIF;
127 };
128
129
130 class DialogPreferences : public wxDialog
131 {
132  public:
133   DialogPreferences (wxWindow* pParent, wxChar const* pszTitle, bool bAdvanced, bool bAskNewDocs,
134       bool bVerboseLogging, bool bStartupTips, bool bUseBackgroundTasks);
135     virtual ~DialogPreferences ();
136
137     bool getAdvancedOptions ();
138     bool getAskDeleteNewDocs ();
139     bool getVerboseLogging ();
140     bool getStartupTips ();
141     bool getUseBackgroundTasks();
142
143  private:
144     wxCheckBox* m_pCBAdvancedOptions;
145     wxCheckBox* m_pCBAskDeleteNewDocs;
146     wxCheckBox* m_pCBVerboseLogging;
147     wxCheckBox* m_pCBStartupTips;
148     wxCheckBox* m_pCBUseBackgroundTasks;
149 };
150
151
152 class ImageFile;
153 class DialogGetMinMax : public wxDialog
154 {
155  public:
156     DialogGetMinMax (wxWindow* pParent, wxChar const* pszTitle, double dDefaultMin = 0., double dDefaultMax = 0.);
157     virtual ~DialogGetMinMax ();
158
159     double getMinimum ();
160     double getMaximum ();
161
162  private:
163     wxTextCtrl* m_pTextCtrlMin;
164     wxTextCtrl* m_pTextCtrlMax;
165
166     double m_dDefaultMin;
167     double m_dDefaultMax;
168 };
169
170
171 class DialogGetRasterParameters : public wxDialog
172 {
173  public:
174     DialogGetRasterParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0,
175       int iDefaultNSamples = 1, double dDefaultViewRatio = 1);
176     virtual ~DialogGetRasterParameters ();
177
178     unsigned int getXSize ();
179     unsigned int getYSize ();
180     unsigned int getNSamples ();
181     double getViewRatio();
182
183  private:
184     wxTextCtrl* m_pTextCtrlXSize;
185     wxTextCtrl* m_pTextCtrlYSize;
186     wxTextCtrl* m_pTextCtrlNSamples;
187     wxTextCtrl* m_pTextCtrlViewRatio;
188
189     int m_iDefaultXSize;
190     int m_iDefaultYSize;
191     int m_iDefaultNSamples;
192     double m_dDefaultViewRatio;
193 };
194
195
196 class DialogGetProjectionParameters : public wxDialog
197 {
198  public:
199     DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet = 0,
200       int iDefaultNView = 0, int iDefaultOffsetView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1.,
201       double dDefaultFocalLength = 1, double dDefaultCenterDetectorLength = 1, double dDefaultViewRatio = 1.,
202       double dDefaultScanRatio = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
203     ~DialogGetProjectionParameters ();
204
205     unsigned int getNDet ();
206     unsigned int getNView ();
207           unsigned int getOffsetView ();
208     unsigned int getNSamples ();
209     int getTrace ();
210
211     double getRotAngle ();
212     double getViewRatio ();
213     double getScanRatio ();
214     double getFocalLengthRatio ();
215     double getCenterDetectorLengthRatio ();
216     const char* getGeometry();
217
218  private:
219     wxTextCtrl* m_pTextCtrlNDet;
220     wxTextCtrl* m_pTextCtrlNView;
221     wxTextCtrl* m_pTextCtrlOffsetView;
222     wxTextCtrl* m_pTextCtrlNSamples;
223     wxTextCtrl* m_pTextCtrlRotAngle;
224     wxTextCtrl* m_pTextCtrlFocalLength;
225     wxTextCtrl* m_pTextCtrlCenterDetectorLength;
226     wxTextCtrl* m_pTextCtrlViewRatio;
227     wxTextCtrl* m_pTextCtrlScanRatio;
228     StringValueAndTitleRadioBox* m_pRadioBoxGeometry;
229     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
230
231     int m_iDefaultNDet;
232     int m_iDefaultNView;
233           int m_iDefaultOffsetView;
234     int m_iDefaultNSamples;
235     int m_iDefaultTrace;
236     int m_iDefaultGeometry;
237     double m_dDefaultRotAngle;
238     double m_dDefaultFocalLength;
239     double m_dDefaultCenterDetectorLength;
240     double m_dDefaultViewRatio;
241     double m_dDefaultScanRatio;
242 };
243
244
245 #include "backprojectors.h"
246 class DialogGetReconstructionParameters : public wxDialog
247 {
248  public:
249     DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0,
250       int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1.,
251       int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION,
252       int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT,
253       int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR,
254       int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF,
255       int iDefaultTrace = Trace::TRACE_NONE, ReconstructionROI* pROI = NULL);
256     virtual ~DialogGetReconstructionParameters ();
257
258     unsigned int getXSize();
259     unsigned int getYSize();
260     const char* getFilterName();
261     double getFilterParam();
262     const char* getFilterMethodName();
263     unsigned int getZeropad();
264     const char* getFilterGenerationName();
265     const char* getInterpName();
266     unsigned int getInterpParam();
267     const char* getBackprojectName();
268     void getROI (ReconstructionROI* pROI);
269     int getTrace ();
270
271  private:
272     wxTextCtrl* m_pTextCtrlXSize;
273     wxTextCtrl* m_pTextCtrlYSize;
274     wxTextCtrl* m_pTextCtrlZeropad;
275     wxTextCtrl* m_pTextCtrlFilterParam;
276     wxTextCtrl* m_pTextCtrlInterpParam;
277     wxTextCtrl* m_pTextCtrlRoiXMin;
278     wxTextCtrl* m_pTextCtrlRoiXMax;
279     wxTextCtrl* m_pTextCtrlRoiYMin;
280     wxTextCtrl* m_pTextCtrlRoiYMax;
281     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
282     StringValueAndTitleRadioBox* m_pRadioBoxFilterMethod;
283     StringValueAndTitleRadioBox* m_pRadioBoxFilterGeneration;
284     StringValueAndTitleRadioBox* m_pRadioBoxInterp;
285     StringValueAndTitleRadioBox* m_pRadioBoxBackproject;
286     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
287
288     int m_iDefaultXSize;
289     int m_iDefaultYSize;
290     double m_dDefaultFilterParam;
291     int m_iDefaultZeropad;
292     int m_iDefaultInterpParam;
293     double m_dDefaultRoiXMin;
294     double m_dDefaultRoiXMax;
295     double m_dDefaultRoiYMin;
296     double m_dDefaultRoiYMax;
297 };
298
299
300 class DialogGetFilterParameters : public wxDialog
301 {
302  public:
303     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.);
304     virtual ~DialogGetFilterParameters ();
305
306     unsigned int getXSize();
307     unsigned int getYSize();
308     const char* getFilterName();
309     const char* getDomainName();
310     double getFilterParam();
311     double getInputScale();
312     double getOutputScale();
313     double getBandwidth();
314
315  private:
316     wxTextCtrl* m_pTextCtrlXSize;
317     wxTextCtrl* m_pTextCtrlYSize;
318     wxTextCtrl* m_pTextCtrlFilterParam;
319     wxTextCtrl* m_pTextCtrlOutputScale;
320     wxTextCtrl* m_pTextCtrlInputScale;
321     wxTextCtrl* m_pTextCtrlBandwidth;
322
323     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
324     StringValueAndTitleRadioBox* m_pRadioBoxDomain;
325
326     int m_iDefaultXSize;
327     int m_iDefaultYSize;
328     double m_dDefaultFilterParam;
329     double m_dDefaultBandwidth;
330     double m_dDefaultOutputScale;
331     double m_dDefaultInputScale;
332     int m_iDefaultDomain;
333 };
334
335 class DialogExportParameters : public wxDialog
336 {
337  public:
338     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
339     virtual ~DialogExportParameters () {}
340
341     const char* getFormatName();
342
343  private:
344     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
345 };
346
347 class DialogImportParameters : public wxDialog
348 {
349  public:
350     DialogImportParameters (wxWindow* pParent, int iDefaultFormatID);
351     virtual ~DialogImportParameters () {}
352
353     const char* getFormatName();
354
355  private:
356     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
357 };
358
359 class DialogAutoScaleParameters : public wxDialog
360 {
361  public:
362     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
363     virtual ~DialogAutoScaleParameters() {}
364
365     bool getMinMax (double* pMin, double* pMax);
366     double getAutoScaleFactor ();
367
368  private:
369     const double m_dMean;
370         const double m_dMode;
371         const double m_dMedian;
372         const double m_dStdDev;
373
374     wxTextCtrl* m_pTextCtrlStdDevFactor;
375     wxRadioBox* m_pRadioBoxCenter;
376 };
377
378 class DialogGetXYSize : public wxDialog
379 {
380  public:
381     DialogGetXYSize (wxWindow* pParent, wxChar const * pwszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
382     virtual ~DialogGetXYSize ();
383
384     unsigned int getXSize ();
385     unsigned int getYSize ();
386
387  private:
388     wxTextCtrl* m_pTextCtrlXSize;
389     wxTextCtrl* m_pTextCtrlYSize;
390
391     unsigned int m_iDefaultXSize;
392     unsigned int m_iDefaultYSize;
393 };
394
395
396 class DialogGetConvertPolarParameters : public wxDialog
397 {
398  public:
399    DialogGetConvertPolarParameters (wxWindow* pParent, wxChar const * pwszTitle, int iDefaultXSize = 0,
400      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR,
401      int iDefaultZeropad = 3, int iHelpID = IDH_DLG_POLAR);
402    virtual ~DialogGetConvertPolarParameters ();
403
404     unsigned int getXSize();
405     unsigned int getYSize();
406     const char* getInterpolationName();
407     unsigned int getZeropad();
408
409  private:
410     wxTextCtrl* m_pTextCtrlXSize;
411     wxTextCtrl* m_pTextCtrlYSize;
412     wxTextCtrl* m_pTextCtrlZeropad;
413
414     StringValueAndTitleRadioBox* m_pRadioBoxInterpolation;
415
416     int m_iDefaultXSize;
417     int m_iDefaultYSize;
418     int m_iDefaultZeropad;
419 };
420
421
422 #endif
423