r520: no message
[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-2001 Kevin Rosenberg
11 **
12 **  $Id: dialogs.cpp,v 1.29 2001/02/11 04:56:38 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 "ctsim.h"
51 #include "ct.h"
52 //#include "ctsupport.h"
53 //#include "scanner.h"
54 //#include "phantom.h"
55 //#include "filter.h"
56 //#include "backprojectors.h"
57 #include "docs.h"
58 #include "views.h"
59 #include "imagefile.h"
60
61 #if defined(MSVC) || HAVE_SSTREAM
62 #include <sstream>
63 #else
64 #include <sstream_subst>
65 #endif
66
67
68 ///////////////////////////////////////////////////////////////////////
69 // CLASS IMPLEMENTATION
70 //    StringValueAndTitleListBox
71 ///////////////////////////////////////////////////////////////////////
72
73 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
74 : wxListBox ()
75 {
76   wxString* psTitle = new wxString [nChoices];
77   for (int i = 0; i < nChoices; i++)
78     psTitle[i] = aszTitle[i];
79   
80   Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
81   
82   m_ppszValues = aszValue;
83   delete [] psTitle;
84 };
85
86 const char*
87 StringValueAndTitleListBox::getSelectionStringValue () const
88 {
89   return m_ppszValues[GetSelection()];
90 }
91
92
93 ///////////////////////////////////////////////////////////////////////
94 // CLASS IMPLEMENTATION
95 //    DialogGetPhantom
96 ///////////////////////////////////////////////////////////////////////
97
98 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
99 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
100 {
101   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
102   
103   pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxALL, 5);
104   
105   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
106   
107   m_pListBoxPhantom = new StringValueAndTitleListBox (this, Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
108   m_pListBoxPhantom->SetSelection (iDefaultPhantom);
109   pTopSizer->Add (m_pListBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
110   
111   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
112   
113   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
114   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
115   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
116   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
117   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
118   
119   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
120   
121   SetAutoLayout (true);
122   SetSizer (pTopSizer);
123   pTopSizer->Fit (this);
124   pTopSizer->SetSizeHints (this);
125 }
126
127 const char*
128 DialogGetPhantom::getPhantom()
129 {
130   return m_pListBoxPhantom->getSelectionStringValue();
131 }
132
133
134 ///////////////////////////////////////////////////////////////////////
135 // CLASS IMPLEMENTATION
136 //    DialogGetComparisonImage
137 ///////////////////////////////////////////////////////////////////////
138
139 DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
140 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
141 {
142   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
143   
144   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
145   
146   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
147   
148   int iNImages = m_rVecIF.size();
149   wxString* pstrImages = new wxString [iNImages];
150   for (int i = 0; i < iNImages; i++) {
151     ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
152     if (pView)
153       pstrImages[i] = pView->getFrame()->GetTitle();
154   }
155
156   m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
157   delete [] pstrImages;
158
159   m_pListBoxImageChoices->SetSelection (0);
160   pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
161   
162   if (bShowMakeDifference) {
163     m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
164     m_pMakeDifferenceImage->SetValue (FALSE);
165     pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
166   } else
167     m_pMakeDifferenceImage = NULL;
168
169   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
170   
171   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
172   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
173   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
174   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
175   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
176   
177   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
178   
179   SetAutoLayout (true);
180   SetSizer (pTopSizer);
181   pTopSizer->Fit (this);
182   pTopSizer->SetSizeHints (this);
183 }
184
185 ImageFileDocument*
186 DialogGetComparisonImage::getImageFileDocument()
187 {
188   return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
189 }
190
191 bool
192 DialogGetComparisonImage::getMakeDifferenceImage()
193 {
194   if (m_pMakeDifferenceImage)
195     return m_pMakeDifferenceImage->GetValue();
196   else
197     return false;
198 }
199
200
201 /////////////////////////////////////////////////////////////////////
202 // CLASS DiaglogGetMinMax Implementation
203 /////////////////////////////////////////////////////////////////////
204
205 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
206 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
207 {
208   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
209   
210   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
211   
212   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
213   
214   std::ostringstream os;
215   os << dDefaultMin;
216   m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
217   std::ostringstream osMax;
218   osMax << dDefaultMax;
219   m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
220   
221   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
222   pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
223   pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
224   pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
225   pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
226   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
227   
228   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
229   
230   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
231   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
232   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
233   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
234   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
235   
236   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
237   
238   SetAutoLayout (true);
239   SetSizer (pTopSizer);
240   pTopSizer->Fit (this);
241   pTopSizer->SetSizeHints (this);
242 }
243
244 DialogGetMinMax::~DialogGetMinMax ()
245 {
246 }
247
248 double
249 DialogGetMinMax::getMinimum ()
250 {
251   wxString strCtrl = m_pTextCtrlMin->GetValue();
252   double dValue;
253   if (strCtrl.ToDouble (&dValue))
254     return dValue;
255   else
256     return (m_dDefaultMin);
257 }
258
259 double
260 DialogGetMinMax::getMaximum ()
261 {
262   wxString strCtrl = m_pTextCtrlMax->GetValue();
263   double dValue;
264   if (strCtrl.ToDouble (&dValue))
265     return dValue;
266   else
267     return (m_dDefaultMax);
268 }
269
270
271 /////////////////////////////////////////////////////////////////////
272 // CLASS DialogAutoScaleParameters IMPLEMENTATION
273 /////////////////////////////////////////////////////////////////////
274
275 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
276 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
277 {
278   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
279   
280   pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
281   
282   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
283   
284   wxString asTitle[3];
285   asTitle[0] = "Median";
286   asTitle[1] = "Mode";
287   asTitle[2] = "Mean";
288   
289   m_pListBoxCenter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 3, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
290   m_pListBoxCenter->SetSelection (0);
291   pTopSizer->Add (m_pListBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
292   
293   wxGridSizer *pGridSizer = new wxGridSizer (2);
294   pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
295   std::ostringstream osDefaultFactor;
296   osDefaultFactor << dDefaultScaleFactor;
297   m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
298   pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
299   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
300   
301   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
302   
303   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
304   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
305   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
306   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
307   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
308   
309   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
310   
311   SetAutoLayout (true);
312   SetSizer (pTopSizer);
313   pTopSizer->Fit (this);
314   pTopSizer->SetSizeHints (this);
315 }
316
317 bool
318 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
319 {
320   int iCenter = m_pListBoxCenter->GetSelection();
321   double dCenter = m_dMedian;
322   if (iCenter == 1)
323     dCenter = m_dMode;
324   else if (iCenter == 2)
325     dCenter = m_dMode;
326   
327   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
328   double dValue;
329   if (! sStddevFactor.ToDouble (&dValue)) {
330     *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
331     return false;
332   }
333   double dHalfWidth = dValue * m_dStdDev / 2;
334   *pMin = dCenter - dHalfWidth;
335   *pMax = dCenter + dHalfWidth;
336   *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
337   
338   return true;
339 }
340
341 double
342 DialogAutoScaleParameters::getAutoScaleFactor ()
343 {
344   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
345   double dValue = 1.;
346   if (! sStddevFactor.ToDouble (&dValue)) {
347     *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
348   }
349   
350   return dValue;
351 }
352
353
354 /////////////////////////////////////////////////////////////////////
355 // CLASS IDENTIFICATION
356 //
357 // DialogGetRasterParameters
358 /////////////////////////////////////////////////////////////////////
359
360 DialogGetRasterParameters::DialogGetRasterParameters 
361    (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
362 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
363 {
364   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
365   
366   pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
367   
368   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
369     
370   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
371   std::ostringstream os;
372   os << iDefaultXSize;
373   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
374   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
375   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
376   std::ostringstream osYSize;
377   osYSize << iDefaultYSize;
378   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
379   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
380   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
381   std::ostringstream osViewRatio;
382   osViewRatio << dDefaultViewRatio;
383   m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
384   pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
385   pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
386   std::ostringstream osNSamples;
387   osNSamples << iDefaultNSamples;
388   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
389   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
390   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
391
392   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
393   
394   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
395   
396   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
397   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
398   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
399   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
400   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
401   
402   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
403   
404   SetAutoLayout (true);
405   SetSizer (pTopSizer);
406   pTopSizer->Fit (this);
407   pTopSizer->SetSizeHints (this);
408 }
409
410 DialogGetRasterParameters::~DialogGetRasterParameters ()
411 {
412 }
413
414
415 unsigned int
416 DialogGetRasterParameters::getXSize ()
417 {
418   wxString strCtrl = m_pTextCtrlXSize->GetValue();
419   unsigned long lValue;
420   if (strCtrl.ToULong (&lValue))
421     return lValue;
422   else
423     return (m_iDefaultXSize);
424 }
425
426 unsigned int
427 DialogGetRasterParameters::getYSize ()
428 {
429   wxString strCtrl = m_pTextCtrlYSize->GetValue();
430   unsigned long lValue;
431   if (strCtrl.ToULong (&lValue))
432     return lValue;
433   else
434     return (m_iDefaultYSize);
435 }
436
437 unsigned int
438 DialogGetRasterParameters::getNSamples ()
439 {
440   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
441   unsigned long lValue;
442   if (strCtrl.ToULong (&lValue))
443     return lValue;
444   else
445     return (m_iDefaultNSamples);
446 }
447
448 double
449 DialogGetRasterParameters::getViewRatio ()
450 {
451   wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
452   double dValue;
453   if (strCtrl.ToDouble (&dValue))
454     return dValue;
455   else
456     return (m_dDefaultViewRatio);
457 }
458
459
460 /////////////////////////////////////////////////////////////////////
461 // CLASS IDENTIFICATION
462 //
463 // DialogGetProjectionParameters
464 /////////////////////////////////////////////////////////////////////
465
466
467 DialogGetProjectionParameters::DialogGetProjectionParameters 
468    (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, 
469     double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
470     double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
471 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
472 {
473   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
474   
475   m_dDefaultRotAngle = dDefaultRotAngle;
476   m_dDefaultFocalLength = dDefaultFocalLength;
477   m_dDefaultViewRatio = dDefaultViewRatio;
478   m_dDefaultScanRatio = dDefaultScanRatio;
479   m_iDefaultNSamples = iDefaultNSamples;
480   m_iDefaultNView = iDefaultNView;
481   m_iDefaultNDet = iDefaultNDet;
482   m_iDefaultTrace = iDefaultTrace;
483   m_iDefaultGeometry = iDefaultGeometry;
484   
485   pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
486   
487   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
488     
489   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
490   pGridSizer->Add (new wxStaticText (this, -1, "Scanner Geometry"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
491   m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
492   m_pListBoxGeometry->SetSelection (iDefaultGeometry);
493   
494   pGridSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
495   
496   std::ostringstream os;
497   os << iDefaultNDet;
498   m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
499   pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
500   pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
501   std::ostringstream osNView;
502   osNView << iDefaultNView;
503   m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
504   pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
505   pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
506   std::ostringstream osNSamples;
507   osNSamples << iDefaultNSamples;
508   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
509   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
510   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
511   if (theApp->getAdvancedOptions()) {
512     std::ostringstream osRotAngle;
513     osRotAngle << dDefaultRotAngle;
514     m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
515     pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
516     pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
517   }
518   std::ostringstream osFocalLength;
519   osFocalLength << dDefaultFocalLength;
520   m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
521   pGridSizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
522   pGridSizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
523   std::ostringstream osViewRatio;
524   osViewRatio << dDefaultViewRatio;
525   m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
526   pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
527   pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
528   std::ostringstream osScanRatio;
529   osScanRatio << dDefaultScanRatio;
530   m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
531   pGridSizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
532   pGridSizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
533   
534   m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
535   m_pListBoxTrace->SetSelection (iDefaultTrace);
536   
537   pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
538   pGridSizer->Add (m_pListBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
539   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
540   
541   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
542   
543   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
544   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
545   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
546   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
547   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
548   
549   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
550   
551   SetAutoLayout (true);
552   SetSizer (pTopSizer);
553   pTopSizer->Fit (this);
554   pTopSizer->SetSizeHints (this);
555 }
556
557 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
558 {
559 }
560
561
562 unsigned int
563 DialogGetProjectionParameters::getNDet ()
564 {
565   wxString strCtrl = m_pTextCtrlNDet->GetValue();
566   unsigned long lValue;
567   if (strCtrl.ToULong (&lValue))
568     return lValue;
569   else
570     return (m_iDefaultNDet);
571 }
572
573 unsigned int
574 DialogGetProjectionParameters::getNView ()
575 {
576   wxString strCtrl = m_pTextCtrlNView->GetValue();
577   unsigned long lValue;
578   if (strCtrl.ToULong (&lValue))
579     return lValue;
580   else
581     return (m_iDefaultNView);
582 }
583
584
585 unsigned int
586 DialogGetProjectionParameters::getNSamples ()
587 {
588   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
589   unsigned long lValue;
590   if (strCtrl.ToULong (&lValue))
591     return lValue;
592   else
593     return (m_iDefaultNSamples);
594 }
595
596 double
597 DialogGetProjectionParameters::getRotAngle ()
598 {
599   if (theApp->getAdvancedOptions()) {
600     wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
601     double dValue;
602     if (strCtrl.ToDouble (&dValue))
603       return (dValue * PI);
604     else
605       return (m_dDefaultRotAngle);
606   } else {
607     if (Scanner::convertGeometryNameToID (m_pListBoxGeometry->getSelectionStringValue()) == 
608           Scanner::GEOMETRY_PARALLEL)
609       return (PI);
610     else
611       return (2 * PI);
612   }
613 }
614
615 double
616 DialogGetProjectionParameters::getFocalLengthRatio ()
617 {
618   wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
619   double dValue;
620   if (strCtrl.ToDouble (&dValue))
621     return (dValue);
622   else
623     return (m_dDefaultFocalLength);
624 }
625
626 double
627 DialogGetProjectionParameters::getViewRatio ()
628 {
629   wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
630   double dValue;
631   if (strCtrl.ToDouble (&dValue))
632     return (dValue);
633   else
634     return (m_dDefaultViewRatio);
635 }
636
637 double
638 DialogGetProjectionParameters::getScanRatio ()
639 {
640   wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
641   double dValue;
642   if (strCtrl.ToDouble (&dValue))
643     return (dValue);
644   else
645     return (m_dDefaultScanRatio);
646 }
647
648 const char*
649 DialogGetProjectionParameters::getGeometry ()
650 {
651   return m_pListBoxGeometry->getSelectionStringValue();
652 }
653
654 int
655 DialogGetProjectionParameters::getTrace ()
656 {
657   return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
658 }
659
660
661
662 /////////////////////////////////////////////////////////////////////
663 // CLASS IDENTIFICATION
664 //
665 // DialogGetReconstructionParameters
666 /////////////////////////////////////////////////////////////////////
667
668
669 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize, 
670                      int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  
671                      int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, 
672                      int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
673 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
674 {
675   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
676   
677   pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
678   
679   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
680   
681   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (6);
682   pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
683
684   if (theApp->getAdvancedOptions())
685     m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
686   else
687     m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
688   m_pListBoxFilter->SetSelection (iDefaultFilterID);
689   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
690   
691   m_pListBoxFilterMethod = new StringValueAndTitleListBox (this, ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
692   m_pListBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
693   pGridSizer->Add (new wxStaticText (this, -1, "Filter Method"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
694   pGridSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
695   
696   if (theApp->getAdvancedOptions()) {
697     m_pListBoxFilterGeneration = new StringValueAndTitleListBox (this, ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
698     m_pListBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
699     pGridSizer->Add (new wxStaticText (this, -1, "Filter Generation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
700     pGridSizer->Add (m_pListBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
701   
702     m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
703     m_pListBoxBackproject->SetSelection (iDefaultBackprojectID);
704     pGridSizer->Add (new wxStaticText (this, -1, "Backprojection"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
705     pGridSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
706   }
707
708   m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
709   m_pListBoxInterp->SetSelection (iDefaultInterpID);
710   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
711   pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
712   
713   
714   pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
715   static const char* aszTraceTitle[] = {"None", "Full"};
716   static const char* aszTraceName[] = {"none", "full"};
717   m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);
718   iTrace = clamp(iTrace, 0, 1);
719   m_pListBoxTrace->SetSelection (iTrace);
720   pGridSizer->Add (m_pListBoxTrace);
721   
722   std::ostringstream osHammingParam;
723   osHammingParam << dDefaultFilterParam;
724   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
725   pGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
726   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
727   std::ostringstream os;
728   os << iDefaultXSize;
729   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
730   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
731   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
732   std::ostringstream osYSize;
733   osYSize << iDefaultYSize;
734   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
735   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
736   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
737
738   if (theApp->getAdvancedOptions()) {
739     std::ostringstream osZeropad;
740     osZeropad << iDefaultZeropad;
741     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
742     pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
743     pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
744   }
745
746 #if HAVE_FREQ_PREINTERP
747   std::ostringstream osInterpParam;
748   osInterpParam << iDefaultInterpParam;
749   m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
750   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
751   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
752 #endif  
753   
754   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
755   
756   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
757   
758   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
759   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
760   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
761   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
762   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
763   
764   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
765   
766   SetAutoLayout (true);
767   SetSizer (pTopSizer);
768   pTopSizer->Layout();
769   pTopSizer->Fit (this);
770   pTopSizer->SetSizeHints (this);
771 }
772
773 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
774 {
775 }
776
777
778 unsigned int
779 DialogGetReconstructionParameters::getXSize ()
780 {
781   wxString strCtrl = m_pTextCtrlXSize->GetValue();
782   unsigned long lValue;
783   if (strCtrl.ToULong (&lValue))
784     return lValue;
785   else
786     return (m_iDefaultXSize);
787 }
788
789 unsigned int
790 DialogGetReconstructionParameters::getYSize ()
791 {
792   wxString strCtrl = m_pTextCtrlYSize->GetValue();
793   unsigned long lValue;
794   if (strCtrl.ToULong (&lValue))
795     return lValue;
796   else
797     return (m_iDefaultYSize);
798 }
799
800 unsigned int
801 DialogGetReconstructionParameters::getZeropad ()
802 {
803   if (theApp->getAdvancedOptions()) {
804     wxString strCtrl = m_pTextCtrlZeropad->GetValue();
805     unsigned long lValue;
806     if (strCtrl.ToULong (&lValue))
807       return lValue;
808     else
809       return (m_iDefaultZeropad);
810   } else
811     return 1;
812 }
813
814
815 unsigned int
816 DialogGetReconstructionParameters::getInterpParam ()
817 {
818 #if HAVE_FREQ_PREINTERP
819   wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
820   unsigned long lValue;
821   if (strCtrl.ToULong (&lValue))
822     return lValue;
823   else
824     return (m_iDefaultInterpParam);
825 #else
826   return 1;
827 #endif
828 }
829
830 double
831 DialogGetReconstructionParameters::getFilterParam ()
832 {
833   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
834   double dValue;
835   if (strCtrl.ToDouble (&dValue))
836     return (dValue);
837   else
838     return (m_dDefaultFilterParam);
839 }
840
841 const char*
842 DialogGetReconstructionParameters::getFilterName ()
843 {
844   return m_pListBoxFilter->getSelectionStringValue();
845 }
846
847 const char*
848 DialogGetReconstructionParameters::getFilterMethodName ()
849 {
850   return m_pListBoxFilterMethod->getSelectionStringValue();
851 }
852
853 const char*
854 DialogGetReconstructionParameters::getInterpName ()
855 {
856   return m_pListBoxInterp->getSelectionStringValue();
857 }
858
859 int
860 DialogGetReconstructionParameters::getTrace ()
861 {
862   int iTrace = 0;
863   if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0)
864     iTrace = Trace::TRACE_PLOT;
865   return iTrace;
866 }
867
868 const char*
869 DialogGetReconstructionParameters::getBackprojectName ()
870 {
871   if (theApp->getAdvancedOptions()) {
872     return m_pListBoxBackproject->getSelectionStringValue();
873   } else
874     return "idiff";
875 }
876
877 const char*
878 DialogGetReconstructionParameters::getFilterGenerationName ()
879 {
880   if (theApp->getAdvancedOptions()) {
881     return m_pListBoxFilterGeneration->getSelectionStringValue();
882   } else {
883     if (ProcessSignal::convertFilterMethodNameToID(m_pListBoxFilterMethod->getSelectionStringValue())
884         == ProcessSignal::FILTER_METHOD_CONVOLUTION)
885       return "direct";
886     else
887       return "inverse-fourier";
888   }
889 }
890
891
892 /////////////////////////////////////////////////////////////////////
893 // CLASS IDENTIFICATION
894 //
895 // DialogGetFilterParameters
896 /////////////////////////////////////////////////////////////////////
897
898
899
900 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
901 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
902 {
903   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
904   
905   pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
906   
907   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
908   
909   std::ostringstream os;
910   os << iDefaultXSize;
911   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
912   std::ostringstream osYSize;
913   osYSize << iDefaultYSize;
914   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
915   std::ostringstream osFilterParam;
916   osFilterParam << dDefaultFilterParam;
917   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
918   std::ostringstream osBandwidth;
919   osBandwidth << dDefaultBandwidth;
920   m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
921   std::ostringstream osInputScale;
922   osInputScale << dDefaultInputScale;
923   m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
924   std::ostringstream osOutputScale;
925   osOutputScale << dDefaultOutputScale;
926   m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
927   
928   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
929   pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
930   m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
931   m_pListBoxFilter->SetSelection (iDefaultFilterID);
932   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
933   
934   m_pListBoxDomain = new StringValueAndTitleListBox (this, SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
935   m_pListBoxDomain->SetSelection (iDefaultDomainID);
936   pGridSizer->Add (new wxStaticText (this, -1, "Domain"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
937   pGridSizer->Add (m_pListBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
938   
939   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
940   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
941   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
942   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
943   pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
944   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
945   pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
946   pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
947   pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
948   pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
949   pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
950   pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
951   
952   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
953   
954   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
955   
956   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
957   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
958   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
959   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
960   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
961   
962   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
963   
964   SetAutoLayout (true);
965   SetSizer (pTopSizer);
966   pTopSizer->Layout();
967   pTopSizer->Fit (this);
968   pTopSizer->SetSizeHints (this);
969 }
970
971 DialogGetFilterParameters::~DialogGetFilterParameters ()
972 {
973 }
974
975
976 unsigned int
977 DialogGetFilterParameters::getXSize ()
978 {
979   wxString strCtrl = m_pTextCtrlXSize->GetValue();
980   unsigned long lValue;
981   if (strCtrl.ToULong (&lValue))
982     return lValue;
983   else
984     return (m_iDefaultXSize);
985 }
986
987 unsigned int
988 DialogGetFilterParameters::getYSize ()
989 {
990   wxString strCtrl = m_pTextCtrlYSize->GetValue();
991   unsigned long lValue;
992   if (strCtrl.ToULong (&lValue))
993     return lValue;
994   else
995     return (m_iDefaultYSize);
996 }
997
998 double
999 DialogGetFilterParameters::getBandwidth ()
1000 {
1001   wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1002   double dValue;
1003   if (strCtrl.ToDouble (&dValue))
1004     return dValue;
1005   else
1006     return (m_dDefaultBandwidth);
1007 }
1008
1009 double
1010 DialogGetFilterParameters::getFilterParam ()
1011 {
1012   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1013   double dValue;
1014   if (strCtrl.ToDouble (&dValue))
1015     return (dValue);
1016   else
1017     return (m_dDefaultFilterParam);
1018 }
1019
1020 double
1021 DialogGetFilterParameters::getInputScale ()
1022 {
1023   wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1024   double dValue;
1025   if (strCtrl.ToDouble (&dValue))
1026     return dValue;
1027   else
1028     return (m_dDefaultInputScale);
1029 }
1030
1031 double
1032 DialogGetFilterParameters::getOutputScale ()
1033 {
1034   wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1035   double dValue;
1036   if (strCtrl.ToDouble (&dValue))
1037     return dValue;
1038   else
1039     return (m_dDefaultOutputScale);
1040 }
1041
1042 const char*
1043 DialogGetFilterParameters::getFilterName ()
1044 {
1045   return m_pListBoxFilter->getSelectionStringValue();
1046 }
1047
1048 const char*
1049 DialogGetFilterParameters::getDomainName ()
1050 {
1051   return m_pListBoxDomain->getSelectionStringValue();
1052 }
1053
1054
1055 ///////////////////////////////////////////////////////////////////////
1056 // CLASS IMPLEMENTATION
1057 //    DialogExportParameters
1058 ///////////////////////////////////////////////////////////////////////
1059
1060 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1061 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1062 {
1063   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1064   
1065   pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1066   
1067   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1068   
1069   m_pListBoxFormat = new StringValueAndTitleListBox (this, ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1070   m_pListBoxFormat->SetSelection (iDefaultFormatID);
1071   pTopSizer->Add (m_pListBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1072   
1073   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1074   
1075   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1076   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1077   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1078   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1079   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1080   
1081   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1082   
1083   SetAutoLayout (true);
1084   SetSizer (pTopSizer);
1085   pTopSizer->Fit (this);
1086   pTopSizer->SetSizeHints (this);
1087 }
1088
1089 const char*
1090 DialogExportParameters::getFormatName()
1091 {
1092   return m_pListBoxFormat->getSelectionStringValue();
1093 }
1094
1095
1096 /////////////////////////////////////////////////////////////////////
1097 // CLASS DiaglogGetXYSize Implementation
1098 /////////////////////////////////////////////////////////////////////
1099
1100 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1101 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1102 {
1103   m_iDefaultXSize = iDefaultXSize;
1104   m_iDefaultYSize = iDefaultYSize;
1105
1106   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1107   
1108   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1109   
1110   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1111   
1112   std::ostringstream os;
1113   os << iDefaultXSize;
1114   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1115   std::ostringstream osYSize;
1116   osYSize << iDefaultYSize;
1117   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1118   
1119   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1120   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1121   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1122   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1123   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1124   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1125   
1126   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1127   
1128   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1129   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1130   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1131   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1132   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1133   
1134   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1135   
1136   SetAutoLayout (true);
1137   SetSizer (pTopSizer);
1138   pTopSizer->Fit (this);
1139   pTopSizer->SetSizeHints (this);
1140 }
1141
1142 DialogGetXYSize::~DialogGetXYSize ()
1143 {
1144 }
1145
1146 unsigned int
1147 DialogGetXYSize::getXSize ()
1148 {
1149   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1150   long lValue;
1151   if (strCtrl.ToLong (&lValue))
1152     return lValue;
1153   else
1154     return (m_iDefaultXSize);
1155 }
1156
1157 unsigned int
1158 DialogGetXYSize::getYSize ()
1159 {
1160   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1161   long lValue;
1162   if (strCtrl.ToLong (&lValue))
1163     return lValue;
1164   else
1165     return (m_iDefaultYSize);
1166 }
1167
1168
1169
1170 /////////////////////////////////////////////////////////////////////
1171 // CLASS IDENTIFICATION
1172 //
1173 // DialogGetConvertPolarParameters
1174 /////////////////////////////////////////////////////////////////////
1175
1176 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, 
1177        int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1178 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1179 {
1180   m_iDefaultXSize = iDefaultXSize;
1181   m_iDefaultYSize = iDefaultYSize;
1182   m_iDefaultZeropad = iDefaultZeropad;
1183
1184   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1185   
1186   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1187   
1188   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1189   
1190   std::ostringstream os;
1191   os << iDefaultXSize;
1192   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1193   std::ostringstream osYSize;
1194   osYSize << iDefaultYSize;
1195   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1196   
1197   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1198   
1199   m_pListBoxInterpolation = new StringValueAndTitleListBox (this, Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1200   m_pListBoxInterpolation->SetSelection (iDefaultInterpolationID);
1201   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1202   pGridSizer->Add (m_pListBoxInterpolation, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1203   
1204   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1205   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1206   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1207   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1208   if (iDefaultZeropad >= 0) {
1209     std::ostringstream osZeropad;
1210     osZeropad << iDefaultZeropad;
1211     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1212     pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1213     pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1214   }
1215   
1216   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1217   
1218   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1219   
1220   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1221   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1222   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1223   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1224   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1225   
1226   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1227   
1228   SetAutoLayout (true);
1229   SetSizer (pTopSizer);
1230   pTopSizer->Layout();
1231   pTopSizer->Fit (this);
1232   pTopSizer->SetSizeHints (this);
1233 }
1234
1235
1236 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1237 {
1238 }
1239
1240
1241 unsigned int
1242 DialogGetConvertPolarParameters::getXSize ()
1243 {
1244   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1245   unsigned long lValue;
1246   if (strCtrl.ToULong (&lValue))
1247     return lValue;
1248   else
1249     return (m_iDefaultXSize);
1250 }
1251
1252 unsigned int
1253 DialogGetConvertPolarParameters::getYSize ()
1254 {
1255   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1256   unsigned long lValue;
1257   if (strCtrl.ToULong (&lValue))
1258     return lValue;
1259   else
1260     return (m_iDefaultYSize);
1261 }
1262
1263 unsigned int
1264 DialogGetConvertPolarParameters::getZeropad ()
1265 {
1266   wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1267   unsigned long lValue;
1268   if (strCtrl.ToULong (&lValue))
1269     return lValue;
1270   else
1271     return (m_iDefaultZeropad);
1272 }
1273
1274 const char*
1275 DialogGetConvertPolarParameters::getInterpolationName ()
1276 {
1277   return m_pListBoxInterpolation->getSelectionStringValue();
1278 }
1279