r1024: 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.38 2001/09/24 11:46:17 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 iDefaultOffsetView = 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 getOffsetView ();
203     unsigned int getNSamples ();
204     int getTrace ();
205
206     double getRotAngle ();
207     double getViewRatio ();
208     double getScanRatio ();
209     double getFocalLengthRatio ();
210     double getCenterDetectorLengthRatio ();
211     const char* getGeometry();
212
213  private:
214     wxTextCtrl* m_pTextCtrlNDet;
215     wxTextCtrl* m_pTextCtrlNView;
216     wxTextCtrl* m_pTextCtrlOffsetView;
217     wxTextCtrl* m_pTextCtrlNSamples;
218     wxTextCtrl* m_pTextCtrlRotAngle;
219     wxTextCtrl* m_pTextCtrlFocalLength;
220     wxTextCtrl* m_pTextCtrlCenterDetectorLength;
221     wxTextCtrl* m_pTextCtrlViewRatio;
222     wxTextCtrl* m_pTextCtrlScanRatio;
223     StringValueAndTitleRadioBox* m_pRadioBoxGeometry;
224     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
225
226     int m_iDefaultNDet;
227     int m_iDefaultNView;
228           int m_iDefaultOffsetView;
229     int m_iDefaultNSamples;
230     int m_iDefaultTrace;
231     int m_iDefaultGeometry;
232     double m_dDefaultRotAngle;
233     double m_dDefaultFocalLength;
234     double m_dDefaultCenterDetectorLength;
235     double m_dDefaultViewRatio;
236     double m_dDefaultScanRatio;
237 };
238
239
240 #include "backprojectors.h"
241 class DialogGetReconstructionParameters : public wxDialog
242 {
243  public:
244     DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, 
245       int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., 
246       int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, 
247       int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT, 
248       int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, 
249       int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF, 
250       int iDefaultTrace = Trace::TRACE_NONE, ReconstructionROI* pROI = NULL);
251     virtual ~DialogGetReconstructionParameters ();
252
253     unsigned int getXSize();
254     unsigned int getYSize();
255     const char* getFilterName();
256     double getFilterParam();
257     const char* getFilterMethodName();
258     unsigned int getZeropad();
259     const char* getFilterGenerationName();
260     const char* getInterpName();
261     unsigned int getInterpParam();
262     const char* getBackprojectName();
263     void getROI (ReconstructionROI* pROI);
264     int getTrace ();
265
266  private:
267     wxTextCtrl* m_pTextCtrlXSize;
268     wxTextCtrl* m_pTextCtrlYSize;
269     wxTextCtrl* m_pTextCtrlZeropad;
270     wxTextCtrl* m_pTextCtrlFilterParam;
271     wxTextCtrl* m_pTextCtrlInterpParam;
272     wxTextCtrl* m_pTextCtrlRoiXMin;
273     wxTextCtrl* m_pTextCtrlRoiXMax;
274     wxTextCtrl* m_pTextCtrlRoiYMin;
275     wxTextCtrl* m_pTextCtrlRoiYMax;
276     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
277     StringValueAndTitleRadioBox* m_pRadioBoxFilterMethod;
278     StringValueAndTitleRadioBox* m_pRadioBoxFilterGeneration;
279     StringValueAndTitleRadioBox* m_pRadioBoxInterp;
280     StringValueAndTitleRadioBox* m_pRadioBoxBackproject;
281     StringValueAndTitleRadioBox* m_pRadioBoxTrace;
282
283     int m_iDefaultXSize;
284     int m_iDefaultYSize;
285     double m_dDefaultFilterParam;
286     int m_iDefaultZeropad;
287     int m_iDefaultInterpParam;
288     double m_dDefaultRoiXMin;
289     double m_dDefaultRoiXMax;
290     double m_dDefaultRoiYMin;
291     double m_dDefaultRoiYMax;
292 };
293
294
295 class DialogGetFilterParameters : public wxDialog
296 {
297  public:
298     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.);
299     virtual ~DialogGetFilterParameters ();
300
301     unsigned int getXSize();
302     unsigned int getYSize();
303     const char* getFilterName();
304     const char* getDomainName();
305     double getFilterParam();
306     double getInputScale();
307     double getOutputScale();
308     double getBandwidth();
309
310  private:
311     wxTextCtrl* m_pTextCtrlXSize;
312     wxTextCtrl* m_pTextCtrlYSize;
313     wxTextCtrl* m_pTextCtrlFilterParam;
314     wxTextCtrl* m_pTextCtrlOutputScale;
315     wxTextCtrl* m_pTextCtrlInputScale;
316     wxTextCtrl* m_pTextCtrlBandwidth;
317
318     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
319     StringValueAndTitleRadioBox* m_pRadioBoxDomain;
320
321     int m_iDefaultXSize;
322     int m_iDefaultYSize;
323     double m_dDefaultFilterParam;
324     double m_dDefaultBandwidth;
325     double m_dDefaultOutputScale;
326     double m_dDefaultInputScale;
327     int m_iDefaultDomain;
328 };
329
330 class DialogExportParameters : public wxDialog
331 {
332  public:
333     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
334     virtual ~DialogExportParameters () {}
335
336     const char* getFormatName();
337
338  private:
339     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
340 };
341
342 class DialogImportParameters : public wxDialog
343 {
344  public:
345     DialogImportParameters (wxWindow* pParent, int iDefaultFormatID);
346     virtual ~DialogImportParameters () {}
347
348     const char* getFormatName();
349
350  private:
351     StringValueAndTitleRadioBox* m_pRadioBoxFormat;
352 };
353
354 class DialogAutoScaleParameters : public wxDialog
355 {
356  public:
357     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
358     virtual ~DialogAutoScaleParameters() {}
359
360     bool getMinMax (double* pMin, double* pMax);
361     double getAutoScaleFactor ();
362
363  private:
364     const double m_dMean;
365         const double m_dMode;
366         const double m_dMedian;
367         const double m_dStdDev;
368
369     wxTextCtrl* m_pTextCtrlStdDevFactor;
370     wxRadioBox* m_pRadioBoxCenter;
371 };
372
373 class DialogGetXYSize : public wxDialog
374 {
375  public:
376     DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
377     virtual ~DialogGetXYSize ();
378
379     unsigned int getXSize ();
380     unsigned int getYSize ();
381
382  private:
383     wxTextCtrl* m_pTextCtrlXSize;
384     wxTextCtrl* m_pTextCtrlYSize;
385
386     unsigned int m_iDefaultXSize;
387     unsigned int m_iDefaultYSize;
388 };
389
390
391 class DialogGetConvertPolarParameters : public wxDialog
392 {
393  public:
394    DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 0, 
395      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR, 
396      int iDefaultZeropad = 1, int iHelpID = IDH_DLG_POLAR);
397    virtual ~DialogGetConvertPolarParameters ();
398
399     unsigned int getXSize();
400     unsigned int getYSize();
401     const char* getInterpolationName();
402     unsigned int getZeropad();
403
404  private:
405     wxTextCtrl* m_pTextCtrlXSize;
406     wxTextCtrl* m_pTextCtrlYSize;
407     wxTextCtrl* m_pTextCtrlZeropad;
408
409     StringValueAndTitleRadioBox* m_pRadioBoxInterpolation;
410
411     int m_iDefaultXSize;
412     int m_iDefaultYSize;
413     int m_iDefaultZeropad;
414 };
415
416
417 #endif
418