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