30eec421f1867254b49a576b9d5483f035dc221c
[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.35 2001/03/13 04:44:25 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 class DialogGetThetaRange : public wxDialog
93 {
94  public:
95    DialogGetThetaRange (wxWindow* pParent, int iDefaultThetaRange = ParallelRaysums::THETA_RANGE_UNCONSTRAINED);
96     virtual ~DialogGetThetaRange () {}
97
98     int getThetaRange ();
99
100  private:
101     wxRadioBox* m_pRadioBoxThetaRange;
102 };
103
104
105 #include <vector>
106 class ImageFileDocument;
107 class DialogGetComparisonImage : public wxDialog
108 {
109  public:
110    DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference);
111     virtual ~DialogGetComparisonImage () {}
112
113     ImageFileDocument* getImageFileDocument ();
114
115     bool getMakeDifferenceImage();
116
117  private:
118     wxListBox* m_pListBoxImageChoices;
119     wxCheckBox* m_pMakeDifferenceImage;
120     const std::vector<ImageFileDocument*>& m_rVecIF;
121 };
122
123
124 class DialogPreferences : public wxDialog
125 {
126  public:
127     DialogPreferences (wxWindow* pParent, const char* const pszTitle, bool bAdvanced, bool bAskNewDocs,
128       bool bVerboseLogging, bool bStartupTips, bool bUseBackgroundTasks);
129     virtual ~DialogPreferences ();
130
131     bool getAdvancedOptions ();
132     bool getAskDeleteNewDocs ();
133     bool getVerboseLogging ();
134     bool getStartupTips ();
135     bool getUseBackgroundTasks();
136
137  private:
138     wxCheckBox* m_pCBAdvancedOptions;
139     wxCheckBox* m_pCBAskDeleteNewDocs;
140     wxCheckBox* m_pCBVerboseLogging;
141     wxCheckBox* m_pCBStartupTips;
142     wxCheckBox* m_pCBUseBackgroundTasks;
143 };
144
145
146 class ImageFile;
147 class DialogGetMinMax : public wxDialog
148 {
149  public:
150     DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin = 0., double dDefaultMax = 0.);
151     virtual ~DialogGetMinMax ();
152
153     double getMinimum ();
154     double getMaximum ();
155
156  private:
157     wxTextCtrl* m_pTextCtrlMin;
158     wxTextCtrl* m_pTextCtrlMax;
159
160     double m_dDefaultMin;
161     double m_dDefaultMax;
162 };
163
164
165 class DialogGetRasterParameters : public wxDialog
166 {
167  public:
168     DialogGetRasterParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
169       int iDefaultNSamples = 1, double dDefaultViewRatio = 1);
170     virtual ~DialogGetRasterParameters ();
171
172     unsigned int getXSize ();
173     unsigned int getYSize ();
174     unsigned int getNSamples ();
175     double getViewRatio();
176
177  private:
178     wxTextCtrl* m_pTextCtrlXSize;
179     wxTextCtrl* m_pTextCtrlYSize;
180     wxTextCtrl* m_pTextCtrlNSamples;
181     wxTextCtrl* m_pTextCtrlViewRatio;
182
183     int m_iDefaultXSize;
184     int m_iDefaultYSize;
185     int m_iDefaultNSamples;
186     double m_dDefaultViewRatio;
187 };
188
189
190 class DialogGetProjectionParameters : public wxDialog
191 {
192  public:
193     DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet = 0, 
194       int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., 
195       double dDefaultFocalLength = 1, double dDefaultCenterDetectorLength = 1, double dDefaultViewRatio = 1., 
196       double dDefaultScanRatio = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
197     ~DialogGetProjectionParameters ();
198
199     unsigned int getNDet ();
200     unsigned int getNView ();
201     unsigned int getNSamples ();
202     int getTrace ();
203
204     double getRotAngle ();
205     double getViewRatio ();
206     double getScanRatio ();
207     double getFocalLengthRatio ();
208     double getCenterDetectorLengthRatio ();
209     const char* getGeometry();
210
211  private:
212     wxTextCtrl* m_pTextCtrlNDet;
213     wxTextCtrl* m_pTextCtrlNView;
214     wxTextCtrl* m_pTextCtrlNSamples;
215     wxTextCtrl* m_pTextCtrlRotAngle;
216     wxTextCtrl* m_pTextCtrlFocalLength;
217     wxTextCtrl* m_pTextCtrlCenterDetectorLength;
218     wxTextCtrl* m_pTextCtrlViewRatio;
219     wxTextCtrl* m_pTextCtrlScanRatio;
220     StringValueAndTitleRadioBox* m_pRadioBoxGeometry;
221     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
222
223     int m_iDefaultNDet;
224     int m_iDefaultNView;
225     int m_iDefaultNSamples;
226     int m_iDefaultTrace;
227     int m_iDefaultGeometry;
228     double m_dDefaultRotAngle;
229     double m_dDefaultFocalLength;
230     double m_dDefaultCenterDetectorLength;
231     double m_dDefaultViewRatio;
232     double m_dDefaultScanRatio;
233 };
234
235
236 #include "backprojectors.h"
237 class DialogGetReconstructionParameters : public wxDialog
238 {
239  public:
240     DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
241       int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., 
242       int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, 
243       int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT, 
244       int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, 
245       int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF, 
246       int iDefaultTrace = Trace::TRACE_NONE, ReconstructionROI* pROI = NULL);
247     virtual ~DialogGetReconstructionParameters ();
248
249     unsigned int getXSize();
250     unsigned int getYSize();
251     const char* getFilterName();
252     double getFilterParam();
253     const char* getFilterMethodName();
254     unsigned int getZeropad();
255     const char* getFilterGenerationName();
256     const char* getInterpName();
257     unsigned int getInterpParam();
258     const char* getBackprojectName();
259     void getROI (ReconstructionROI* pROI);
260     int getTrace ();
261
262  private:
263     wxTextCtrl* m_pTextCtrlXSize;
264     wxTextCtrl* m_pTextCtrlYSize;
265     wxTextCtrl* m_pTextCtrlZeropad;
266     wxTextCtrl* m_pTextCtrlFilterParam;
267     wxTextCtrl* m_pTextCtrlInterpParam;
268     wxTextCtrl* m_pTextCtrlRoiXMin;
269     wxTextCtrl* m_pTextCtrlRoiXMax;
270     wxTextCtrl* m_pTextCtrlRoiYMin;
271     wxTextCtrl* m_pTextCtrlRoiYMax;
272     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
273     StringValueAndTitleRadioBox* m_pRadioBoxFilterMethod;
274     StringValueAndTitleRadioBox* m_pRadioBoxFilterGeneration;
275     StringValueAndTitleRadioBox* m_pRadioBoxInterp;
276     StringValueAndTitleRadioBox* m_pRadioBoxBackproject;
277     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
278
279     int m_iDefaultXSize;
280     int m_iDefaultYSize;
281     double m_dDefaultFilterParam;
282     int m_iDefaultZeropad;
283     int m_iDefaultInterpParam;
284     double m_dDefaultRoiXMin;
285     double m_dDefaultRoiXMax;
286     double m_dDefaultRoiYMin;
287     double m_dDefaultRoiYMax;
288 };
289
290
291 class DialogGetFilterParameters : public wxDialog
292 {
293  public:
294     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.);
295     virtual ~DialogGetFilterParameters ();
296
297     unsigned int getXSize();
298     unsigned int getYSize();
299     const char* getFilterName();
300     const char* getDomainName();
301     double getFilterParam();
302     double getInputScale();
303     double getOutputScale();
304     double getBandwidth();
305
306  private:
307     wxTextCtrl* m_pTextCtrlXSize;
308     wxTextCtrl* m_pTextCtrlYSize;
309     wxTextCtrl* m_pTextCtrlFilterParam;
310     wxTextCtrl* m_pTextCtrlOutputScale;
311     wxTextCtrl* m_pTextCtrlInputScale;
312     wxTextCtrl* m_pTextCtrlBandwidth;
313
314     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
315     StringValueAndTitleRadioBox* m_pRadioBoxDomain;
316
317     int m_iDefaultXSize;
318     int m_iDefaultYSize;
319     double m_dDefaultFilterParam;
320     double m_dDefaultBandwidth;
321     double m_dDefaultOutputScale;
322     double m_dDefaultInputScale;
323     int m_iDefaultDomain;
324 };
325
326 class DialogExportParameters : public wxDialog
327 {
328  public:
329     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
330     virtual ~DialogExportParameters () {}
331
332     const char* getFormatName();
333
334  private:
335     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
336 };
337
338 class DialogImportParameters : public wxDialog
339 {
340  public:
341     DialogImportParameters (wxWindow* pParent, int iDefaultFormatID);
342     virtual ~DialogImportParameters () {}
343
344     const char* getFormatName();
345
346  private:
347     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
348 };
349
350 class DialogAutoScaleParameters : public wxDialog
351 {
352  public:
353     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
354     virtual ~DialogAutoScaleParameters() {}
355
356     bool getMinMax (double* pMin, double* pMax);
357     double getAutoScaleFactor ();
358
359  private:
360     const double m_dMean;
361         const double m_dMode;
362         const double m_dMedian;
363         const double m_dStdDev;
364
365     wxTextCtrl* m_pTextCtrlStdDevFactor;
366     wxRadioBox* m_pRadioBoxCenter;
367 };
368
369 class DialogGetXYSize : public wxDialog
370 {
371  public:
372     DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
373     virtual ~DialogGetXYSize ();
374
375     unsigned int getXSize ();
376     unsigned int getYSize ();
377
378  private:
379     wxTextCtrl* m_pTextCtrlXSize;
380     wxTextCtrl* m_pTextCtrlYSize;
381
382     unsigned int m_iDefaultXSize;
383     unsigned int m_iDefaultYSize;
384 };
385
386
387 class DialogGetConvertPolarParameters : public wxDialog
388 {
389  public:
390    DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 0, 
391      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR, 
392      int iDefaultZeropad = 1);
393    virtual ~DialogGetConvertPolarParameters ();
394
395     unsigned int getXSize();
396     unsigned int getYSize();
397     const char* getInterpolationName();
398     unsigned int getZeropad();
399
400  private:
401     wxTextCtrl* m_pTextCtrlXSize;
402     wxTextCtrl* m_pTextCtrlYSize;
403     wxTextCtrl* m_pTextCtrlZeropad;
404
405     StringValueAndTitleRadioBox* m_pRadioBoxInterpolation;
406
407     int m_iDefaultXSize;
408     int m_iDefaultYSize;
409     int m_iDefaultZeropad;
410 };
411
412
413 #endif
414