bfa301067bf6f090e01902286485ee77283781b1
[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-2000 Kevin Rosenberg
11 **
12 **  $Id: dialogs.cpp,v 1.26 2001/01/20 17:43:41 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 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples)
361 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
362 {
363   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
364   
365   pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
366   
367   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
368   
369   std::ostringstream os;
370   os << iDefaultXSize;
371   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
372   std::ostringstream osYSize;
373   osYSize << iDefaultYSize;
374   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
375   std::ostringstream osNSamples;
376   osNSamples << iDefaultNSamples;
377   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
378   
379   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
380   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
381   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
382   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
383   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
384   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
385   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
386   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
387   
388   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
389   
390   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
391   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
392   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
393   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
394   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
395   
396   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
397   
398   SetAutoLayout (true);
399   SetSizer (pTopSizer);
400   pTopSizer->Fit (this);
401   pTopSizer->SetSizeHints (this);
402 }
403
404 DialogGetRasterParameters::~DialogGetRasterParameters ()
405 {
406 }
407
408
409 unsigned int
410 DialogGetRasterParameters::getXSize ()
411 {
412   wxString strCtrl = m_pTextCtrlXSize->GetValue();
413   unsigned long lValue;
414   if (strCtrl.ToULong (&lValue))
415     return lValue;
416   else
417     return (m_iDefaultXSize);
418 }
419
420 unsigned int
421 DialogGetRasterParameters::getYSize ()
422 {
423   wxString strCtrl = m_pTextCtrlYSize->GetValue();
424   unsigned long lValue;
425   if (strCtrl.ToULong (&lValue))
426     return lValue;
427   else
428     return (m_iDefaultYSize);
429 }
430
431
432 unsigned int
433 DialogGetRasterParameters::getNSamples ()
434 {
435   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
436   unsigned long lValue;
437   if (strCtrl.ToULong (&lValue))
438     return lValue;
439   else
440     return (m_iDefaultNSamples);
441 }
442
443
444
445 /////////////////////////////////////////////////////////////////////
446 // CLASS IDENTIFICATION
447 //
448 // DialogGetProjectionParameters
449 /////////////////////////////////////////////////////////////////////
450
451
452 DialogGetProjectionParameters::DialogGetProjectionParameters (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultFieldOfView, int iDefaultGeometry, int iDefaultTrace)
453 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
454 {
455   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
456   
457   m_dDefaultRotAngle = dDefaultRotAngle;
458   m_dDefaultFocalLength = dDefaultFocalLength;
459   m_dDefaultFieldOfView = dDefaultFieldOfView;
460   m_iDefaultNSamples = iDefaultNSamples;
461   m_iDefaultNView = iDefaultNView;
462   m_iDefaultNDet = iDefaultNDet;
463   m_iDefaultTrace = iDefaultTrace;
464   m_iDefaultGeometry = iDefaultGeometry;
465   
466   pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
467   
468   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
469   
470   std::ostringstream os;
471   os << iDefaultNDet;
472   m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
473   std::ostringstream osNView;
474   osNView << iDefaultNView;
475   m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
476   std::ostringstream osNSamples;
477   osNSamples << iDefaultNSamples;
478   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
479   std::ostringstream osRotAngle;
480   osRotAngle << dDefaultRotAngle;
481   m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
482   std::ostringstream osFocalLength;
483   osFocalLength << dDefaultFocalLength;
484   m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
485   std::ostringstream osFieldOfView;
486   osFieldOfView << dDefaultFieldOfView;
487   m_pTextCtrlFieldOfView = new wxTextCtrl (this, -1, osFieldOfView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
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   pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
497   pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
498   pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
499   pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
500   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
501   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
502   pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
503   pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
504   pGridSizer->Add (new wxStaticText (this, -1, "Focal Length Ratio (phantom radius units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
505   pGridSizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
506   pGridSizer->Add (new wxStaticText (this, -1, "Field of View (phantom diameter units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
507   pGridSizer->Add (m_pTextCtrlFieldOfView, 0, wxALIGN_CENTER_VERTICAL);
508   
509   m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
510   m_pListBoxTrace->SetSelection (iDefaultTrace);
511   
512   pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
513   pGridSizer->Add (m_pListBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
514   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
515   
516   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
517   
518   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
519   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
520   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
521   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
522   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
523   
524   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
525   
526   SetAutoLayout (true);
527   SetSizer (pTopSizer);
528   pTopSizer->Fit (this);
529   pTopSizer->SetSizeHints (this);
530 }
531
532 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
533 {
534 }
535
536
537 unsigned int
538 DialogGetProjectionParameters::getNDet ()
539 {
540   wxString strCtrl = m_pTextCtrlNDet->GetValue();
541   unsigned long lValue;
542   if (strCtrl.ToULong (&lValue))
543     return lValue;
544   else
545     return (m_iDefaultNDet);
546 }
547
548 unsigned int
549 DialogGetProjectionParameters::getNView ()
550 {
551   wxString strCtrl = m_pTextCtrlNView->GetValue();
552   unsigned long lValue;
553   if (strCtrl.ToULong (&lValue))
554     return lValue;
555   else
556     return (m_iDefaultNView);
557 }
558
559
560 unsigned int
561 DialogGetProjectionParameters::getNSamples ()
562 {
563   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
564   unsigned long lValue;
565   if (strCtrl.ToULong (&lValue))
566     return lValue;
567   else
568     return (m_iDefaultNSamples);
569 }
570
571 double
572 DialogGetProjectionParameters::getRotAngle ()
573 {
574   wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
575   double dValue;
576   if (strCtrl.ToDouble (&dValue))
577     return (dValue * PI);
578   else
579     return (m_dDefaultRotAngle);
580 }
581
582 double
583 DialogGetProjectionParameters::getFocalLengthRatio ()
584 {
585   wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
586   double dValue;
587   if (strCtrl.ToDouble (&dValue))
588     return (dValue);
589   else
590     return (m_dDefaultFocalLength);
591 }
592
593 double
594 DialogGetProjectionParameters::getFieldOfViewRatio ()
595 {
596   wxString strCtrl = m_pTextCtrlFieldOfView->GetValue();
597   double dValue;
598   if (strCtrl.ToDouble (&dValue))
599     return (dValue);
600   else
601     return (m_dDefaultFieldOfView);
602 }
603
604 const char*
605 DialogGetProjectionParameters::getGeometry ()
606 {
607   return m_pListBoxGeometry->getSelectionStringValue();
608 }
609
610 int
611 DialogGetProjectionParameters::getTrace ()
612 {
613   return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
614 }
615
616
617
618 /////////////////////////////////////////////////////////////////////
619 // CLASS IDENTIFICATION
620 //
621 // DialogGetReconstructionParameters
622 /////////////////////////////////////////////////////////////////////
623
624
625 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)
626 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
627 {
628   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
629   
630   pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
631   
632   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
633   
634   std::ostringstream os;
635   os << iDefaultXSize;
636   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
637   std::ostringstream osYSize;
638   osYSize << iDefaultYSize;
639   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
640   std::ostringstream osFilterParam;
641   osFilterParam << dDefaultFilterParam;
642   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
643   std::ostringstream osZeropad;
644   osZeropad << iDefaultZeropad;
645   m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
646   std::ostringstream osInterpParam;
647   osInterpParam << iDefaultInterpParam;
648   m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
649   
650   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (6);
651   pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
652   m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
653   m_pListBoxFilter->SetSelection (iDefaultFilterID);
654   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
655   
656   m_pListBoxFilterMethod = new StringValueAndTitleListBox (this, ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
657   m_pListBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
658   pGridSizer->Add (new wxStaticText (this, -1, "Filter Method"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
659   pGridSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
660   
661   m_pListBoxFilterGeneration = new StringValueAndTitleListBox (this, ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
662   m_pListBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
663   pGridSizer->Add (new wxStaticText (this, -1, "Filter Generation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
664   pGridSizer->Add (m_pListBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
665   
666   
667   m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
668   m_pListBoxBackproject->SetSelection (iDefaultBackprojectID);
669   pGridSizer->Add (new wxStaticText (this, -1, "Backprojection"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
670   pGridSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
671   
672   m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
673   m_pListBoxInterp->SetSelection (iDefaultInterpID);
674   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
675   pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
676   
677   
678   pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
679   static const char* aszTraceTitle[] = {"None", "Full"};
680   static const char* aszTraceName[] = {"none", "full"};
681   m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);
682   iTrace = clamp(iTrace, 0, 1);
683   m_pListBoxTrace->SetSelection (iTrace);
684   pGridSizer->Add (m_pListBoxTrace);
685   
686   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
687   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
688   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
689   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
690   pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
691   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
692   pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
693   pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
694   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
695   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
696   
697   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
698   
699   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
700   
701   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
702   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
703   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
704   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
705   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
706   
707   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
708   
709   SetAutoLayout (true);
710   SetSizer (pTopSizer);
711   pTopSizer->Layout();
712   pTopSizer->Fit (this);
713   pTopSizer->SetSizeHints (this);
714 }
715
716 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
717 {
718 }
719
720
721 unsigned int
722 DialogGetReconstructionParameters::getXSize ()
723 {
724   wxString strCtrl = m_pTextCtrlXSize->GetValue();
725   unsigned long lValue;
726   if (strCtrl.ToULong (&lValue))
727     return lValue;
728   else
729     return (m_iDefaultXSize);
730 }
731
732 unsigned int
733 DialogGetReconstructionParameters::getYSize ()
734 {
735   wxString strCtrl = m_pTextCtrlYSize->GetValue();
736   unsigned long lValue;
737   if (strCtrl.ToULong (&lValue))
738     return lValue;
739   else
740     return (m_iDefaultYSize);
741 }
742
743 unsigned int
744 DialogGetReconstructionParameters::getZeropad ()
745 {
746   wxString strCtrl = m_pTextCtrlZeropad->GetValue();
747   unsigned long lValue;
748   if (strCtrl.ToULong (&lValue))
749     return lValue;
750   else
751     return (m_iDefaultZeropad);
752 }
753
754
755 unsigned int
756 DialogGetReconstructionParameters::getInterpParam ()
757 {
758   wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
759   unsigned long lValue;
760   if (strCtrl.ToULong (&lValue))
761     return lValue;
762   else
763     return (m_iDefaultInterpParam);
764 }
765
766 double
767 DialogGetReconstructionParameters::getFilterParam ()
768 {
769   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
770   double dValue;
771   if (strCtrl.ToDouble (&dValue))
772     return (dValue);
773   else
774     return (m_dDefaultFilterParam);
775 }
776
777 const char*
778 DialogGetReconstructionParameters::getFilterName ()
779 {
780   return m_pListBoxFilter->getSelectionStringValue();
781 }
782
783 const char*
784 DialogGetReconstructionParameters::getFilterMethodName ()
785 {
786   return m_pListBoxFilterMethod->getSelectionStringValue();
787 }
788
789 const char*
790 DialogGetReconstructionParameters::getInterpName ()
791 {
792   return m_pListBoxInterp->getSelectionStringValue();
793 }
794
795 int
796 DialogGetReconstructionParameters::getTrace ()
797 {
798   int iTrace = 0;
799   if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0)
800     iTrace = Trace::TRACE_PLOT;
801   return iTrace;
802 }
803
804 const char*
805 DialogGetReconstructionParameters::getBackprojectName ()
806 {
807   return m_pListBoxBackproject->getSelectionStringValue();
808 }
809
810 const char*
811 DialogGetReconstructionParameters::getFilterGenerationName ()
812 {
813   return m_pListBoxFilterGeneration->getSelectionStringValue();
814 }
815
816
817 /////////////////////////////////////////////////////////////////////
818 // CLASS IDENTIFICATION
819 //
820 // DialogGetFilterParameters
821 /////////////////////////////////////////////////////////////////////
822
823
824
825 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
826 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
827 {
828   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
829   
830   pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
831   
832   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
833   
834   std::ostringstream os;
835   os << iDefaultXSize;
836   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
837   std::ostringstream osYSize;
838   osYSize << iDefaultYSize;
839   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
840   std::ostringstream osFilterParam;
841   osFilterParam << dDefaultFilterParam;
842   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
843   std::ostringstream osBandwidth;
844   osBandwidth << dDefaultBandwidth;
845   m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
846   std::ostringstream osInputScale;
847   osInputScale << dDefaultInputScale;
848   m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
849   std::ostringstream osOutputScale;
850   osOutputScale << dDefaultOutputScale;
851   m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
852   
853   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
854   pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
855   m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
856   m_pListBoxFilter->SetSelection (iDefaultFilterID);
857   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
858   
859   m_pListBoxDomain = new StringValueAndTitleListBox (this, SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
860   m_pListBoxDomain->SetSelection (iDefaultDomainID);
861   pGridSizer->Add (new wxStaticText (this, -1, "Domain"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
862   pGridSizer->Add (m_pListBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
863   
864   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
865   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
866   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
867   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
868   pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
869   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
870   pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
871   pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
872   pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
873   pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
874   pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
875   pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
876   
877   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
878   
879   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
880   
881   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
882   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
883   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
884   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
885   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
886   
887   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
888   
889   SetAutoLayout (true);
890   SetSizer (pTopSizer);
891   pTopSizer->Layout();
892   pTopSizer->Fit (this);
893   pTopSizer->SetSizeHints (this);
894 }
895
896 DialogGetFilterParameters::~DialogGetFilterParameters ()
897 {
898 }
899
900
901 unsigned int
902 DialogGetFilterParameters::getXSize ()
903 {
904   wxString strCtrl = m_pTextCtrlXSize->GetValue();
905   unsigned long lValue;
906   if (strCtrl.ToULong (&lValue))
907     return lValue;
908   else
909     return (m_iDefaultXSize);
910 }
911
912 unsigned int
913 DialogGetFilterParameters::getYSize ()
914 {
915   wxString strCtrl = m_pTextCtrlYSize->GetValue();
916   unsigned long lValue;
917   if (strCtrl.ToULong (&lValue))
918     return lValue;
919   else
920     return (m_iDefaultYSize);
921 }
922
923 double
924 DialogGetFilterParameters::getBandwidth ()
925 {
926   wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
927   double dValue;
928   if (strCtrl.ToDouble (&dValue))
929     return dValue;
930   else
931     return (m_dDefaultBandwidth);
932 }
933
934 double
935 DialogGetFilterParameters::getFilterParam ()
936 {
937   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
938   double dValue;
939   if (strCtrl.ToDouble (&dValue))
940     return (dValue);
941   else
942     return (m_dDefaultFilterParam);
943 }
944
945 double
946 DialogGetFilterParameters::getInputScale ()
947 {
948   wxString strCtrl = m_pTextCtrlInputScale->GetValue();
949   double dValue;
950   if (strCtrl.ToDouble (&dValue))
951     return dValue;
952   else
953     return (m_dDefaultInputScale);
954 }
955
956 double
957 DialogGetFilterParameters::getOutputScale ()
958 {
959   wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
960   double dValue;
961   if (strCtrl.ToDouble (&dValue))
962     return dValue;
963   else
964     return (m_dDefaultOutputScale);
965 }
966
967 const char*
968 DialogGetFilterParameters::getFilterName ()
969 {
970   return m_pListBoxFilter->getSelectionStringValue();
971 }
972
973 const char*
974 DialogGetFilterParameters::getDomainName ()
975 {
976   return m_pListBoxDomain->getSelectionStringValue();
977 }
978
979
980 ///////////////////////////////////////////////////////////////////////
981 // CLASS IMPLEMENTATION
982 //    DialogExportParameters
983 ///////////////////////////////////////////////////////////////////////
984
985 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
986 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
987 {
988   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
989   
990   pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
991   
992   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
993   
994   m_pListBoxFormat = new StringValueAndTitleListBox (this, ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
995   m_pListBoxFormat->SetSelection (iDefaultFormatID);
996   pTopSizer->Add (m_pListBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
997   
998   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
999   
1000   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1001   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1002   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1003   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1004   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1005   
1006   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1007   
1008   SetAutoLayout (true);
1009   SetSizer (pTopSizer);
1010   pTopSizer->Fit (this);
1011   pTopSizer->SetSizeHints (this);
1012 }
1013
1014 const char*
1015 DialogExportParameters::getFormatName()
1016 {
1017   return m_pListBoxFormat->getSelectionStringValue();
1018 }
1019
1020
1021 /////////////////////////////////////////////////////////////////////
1022 // CLASS DiaglogGetXYSize Implementation
1023 /////////////////////////////////////////////////////////////////////
1024
1025 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1026 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1027 {
1028   m_iDefaultXSize = iDefaultXSize;
1029   m_iDefaultYSize = iDefaultYSize;
1030
1031   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1032   
1033   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1034   
1035   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1036   
1037   std::ostringstream os;
1038   os << iDefaultXSize;
1039   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1040   std::ostringstream osYSize;
1041   osYSize << iDefaultYSize;
1042   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1043   
1044   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1045   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1046   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1047   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1048   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1049   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1050   
1051   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1052   
1053   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1054   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1055   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1056   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1057   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1058   
1059   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1060   
1061   SetAutoLayout (true);
1062   SetSizer (pTopSizer);
1063   pTopSizer->Fit (this);
1064   pTopSizer->SetSizeHints (this);
1065 }
1066
1067 DialogGetXYSize::~DialogGetXYSize ()
1068 {
1069 }
1070
1071 unsigned int
1072 DialogGetXYSize::getXSize ()
1073 {
1074   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1075   long lValue;
1076   if (strCtrl.ToLong (&lValue))
1077     return lValue;
1078   else
1079     return (m_iDefaultXSize);
1080 }
1081
1082 unsigned int
1083 DialogGetXYSize::getYSize ()
1084 {
1085   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1086   long lValue;
1087   if (strCtrl.ToLong (&lValue))
1088     return lValue;
1089   else
1090     return (m_iDefaultYSize);
1091 }
1092
1093
1094
1095 /////////////////////////////////////////////////////////////////////
1096 // CLASS IDENTIFICATION
1097 //
1098 // DialogGetConvertPolarParameters
1099 /////////////////////////////////////////////////////////////////////
1100
1101 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, 
1102        int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1103 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1104 {
1105   m_iDefaultXSize = iDefaultXSize;
1106   m_iDefaultYSize = iDefaultYSize;
1107   m_iDefaultZeropad = iDefaultZeropad;
1108
1109   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1110   
1111   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1112   
1113   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1114   
1115   std::ostringstream os;
1116   os << iDefaultXSize;
1117   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1118   std::ostringstream osYSize;
1119   osYSize << iDefaultYSize;
1120   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1121   
1122   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1123   
1124   m_pListBoxInterpolation = new StringValueAndTitleListBox (this, Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1125   m_pListBoxInterpolation->SetSelection (iDefaultInterpolationID);
1126   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1127   pGridSizer->Add (m_pListBoxInterpolation, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1128   
1129   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1130   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1131   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1132   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1133   if (iDefaultZeropad >= 0) {
1134     std::ostringstream osZeropad;
1135     osZeropad << iDefaultZeropad;
1136     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1137     pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1138     pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1139   }
1140   
1141   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1142   
1143   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1144   
1145   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1146   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1147   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1148   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1149   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1150   
1151   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1152   
1153   SetAutoLayout (true);
1154   SetSizer (pTopSizer);
1155   pTopSizer->Layout();
1156   pTopSizer->Fit (this);
1157   pTopSizer->SetSizeHints (this);
1158 }
1159
1160
1161 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1162 {
1163 }
1164
1165
1166 unsigned int
1167 DialogGetConvertPolarParameters::getXSize ()
1168 {
1169   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1170   unsigned long lValue;
1171   if (strCtrl.ToULong (&lValue))
1172     return lValue;
1173   else
1174     return (m_iDefaultXSize);
1175 }
1176
1177 unsigned int
1178 DialogGetConvertPolarParameters::getYSize ()
1179 {
1180   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1181   unsigned long lValue;
1182   if (strCtrl.ToULong (&lValue))
1183     return lValue;
1184   else
1185     return (m_iDefaultYSize);
1186 }
1187
1188 unsigned int
1189 DialogGetConvertPolarParameters::getZeropad ()
1190 {
1191   wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1192   unsigned long lValue;
1193   if (strCtrl.ToULong (&lValue))
1194     return lValue;
1195   else
1196     return (m_iDefaultZeropad);
1197 }
1198
1199 const char*
1200 DialogGetConvertPolarParameters::getInterpolationName ()
1201 {
1202   return m_pListBoxInterpolation->getSelectionStringValue();
1203 }
1204