27b454f0ff857dabbca266e00399557414ed7814
[ctsim.git] / src / dialogs.cpp
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          dialogs.cpp
5 **   Purpose:       Dialog routines for 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.cpp,v 1.4 2000/07/20 11:17:31 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 #ifdef __GNUG__
29 // #pragma implementation
30 #endif
31
32 // For compilers that support precompilation, includes "wx/wx.h".
33 #include "wx/wxprec.h"
34
35 #ifdef __BORLANDC__
36 #pragma hdrstop
37 #endif
38
39 #ifndef WX_PRECOMP
40 #include "wx/wx.h"
41 #endif
42
43 #if !wxUSE_DOC_VIEW_ARCHITECTURE
44 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
45 #endif
46
47 #include "wx/statline.h"
48 #include "wx/sizer.h"
49 #include "dialogs.h"
50 #include <sstream>
51 #include "ctsupport.h"
52 #include "scanner.h"
53 #include "phantom.h"
54 #include "filter.h"
55 #include "backprojectors.h"
56
57
58
59 const wxString DialogGetPhantom::s_asPhantom[] = 
60
61     wxString(Phantom::PHM_HERMAN_STR),
62     wxString(Phantom::PHM_BHERMAN_STR),
63     wxString(Phantom::PHM_ROWLAND_STR),
64     wxString(Phantom::PHM_BROWLAND_STR),
65     wxString(Phantom::PHM_UNITPULSE_STR),
66 };
67 const wxString DialogGetPhantom::s_asPhantomTitle[] = 
68
69     wxString(Phantom::PHM_HERMAN_TITLE_STR),
70     wxString(Phantom::PHM_BHERMAN_TITLE_STR),
71     wxString(Phantom::PHM_ROWLAND_TITLE_STR),
72     wxString(Phantom::PHM_BROWLAND_TITLE_STR),
73     wxString(Phantom::PHM_UNITPULSE_TITLE_STR),
74 };
75 const unsigned int DialogGetPhantom::s_iNumPhantom = sizeof(s_asPhantom) / sizeof(wxString);
76
77
78 DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhantom = NULL)
79     : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
80 {
81     m_sDefaultPhantom = szDefaultPhantom;
82
83   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
84
85   pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
86                    
87   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
88
89   m_pListBoxPhantom = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumPhantom, s_asPhantomTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
90   pTopSizer->Add (m_pListBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
91
92   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
93
94   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
95   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
96   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
97   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
98   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
99
100   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
101
102   SetAutoLayout (true);
103   SetSizer (pTopSizer);
104   pTopSizer->Fit (this);
105   pTopSizer->SetSizeHints (this);
106 }
107
108 const wxString&
109 DialogGetPhantom::getPhantom(void)
110 {
111     int selection = m_pListBoxPhantom->GetSelection();
112     if (selection >= 0)
113         return (s_asPhantom[selection]);
114
115     return (m_sDefaultPhantom);
116 }
117
118
119 DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.)
120     : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
121 {
122   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
123
124   pTopSizer->Add (new wxStaticText (this, -1, "Set Image Display Minimum and Maximum"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
125                    
126   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
127
128   ostringstream os;
129   os << dDefaultMin;
130   m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
131   ostringstream osMax;
132   osMax << dDefaultMax;
133   m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
134
135   wxGridSizer *pGridSizer = new wxGridSizer (2, 2, 5);
136   pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
137   pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
138   pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
139   pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
140   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
141
142   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
143
144   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
145   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
146   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
147   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
148   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
149
150   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
151
152   SetAutoLayout (true);
153   SetSizer (pTopSizer);
154   pTopSizer->Fit (this);
155   pTopSizer->SetSizeHints (this);
156 }
157
158 DialogGetImageMinMax::~DialogGetImageMinMax (void)
159 {
160 #if 0
161   delete m_pTextCtrlMin;
162   delete m_pTextCtrlMax;
163 #endif
164 }
165
166 double
167 DialogGetImageMinMax::getMinimum (void)
168 {
169     wxString strCtrl = m_pTextCtrlMin->GetValue();
170     double dValue;
171     if (strCtrl.ToDouble (&dValue))
172         return dValue;
173     else
174         return (m_dDefaultMin);
175 }
176
177 double
178 DialogGetImageMinMax::getMaximum (void)
179 {
180     wxString strCtrl = m_pTextCtrlMax->GetValue();
181     double dValue;
182     if (strCtrl.ToDouble (&dValue))
183         return dValue;
184     else
185         return (m_dDefaultMax);
186 }
187
188
189 /////////////////////////////////////////////////////////////////////
190 // CLASS IDENTIFICATION
191 //
192 // DialogGetRasterParameters
193 /////////////////////////////////////////////////////////////////////
194
195 DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultNSamples = 1)
196     : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
197 {
198   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
199
200   pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
201                    
202   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
203
204   ostringstream os;
205   os << iDefaultXSize;
206   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
207   ostringstream osYSize;
208   osYSize << iDefaultYSize;
209   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
210   ostringstream osNSamples;
211   osNSamples << iDefaultNSamples;
212   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
213
214   wxGridSizer *pGridSizer = new wxGridSizer (2, 3, 5);
215   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
216   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
217   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
218   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
219   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
220   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
221   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
222
223   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
224
225   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
226   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
227   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
228   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
229   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
230
231   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
232
233   SetAutoLayout (true);
234   SetSizer (pTopSizer);
235   pTopSizer->Fit (this);
236   pTopSizer->SetSizeHints (this);
237 }
238
239 DialogGetRasterParameters::~DialogGetRasterParameters (void)
240 {
241 }
242
243
244 unsigned int
245 DialogGetRasterParameters::getXSize (void)
246 {
247     wxString strCtrl = m_pTextCtrlXSize->GetValue();
248     unsigned long lValue;
249     if (strCtrl.ToULong (&lValue))
250         return lValue;
251     else
252         return (m_iDefaultXSize);
253 }
254
255 unsigned int
256 DialogGetRasterParameters::getYSize (void)
257 {
258     wxString strCtrl = m_pTextCtrlYSize->GetValue();
259     unsigned long lValue;
260     if (strCtrl.ToULong (&lValue))
261         return lValue;
262     else
263         return (m_iDefaultYSize);
264 }
265
266
267 unsigned int
268 DialogGetRasterParameters::getNSamples (void)
269 {
270     wxString strCtrl = m_pTextCtrlNSamples->GetValue();
271     unsigned long lValue;
272     if (strCtrl.ToULong (&lValue))
273         return lValue;
274     else
275         return (m_iDefaultNSamples);
276 }
277
278
279
280 /////////////////////////////////////////////////////////////////////
281 // CLASS IDENTIFICATION
282 //
283 // DialogGetProjectionParameters
284 /////////////////////////////////////////////////////////////////////
285
286 const wxString DialogGetProjectionParameters::s_asGeometry[] = 
287
288     wxString(Scanner::GEOMETRY_PARALLEL_STR),
289     wxString(Scanner::GEOMETRY_EQUILINEAR_STR),
290     wxString(Scanner::GEOMETRY_EQUIANGULAR_STR),
291 };
292 const wxString DialogGetProjectionParameters::s_asGeometryTitle[] = 
293
294     wxString(Scanner::GEOMETRY_PARALLEL_TITLE_STR),
295     wxString(Scanner::GEOMETRY_EQUILINEAR_TITLE_STR),
296     wxString(Scanner::GEOMETRY_EQUIANGULAR_TITLE_STR),
297 };
298 const unsigned int DialogGetProjectionParameters::s_iNumGeometry = sizeof(s_asGeometry) / sizeof(wxString);
299
300
301 DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., const char* szDefaultGeometry = NULL)
302     : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
303 {
304   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
305
306   pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
307                    
308   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
309
310   m_pListBoxGeometry = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumGeometry, s_asGeometryTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
311   pTopSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
312
313   ostringstream os;
314   os << iDefaultNDet;
315   m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
316   ostringstream osNView;
317   osNView << iDefaultNView;
318   m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
319   ostringstream osNSamples;
320   osNSamples << iDefaultNSamples;
321   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
322   ostringstream osRotAngle;
323   osRotAngle << dDefaultRotAngle;
324   m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
325
326   wxGridSizer *pGridSizer = new wxGridSizer (2, 4, 5);
327   pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
328   pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
329   pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
330   pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
331   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
332   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
333   pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
334   pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
335   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
336   m_sDefaultGeometry = szDefaultGeometry;
337
338   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
339
340   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
341   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
342   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
343   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
344   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
345
346   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
347
348   SetAutoLayout (true);
349   SetSizer (pTopSizer);
350   pTopSizer->Fit (this);
351   pTopSizer->SetSizeHints (this);
352 }
353
354 DialogGetProjectionParameters::~DialogGetProjectionParameters (void)
355 {
356 }
357
358
359 unsigned int
360 DialogGetProjectionParameters::getNDet (void)
361 {
362     wxString strCtrl = m_pTextCtrlNDet->GetValue();
363     unsigned long lValue;
364     if (strCtrl.ToULong (&lValue))
365         return lValue;
366     else
367         return (m_iDefaultNDet);
368 }
369
370 unsigned int
371 DialogGetProjectionParameters::getNView (void)
372 {
373     wxString strCtrl = m_pTextCtrlNView->GetValue();
374     unsigned long lValue;
375     if (strCtrl.ToULong (&lValue))
376         return lValue;
377     else
378         return (m_iDefaultNView);
379 }
380
381
382 unsigned int
383 DialogGetProjectionParameters::getNSamples (void)
384 {
385     wxString strCtrl = m_pTextCtrlNSamples->GetValue();
386     unsigned long lValue;
387     if (strCtrl.ToULong (&lValue))
388         return lValue;
389     else
390         return (m_iDefaultNSamples);
391 }
392
393 double
394 DialogGetProjectionParameters::getRotAngle (void)
395 {
396     wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
397     double dValue;
398     if (strCtrl.ToDouble (&dValue))
399         return (dValue * PI);
400     else
401       return (m_dDefaultRotAngle);
402 }
403
404 const wxString&
405 DialogGetProjectionParameters::getGeometry (void)
406 {
407     int selection = m_pListBoxGeometry->GetSelection();
408     if (selection >= 0)
409         return (s_asGeometry[selection]);
410
411     return m_sDefaultGeometry;
412 }
413
414
415
416 /////////////////////////////////////////////////////////////////////
417 // CLASS IDENTIFICATION
418 //
419 // DialogGetReconstructionParameters
420 /////////////////////////////////////////////////////////////////////
421
422 const wxString DialogGetReconstructionParameters::s_asFilter[] = 
423
424     wxString(SignalFilter::FILTER_ABS_BANDLIMIT_STR),
425     wxString(SignalFilter::FILTER_SHEPP_STR),
426 };
427 const wxString DialogGetReconstructionParameters::s_asFilterTitle[] = 
428
429     wxString(SignalFilter::FILTER_ABS_BANDLIMIT_TITLE_STR),
430     wxString(SignalFilter::FILTER_SHEPP_TITLE_STR),
431 };
432 const unsigned int DialogGetReconstructionParameters::s_iNumFilter = sizeof(s_asFilter) / sizeof(wxString);
433
434
435 const wxString DialogGetReconstructionParameters::s_asInterp[] = 
436
437   wxString(Backprojector::INTERP_NEAREST_STR),
438     wxString(Backprojector::INTERP_LINEAR_STR),
439 };
440 const wxString DialogGetReconstructionParameters::s_asInterpTitle[] = 
441
442   wxString(Backprojector::INTERP_NEAREST_TITLE_STR),
443     wxString(Backprojector::INTERP_LINEAR_TITLE_STR),
444     };
445 const unsigned int DialogGetReconstructionParameters::s_iNumInterp = sizeof(s_asInterp) / sizeof(wxString);
446
447
448 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, const char* szDefaultFilterName = NULL, double dDefaultFilterParam = 1.,  const char* szDefaultFilterMethodName = NULL, int iDefaultZeropad = 3, const char* szDefaultInterpName = NULL, int iDefaultInterpParam = 1, const char* szDefaultBackprojName = NULL)
449     : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
450 {
451   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
452
453   pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
454                    
455   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
456
457   m_pListBoxFilter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumFilter, s_asFilterTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
458   pTopSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
459
460   m_pListBoxInterp = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumInterp, s_asInterpTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
461   pTopSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
462
463   ostringstream os;
464   os << iDefaultXSize;
465   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
466   ostringstream osYSize;
467   osYSize << iDefaultYSize;
468   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
469   ostringstream osFilterParam;
470   osFilterParam << dDefaultFilterParam;
471   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
472   ostringstream osZeropad;
473   osZeropad << iDefaultZeropad;
474   m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
475   ostringstream osInterpParam;
476   osInterpParam << iDefaultInterpParam;
477   m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
478
479   wxGridSizer *pGridSizer = new wxGridSizer (2, 5, 5);
480   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
481   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
482   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
483   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
484   pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
485   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_CENTER_VERTICAL);
486   pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
487   pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_CENTER_VERTICAL);
488   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
489   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_CENTER_VERTICAL);
490   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
491
492   m_sDefaultFilterName = szDefaultFilterName;
493   m_sDefaultFilterMethodName = szDefaultFilterMethodName;
494   m_sDefaultInterpName = szDefaultInterpName;
495   m_sDefaultBackprojName = szDefaultBackprojName;
496
497   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
498
499   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
500   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
501   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
502   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
503   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
504
505   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
506
507   SetAutoLayout (true);
508   SetSizer (pTopSizer);
509   pTopSizer->Fit (this);
510   pTopSizer->SetSizeHints (this);
511 }
512
513 DialogGetReconstructionParameters::~DialogGetReconstructionParameters (void)
514 {
515 }
516
517
518 unsigned int
519 DialogGetReconstructionParameters::getXSize (void)
520 {
521     wxString strCtrl = m_pTextCtrlXSize->GetValue();
522     unsigned long lValue;
523     if (strCtrl.ToULong (&lValue))
524         return lValue;
525     else
526         return (m_iDefaultXSize);
527 }
528
529 unsigned int
530 DialogGetReconstructionParameters::getYSize (void)
531 {
532     wxString strCtrl = m_pTextCtrlYSize->GetValue();
533     unsigned long lValue;
534     if (strCtrl.ToULong (&lValue))
535         return lValue;
536     else
537         return (m_iDefaultYSize);
538 }
539
540 unsigned int
541 DialogGetReconstructionParameters::getZeropad (void)
542 {
543     wxString strCtrl = m_pTextCtrlZeropad->GetValue();
544     unsigned long lValue;
545     if (strCtrl.ToULong (&lValue))
546         return lValue;
547     else
548         return (m_iDefaultZeropad);
549 }
550
551
552 unsigned int
553 DialogGetReconstructionParameters::getInterpParam (void)
554 {
555     wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
556     unsigned long lValue;
557     if (strCtrl.ToULong (&lValue))
558         return lValue;
559     else
560         return (m_iDefaultInterpParam);
561 }
562
563 double
564 DialogGetReconstructionParameters::getFilterParam (void)
565 {
566     wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
567     double dValue;
568     if (strCtrl.ToDouble (&dValue))
569         return (dValue);
570     else
571       return (m_dDefaultFilterParam);
572 }
573
574 const wxString&
575 DialogGetReconstructionParameters::getFilterName (void)
576 {
577     int selection = m_pListBoxFilter->GetSelection();
578     if (selection >= 0)
579         return (s_asFilter[selection]);
580
581     return m_sDefaultFilterName;
582 }
583
584 const wxString&
585 DialogGetReconstructionParameters::getFilterMethodName (void)
586 {
587   return m_sDefaultFilterMethodName;
588 }
589
590 const wxString&
591 DialogGetReconstructionParameters::getInterpName (void)
592 {
593     int selection = m_pListBoxInterp->GetSelection();
594     if (selection >= 0)
595         return (s_asInterp[selection]);
596
597     return m_sDefaultInterpName;
598 }
599
600 const wxString&
601 DialogGetReconstructionParameters::getBackprojName (void)
602 {
603   return m_sDefaultBackprojName;
604 }