0284924aeed4dfc119ca829212367da84b2a306f
[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.23 2001/02/08 06:25:07 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, 
114       int iDefaultNSamples = 1, double dDefaultViewRatio = 1);
115     virtual ~DialogGetRasterParameters ();
116
117     unsigned int getXSize ();
118     unsigned int getYSize ();
119     unsigned int getNSamples ();
120     double getViewRatio();
121
122  private:
123     wxTextCtrl* m_pTextCtrlXSize;
124     wxTextCtrl* m_pTextCtrlYSize;
125     wxTextCtrl* m_pTextCtrlNSamples;
126     wxTextCtrl* m_pTextCtrlViewRatio;
127
128     int m_iDefaultXSize;
129     int m_iDefaultYSize;
130     int m_iDefaultNSamples;
131     double m_dDefaultViewRatio;
132 };
133
134
135 class DialogGetProjectionParameters : public wxDialog
136 {
137  public:
138     DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet = 0, 
139       int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., 
140       double dDefaultFocalLength = 1, double dDefaultViewRatio = 1., 
141       double dDefaultScanRatio = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE);
142     ~DialogGetProjectionParameters ();
143
144     unsigned int getNDet ();
145     unsigned int getNView ();
146     unsigned int getNSamples ();
147     int getTrace ();
148
149     double getRotAngle ();
150     double getViewRatio ();
151     double getScanRatio ();
152     double getFocalLengthRatio ();
153     const char* getGeometry();
154
155  private:
156     wxTextCtrl* m_pTextCtrlNDet;
157     wxTextCtrl* m_pTextCtrlNView;
158     wxTextCtrl* m_pTextCtrlNSamples;
159     wxTextCtrl* m_pTextCtrlRotAngle;
160     wxTextCtrl* m_pTextCtrlFocalLength;
161     wxTextCtrl* m_pTextCtrlViewRatio;
162     wxTextCtrl* m_pTextCtrlScanRatio;
163     StringValueAndTitleListBox* m_pListBoxGeometry;
164     StringValueAndTitleListBox* m_pListBoxTrace;
165
166     int m_iDefaultNDet;
167     int m_iDefaultNView;
168     int m_iDefaultNSamples;
169     int m_iDefaultTrace;
170     int m_iDefaultGeometry;
171     double m_dDefaultRotAngle;
172     double m_dDefaultFocalLength;
173     double m_dDefaultViewRatio;
174     double m_dDefaultScanRatio;
175 };
176
177
178 #include "backprojectors.h"
179 class DialogGetReconstructionParameters : public wxDialog
180 {
181  public:
182     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);
183     virtual ~DialogGetReconstructionParameters ();
184
185     unsigned int getXSize();
186     unsigned int getYSize();
187     const char* getFilterName();
188     double getFilterParam();
189     const char* getFilterMethodName();
190     unsigned int getZeropad();
191     const char* getFilterGenerationName();
192     const char* getInterpName();
193     unsigned int getInterpParam();
194     const char* getBackprojectName();
195     int getTrace ();
196
197  private:
198     wxTextCtrl* m_pTextCtrlXSize;
199     wxTextCtrl* m_pTextCtrlYSize;
200     wxTextCtrl* m_pTextCtrlZeropad;
201     wxTextCtrl* m_pTextCtrlFilterParam;
202     wxTextCtrl* m_pTextCtrlInterpParam;
203
204     StringValueAndTitleListBox* m_pListBoxFilter;
205     StringValueAndTitleListBox* m_pListBoxFilterMethod;
206     StringValueAndTitleListBox* m_pListBoxFilterGeneration;
207     StringValueAndTitleListBox* m_pListBoxInterp;
208     StringValueAndTitleListBox* m_pListBoxBackproject;
209     StringValueAndTitleListBox* m_pListBoxTrace;
210
211     int m_iDefaultXSize;
212     int m_iDefaultYSize;
213     double m_dDefaultFilterParam;
214     int m_iDefaultZeropad;
215     int m_iDefaultInterpParam;
216     int m_iDefaultTrace;
217 };
218
219
220 class DialogGetFilterParameters : public wxDialog
221 {
222  public:
223     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.);
224     virtual ~DialogGetFilterParameters ();
225
226     unsigned int getXSize();
227     unsigned int getYSize();
228     const char* getFilterName();
229     const char* getDomainName();
230     double getFilterParam();
231     double getInputScale();
232     double getOutputScale();
233     double getBandwidth();
234
235  private:
236     wxTextCtrl* m_pTextCtrlXSize;
237     wxTextCtrl* m_pTextCtrlYSize;
238     wxTextCtrl* m_pTextCtrlFilterParam;
239     wxTextCtrl* m_pTextCtrlOutputScale;
240     wxTextCtrl* m_pTextCtrlInputScale;
241     wxTextCtrl* m_pTextCtrlBandwidth;
242
243     StringValueAndTitleListBox* m_pListBoxFilter;
244     StringValueAndTitleListBox* m_pListBoxDomain;
245
246     int m_iDefaultXSize;
247     int m_iDefaultYSize;
248     double m_dDefaultFilterParam;
249     double m_dDefaultBandwidth;
250     double m_dDefaultOutputScale;
251     double m_dDefaultInputScale;
252     int m_iDefaultDomain;
253 };
254
255 class DialogExportParameters : public wxDialog
256 {
257  public:
258     DialogExportParameters (wxWindow* pParent, int iDefaultFormatID);
259     virtual ~DialogExportParameters () {}
260
261     const char* getFormatName();
262
263  private:
264     StringValueAndTitleListBox* m_pListBoxFormat;
265 };
266
267 class DialogAutoScaleParameters : public wxDialog
268 {
269  public:
270     DialogAutoScaleParameters (wxWindow* pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor = 1.);
271     virtual ~DialogAutoScaleParameters() {}
272
273     bool getMinMax (double* pMin, double* pMax);
274     double getAutoScaleFactor ();
275
276  private:
277     const double m_dMean;
278         const double m_dMode;
279         const double m_dMedian;
280         const double m_dStdDev;
281
282     wxTextCtrl* m_pTextCtrlStdDevFactor;
283     wxListBox* m_pListBoxCenter;
284 };
285
286 class DialogGetXYSize : public wxDialog
287 {
288  public:
289     DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 1, int iDefaultYSize = 1);
290     virtual ~DialogGetXYSize ();
291
292     unsigned int getXSize ();
293     unsigned int getYSize ();
294
295  private:
296     wxTextCtrl* m_pTextCtrlXSize;
297     wxTextCtrl* m_pTextCtrlYSize;
298
299     unsigned int m_iDefaultXSize;
300     unsigned int m_iDefaultYSize;
301 };
302
303
304 class DialogGetConvertPolarParameters : public wxDialog
305 {
306  public:
307    DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize = 0, 
308      int iDefaultYSize = 0, int iDefaultInterpolationID = Projections::POLAR_INTERP_BILINEAR, 
309      int iDefaultZeropad = 1);
310    virtual ~DialogGetConvertPolarParameters ();
311
312     unsigned int getXSize();
313     unsigned int getYSize();
314     const char* getInterpolationName();
315     unsigned int getZeropad();
316
317  private:
318     wxTextCtrl* m_pTextCtrlXSize;
319     wxTextCtrl* m_pTextCtrlYSize;
320     wxTextCtrl* m_pTextCtrlZeropad;
321
322     StringValueAndTitleListBox* m_pListBoxInterpolation;
323
324     int m_iDefaultXSize;
325     int m_iDefaultYSize;
326     int m_iDefaultZeropad;
327 };
328
329
330 #endif
331