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