2eae3dcd12a61b295aca86ae3f1ae5d3897aa9a3
[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-2000 Kevin Rosenberg
11 **
12 **  $Id: dialogs.h,v 1.21 2001/01/20 17:43:41 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 StringValueAndTitleListBox
43 //
44 // A superclass of wxListBox that can handle string values and titles
45 // and by displaying the title in the list box and returning the string value
46
47 class StringValueAndTitleListBox : public wxListBox
48 {
49  public:
50   StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]);
51
52     const char* getSelectionStringValue () const;
53
54  private:
55     const char** m_ppszValues;
56 };
57
58
59 class DialogGetPhantom : public wxDialog
60 {
61  public:
62     DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN);
63     virtual ~DialogGetPhantom () {}
64
65     const char* getPhantom ();
66
67  private:
68     StringValueAndTitleListBox* m_pListBoxPhantom;
69 };
70
71
72 #include <vector>
73 class ImageFileDocument;
74 class DialogGetComparisonImage : public wxDialog
75 {
76  public:
77    DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference);
78     virtual ~DialogGetComparisonImage () {}
79
80     ImageFileDocument* getImageFileDocument ();
81
82     bool getMakeDifferenceImage();
83
84  private:
85     wxListBox* m_pListBoxImageChoices;
86     wxCheckBox* m_pMakeDifferenceImage;
87     const std::vector<ImageFileDocument*>& m_rVecIF;
88 };
89
90
91 class ImageFile;
92 class DialogGetMinMax : public wxDialog
93 {
94  public:
95     DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin = 0., double dDefaultMax = 0.);
96     virtual ~DialogGetMinMax ();
97
98     double getMinimum ();
99     double getMaximum ();
100
101  private:
102     wxTextCtrl* m_pTextCtrlMin;
103     wxTextCtrl* m_pTextCtrlMax;
104
105     double m_dDefaultMin;
106     double m_dDefaultMax;
107 };
108
109
110 class DialogGetRasterParameters : public wxDialog
111 {
112  public:
113     DialogGetRasterParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultNSamples = 1);
114     virtual ~DialogGetRasterParameters ();
115
116     unsigned int getXSize ();
117     unsigned int getYSize ();
118     unsigned int getNSamples ();
119
120  private:
121     wxTextCtrl* m_pTextCtrlXSize;
122     wxTextCtrl* m_pTextCtrlYSize;
123     wxTextCtrl* m_pTextCtrlNSamples;
124
125     int m_iDefaultXSize;
126     int m_iDefaultYSize;
127     int m_iDefaultNSamples;
128 };
129
130
131 class DialogGetProjectionParameters : public wxDialog
132 {
133  public:
134     DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., double dDefaultFocalLength = 1, double dDefaultFieldOfView = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
135     ~DialogGetProjectionParameters ();
136
137     unsigned int getNDet ();
138     unsigned int getNView ();
139     unsigned int getNSamples ();
140     int getTrace ();
141
142     double getRotAngle ();
143     double getFieldOfViewRatio ();
144     double getFocalLengthRatio ();
145     const char* getGeometry();
146
147  private:
148     wxTextCtrl* m_pTextCtrlNDet;
149     wxTextCtrl* m_pTextCtrlNView;
150     wxTextCtrl* m_pTextCtrlNSamples;
151     wxTextCtrl* m_pTextCtrlRotAngle;
152     wxTextCtrl* m_pTextCtrlFocalLength;
153     wxTextCtrl* m_pTextCtrlFieldOfView;
154
155     StringValueAndTitleListBox* m_pListBoxGeometry;
156     StringValueAndTitleListBox* m_pListBoxTrace;
157
158     int m_iDefaultNDet;
159     int m_iDefaultNView;
160     int m_iDefaultNSamples;
161     int m_iDefaultTrace;
162     int m_iDefaultGeometry;
163     double m_dDefaultRotAngle;
164     double m_dDefaultFocalLength;
165     double m_dDefaultFieldOfView;
166 };
167
168
169 #include "backprojectors.h"
170 class DialogGetReconstructionParameters : public wxDialog
171 {
172  public:
173     DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_INVALID, int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF3, int iDefaultTrace = Trace::TRACE_NONE);
174     virtual ~DialogGetReconstructionParameters ();
175
176     unsigned int getXSize();
177     unsigned int getYSize();
178     const char* getFilterName();
179     double getFilterParam();
180     const char* getFilterMethodName();
181     unsigned int getZeropad();
182     const char* getFilterGenerationName();
183     const char* getInterpName();
184     unsigned int getInterpParam();
185     const char* getBackprojectName();
186     int getTrace ();
187
188  private:
189     wxTextCtrl* m_pTextCtrlXSize;
190     wxTextCtrl* m_pTextCtrlYSize;
191     wxTextCtrl* m_pTextCtrlZeropad;
192     wxTextCtrl* m_pTextCtrlFilterParam;
193     wxTextCtrl* m_pTextCtrlInterpParam;
194
195     StringValueAndTitleListBox* m_pListBoxFilter;
196     StringValueAndTitleListBox* m_pListBoxFilterMethod;
197     StringValueAndTitleListBox* m_pListBoxFilterGeneration;
198     StringValueAndTitleListBox* m_pListBoxInterp;
199     StringValueAndTitleListBox* m_pListBoxBackproject;
200     StringValueAndTitleListBox* m_pListBoxTrace;
201
202     int m_iDefaultXSize;
203     int m_iDefaultYSize;
204     double m_dDefaultFilterParam;
205     int m_iDefaultZeropad;
206     int m_iDefaultInterpParam;
207     int m_iDefaultTrace;
208 };
209
210
211 class DialogGetFilterParameters : public wxDialog
212 {
213  public:
214     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.);
215     virtual ~DialogGetFilterParameters ();
216
217     unsigned int getXSize();
218     unsigned int getYSize();
219     const char* getFilterName();
220     const char* getDomainName();
221     double getFilterParam();
222     double getInputScale();
223     double getOutputScale();
224     double getBandwidth();
225
226  private:
227     wxTextCtrl* m_pTextCtrlXSize;
228     wxTextCtrl* m_pTextCtrlYSize;
229     wxTextCtrl* m_pTextCtrlFilterParam;
230     wxTextCtrl* m_pTextCtrlOutputScale;
231     wxTextCtrl* m_pTextCtrlInputScale;
232     wxTextCtrl* m_pTextCtrlBandwidth;
233
234     StringValueAndTitleListBox* m_pListBoxFilter;
235     StringValueAndTitleListBox* m_pListBoxDomain;
236
237     int m_iDefaultXSize;
238     int m_iDefaultYSize;
239     double m_dDefaultFilterParam;
240     double m_dDefaultBandwidth;
241     double m_dDefaultOutputScale;
242     double m_dDefaultInputScale;
243     int m_iDefaultDomain;
244 };
245
246 class DialogExportParameters : public wxDialog
247 {
248  public:
249     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
250     virtual ~DialogExportParameters () {}
251
252     const char* getFormatName();
253
254  private:
255     StringValueAndTitleListBox* m_pListBoxFormat;
256 };
257
258 class DialogAutoScaleParameters : public wxDialog
259 {
260  public:
261     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
262     virtual ~DialogAutoScaleParameters() {}
263
264     bool getMinMax (double* pMin, double* pMax);
265     double getAutoScaleFactor ();
266
267  private:
268     const double m_dMean;
269         const double m_dMode;
270         const double m_dMedian;
271         const double m_dStdDev;
272
273     wxTextCtrl* m_pTextCtrlStdDevFactor;
274     wxListBox* m_pListBoxCenter;
275 };
276
277 class DialogGetXYSize : public wxDialog
278 {
279  public:
280     DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
281     virtual ~DialogGetXYSize ();
282
283     unsigned int getXSize ();
284     unsigned int getYSize ();
285
286  private:
287     wxTextCtrl* m_pTextCtrlXSize;
288     wxTextCtrl* m_pTextCtrlYSize;
289
290     unsigned int m_iDefaultXSize;
291     unsigned int m_iDefaultYSize;
292 };
293
294
295 class DialogGetConvertPolarParameters : public wxDialog
296 {
297  public:
298    DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 0, 
299      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR, 
300      int iDefaultZeropad = 1);
301    virtual ~DialogGetConvertPolarParameters ();
302
303     unsigned int getXSize();
304     unsigned int getYSize();
305     const char* getInterpolationName();
306     unsigned int getZeropad();
307
308  private:
309     wxTextCtrl* m_pTextCtrlXSize;
310     wxTextCtrl* m_pTextCtrlYSize;
311     wxTextCtrl* m_pTextCtrlZeropad;
312
313     StringValueAndTitleListBox* m_pListBoxInterpolation;
314
315     int m_iDefaultXSize;
316     int m_iDefaultYSize;
317     int m_iDefaultZeropad;
318 };
319
320
321 #endif
322