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