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