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