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