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