r539: no message
[ctsim.git] / src / dialogs.cpp
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          dialogs.cpp
5 **   Purpose:       Dialog routines for CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (c) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id: dialogs.cpp,v 1.31 2001/02/14 16:37:14 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 DiaglogPreferences Implementation
203 /////////////////////////////////////////////////////////////////////
204
205 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle, 
206                                       bool bAdvancedOptions, bool bAskDeleteNewDocs)
207 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
208 {
209   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
210   
211   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
212   
213   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
214 #if 1
215   m_pCBAdvancedOptions = new wxCheckBox (this, -1, "Advanced Options", wxDefaultPosition, wxSize(100, 25), 0);
216   m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
217
218   m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "Ask Save New Documents Before Closing", wxDefaultPosition, wxSize(100, 25), 0);
219   m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
220
221   pTopSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
222   pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
223 #else  
224   m_pCBAdvancedOptions = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
225   m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
226
227   m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
228   m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
229
230   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
231   pGridSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
232   pGridSizer->Add (new wxStaticText (this, -1, "Show Advanced Options"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
233   pGridSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
234   pGridSizer->Add (new wxStaticText (this, -1, "Ask Save New Documents Before Closing"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
235   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
236   
237 #endif
238   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
239   
240   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
241   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
242   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
243   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
244   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
245   
246   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
247   
248   SetAutoLayout (true);
249   SetSizer (pTopSizer);
250   pTopSizer->Fit (this);
251   pTopSizer->SetSizeHints (this);
252 }
253
254 DialogPreferences::~DialogPreferences ()
255 {
256 }
257
258 bool
259 DialogPreferences::getAdvancedOptions ()
260 {
261   return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
262 }
263
264 bool
265 DialogPreferences::getAskDeleteNewDocs ()
266 {
267   return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
268 }
269
270
271 /////////////////////////////////////////////////////////////////////
272 // CLASS DiaglogGetMinMax Implementation
273 /////////////////////////////////////////////////////////////////////
274
275 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
276 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
277 {
278   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
279   
280   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 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   std::ostringstream os;
285   os << dDefaultMin;
286   m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
287   std::ostringstream osMax;
288   osMax << dDefaultMax;
289   m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
290   
291   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
292   pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
293   pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
294   pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
295   pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
296   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
297   
298   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
299   
300   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
301   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
302   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
303   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
304   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
305   
306   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
307   
308   SetAutoLayout (true);
309   SetSizer (pTopSizer);
310   pTopSizer->Fit (this);
311   pTopSizer->SetSizeHints (this);
312 }
313
314 DialogGetMinMax::~DialogGetMinMax ()
315 {
316 }
317
318 double
319 DialogGetMinMax::getMinimum ()
320 {
321   wxString strCtrl = m_pTextCtrlMin->GetValue();
322   double dValue;
323   if (strCtrl.ToDouble (&dValue))
324     return dValue;
325   else
326     return (m_dDefaultMin);
327 }
328
329 double
330 DialogGetMinMax::getMaximum ()
331 {
332   wxString strCtrl = m_pTextCtrlMax->GetValue();
333   double dValue;
334   if (strCtrl.ToDouble (&dValue))
335     return dValue;
336   else
337     return (m_dDefaultMax);
338 }
339
340
341 /////////////////////////////////////////////////////////////////////
342 // CLASS DialogAutoScaleParameters IMPLEMENTATION
343 /////////////////////////////////////////////////////////////////////
344
345 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
346 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
347 {
348   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
349   
350   pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
351   
352   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
353   
354   wxString asTitle[3];
355   asTitle[0] = "Median";
356   asTitle[1] = "Mode";
357   asTitle[2] = "Mean";
358   
359   m_pListBoxCenter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 3, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
360   m_pListBoxCenter->SetSelection (0);
361   pTopSizer->Add (m_pListBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
362   
363   wxGridSizer *pGridSizer = new wxGridSizer (2);
364   pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
365   std::ostringstream osDefaultFactor;
366   osDefaultFactor << dDefaultScaleFactor;
367   m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
368   pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
369   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
370   
371   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
372   
373   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
374   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
375   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
376   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
377   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
378   
379   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
380   
381   SetAutoLayout (true);
382   SetSizer (pTopSizer);
383   pTopSizer->Fit (this);
384   pTopSizer->SetSizeHints (this);
385 }
386
387 bool
388 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
389 {
390   int iCenter = m_pListBoxCenter->GetSelection();
391   double dCenter = m_dMedian;
392   if (iCenter == 1)
393     dCenter = m_dMode;
394   else if (iCenter == 2)
395     dCenter = m_dMode;
396   
397   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
398   double dValue;
399   if (! sStddevFactor.ToDouble (&dValue)) {
400     *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
401     return false;
402   }
403   double dHalfWidth = dValue * m_dStdDev / 2;
404   *pMin = dCenter - dHalfWidth;
405   *pMax = dCenter + dHalfWidth;
406   *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
407   
408   return true;
409 }
410
411 double
412 DialogAutoScaleParameters::getAutoScaleFactor ()
413 {
414   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
415   double dValue = 1.;
416   if (! sStddevFactor.ToDouble (&dValue)) {
417     *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
418   }
419   
420   return dValue;
421 }
422
423
424 /////////////////////////////////////////////////////////////////////
425 // CLASS IDENTIFICATION
426 //
427 // DialogGetRasterParameters
428 /////////////////////////////////////////////////////////////////////
429
430 DialogGetRasterParameters::DialogGetRasterParameters 
431    (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
432 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
433 {
434   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
435   
436   pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
437   
438   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
439     
440   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
441   std::ostringstream os;
442   os << iDefaultXSize;
443   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
444   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
445   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
446   std::ostringstream osYSize;
447   osYSize << iDefaultYSize;
448   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
449   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
450   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
451   std::ostringstream osViewRatio;
452   osViewRatio << dDefaultViewRatio;
453   m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
454   pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
455   pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
456   std::ostringstream osNSamples;
457   osNSamples << iDefaultNSamples;
458   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
459   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
460   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
461
462   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
463   
464   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
465   
466   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
467   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
468   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
469   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
470   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
471   
472   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
473   
474   SetAutoLayout (true);
475   SetSizer (pTopSizer);
476   pTopSizer->Fit (this);
477   pTopSizer->SetSizeHints (this);
478 }
479
480 DialogGetRasterParameters::~DialogGetRasterParameters ()
481 {
482 }
483
484
485 unsigned int
486 DialogGetRasterParameters::getXSize ()
487 {
488   wxString strCtrl = m_pTextCtrlXSize->GetValue();
489   unsigned long lValue;
490   if (strCtrl.ToULong (&lValue))
491     return lValue;
492   else
493     return (m_iDefaultXSize);
494 }
495
496 unsigned int
497 DialogGetRasterParameters::getYSize ()
498 {
499   wxString strCtrl = m_pTextCtrlYSize->GetValue();
500   unsigned long lValue;
501   if (strCtrl.ToULong (&lValue))
502     return lValue;
503   else
504     return (m_iDefaultYSize);
505 }
506
507 unsigned int
508 DialogGetRasterParameters::getNSamples ()
509 {
510   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
511   unsigned long lValue;
512   if (strCtrl.ToULong (&lValue))
513     return lValue;
514   else
515     return (m_iDefaultNSamples);
516 }
517
518 double
519 DialogGetRasterParameters::getViewRatio ()
520 {
521   wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
522   double dValue;
523   if (strCtrl.ToDouble (&dValue))
524     return dValue;
525   else
526     return (m_dDefaultViewRatio);
527 }
528
529
530 /////////////////////////////////////////////////////////////////////
531 // CLASS IDENTIFICATION
532 //
533 // DialogGetProjectionParameters
534 /////////////////////////////////////////////////////////////////////
535
536
537 DialogGetProjectionParameters::DialogGetProjectionParameters 
538    (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, 
539     double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
540     double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
541 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
542 {
543   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
544   
545   m_dDefaultRotAngle = dDefaultRotAngle;
546   m_dDefaultFocalLength = dDefaultFocalLength;
547   m_dDefaultViewRatio = dDefaultViewRatio;
548   m_dDefaultScanRatio = dDefaultScanRatio;
549   m_iDefaultNSamples = iDefaultNSamples;
550   m_iDefaultNView = iDefaultNView;
551   m_iDefaultNDet = iDefaultNDet;
552   m_iDefaultTrace = iDefaultTrace;
553   m_iDefaultGeometry = iDefaultGeometry;
554   
555   pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
556   
557   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
558     
559   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
560   pGridSizer->Add (new wxStaticText (this, -1, "Scanner Geometry"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
561   m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
562   m_pListBoxGeometry->SetSelection (iDefaultGeometry);
563   
564   pGridSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
565   
566   std::ostringstream os;
567   os << iDefaultNDet;
568   m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
569   pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
570   pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
571   std::ostringstream osNView;
572   osNView << iDefaultNView;
573   m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
574   pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
575   pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
576   std::ostringstream osNSamples;
577   osNSamples << iDefaultNSamples;
578   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
579   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
580   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
581   if (theApp->getAdvancedOptions()) {
582     std::ostringstream osRotAngle;
583     osRotAngle << dDefaultRotAngle;
584     m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
585     pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
586     pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
587   }
588   std::ostringstream osFocalLength;
589   osFocalLength << dDefaultFocalLength;
590   m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
591   pGridSizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
592   pGridSizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
593   std::ostringstream osViewRatio;
594   osViewRatio << dDefaultViewRatio;
595   m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
596   pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
597   pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
598   std::ostringstream osScanRatio;
599   osScanRatio << dDefaultScanRatio;
600   m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
601   pGridSizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
602   pGridSizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
603   
604   m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
605   m_pListBoxTrace->SetSelection (iDefaultTrace);
606   
607   pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
608   pGridSizer->Add (m_pListBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
609   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
610   
611   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
612   
613   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
614   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
615   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
616   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
617   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
618   
619   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
620   
621   SetAutoLayout (true);
622   SetSizer (pTopSizer);
623   pTopSizer->Fit (this);
624   pTopSizer->SetSizeHints (this);
625 }
626
627 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
628 {
629 }
630
631
632 unsigned int
633 DialogGetProjectionParameters::getNDet ()
634 {
635   wxString strCtrl = m_pTextCtrlNDet->GetValue();
636   unsigned long lValue;
637   if (strCtrl.ToULong (&lValue))
638     return lValue;
639   else
640     return (m_iDefaultNDet);
641 }
642
643 unsigned int
644 DialogGetProjectionParameters::getNView ()
645 {
646   wxString strCtrl = m_pTextCtrlNView->GetValue();
647   unsigned long lValue;
648   if (strCtrl.ToULong (&lValue))
649     return lValue;
650   else
651     return (m_iDefaultNView);
652 }
653
654
655 unsigned int
656 DialogGetProjectionParameters::getNSamples ()
657 {
658   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
659   unsigned long lValue;
660   if (strCtrl.ToULong (&lValue))
661     return lValue;
662   else
663     return (m_iDefaultNSamples);
664 }
665
666 double
667 DialogGetProjectionParameters::getRotAngle ()
668 {
669   if (theApp->getAdvancedOptions()) {
670     wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
671     double dValue;
672     if (strCtrl.ToDouble (&dValue))
673       return (dValue * PI);
674     else
675       return (m_dDefaultRotAngle);
676   } else {
677     if (Scanner::convertGeometryNameToID (m_pListBoxGeometry->getSelectionStringValue()) == 
678           Scanner::GEOMETRY_PARALLEL)
679       return (PI);
680     else
681       return (2 * PI);
682   }
683 }
684
685 double
686 DialogGetProjectionParameters::getFocalLengthRatio ()
687 {
688   wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
689   double dValue;
690   if (strCtrl.ToDouble (&dValue))
691     return (dValue);
692   else
693     return (m_dDefaultFocalLength);
694 }
695
696 double
697 DialogGetProjectionParameters::getViewRatio ()
698 {
699   wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
700   double dValue;
701   if (strCtrl.ToDouble (&dValue))
702     return (dValue);
703   else
704     return (m_dDefaultViewRatio);
705 }
706
707 double
708 DialogGetProjectionParameters::getScanRatio ()
709 {
710   wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
711   double dValue;
712   if (strCtrl.ToDouble (&dValue))
713     return (dValue);
714   else
715     return (m_dDefaultScanRatio);
716 }
717
718 const char*
719 DialogGetProjectionParameters::getGeometry ()
720 {
721   return m_pListBoxGeometry->getSelectionStringValue();
722 }
723
724 int
725 DialogGetProjectionParameters::getTrace ()
726 {
727   return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
728 }
729
730
731
732 /////////////////////////////////////////////////////////////////////
733 // CLASS IDENTIFICATION
734 //
735 // DialogGetReconstructionParameters
736 /////////////////////////////////////////////////////////////////////
737
738
739 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize, 
740                      int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  
741                      int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, 
742                      int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
743 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
744 {
745   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
746   
747   pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
748   
749   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
750   
751   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (6);
752   pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
753
754   if (theApp->getAdvancedOptions())
755     m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
756   else
757     m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
758   m_pListBoxFilter->SetSelection (iDefaultFilterID);
759   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
760   
761   m_pListBoxFilterMethod = new StringValueAndTitleListBox (this, ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
762   m_pListBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
763   pGridSizer->Add (new wxStaticText (this, -1, "Filter Method"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
764   pGridSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
765   
766   if (theApp->getAdvancedOptions()) {
767     m_pListBoxFilterGeneration = new StringValueAndTitleListBox (this, ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
768     m_pListBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
769     pGridSizer->Add (new wxStaticText (this, -1, "Filter Generation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
770     pGridSizer->Add (m_pListBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
771   
772     m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
773     m_pListBoxBackproject->SetSelection (iDefaultBackprojectID);
774     pGridSizer->Add (new wxStaticText (this, -1, "Backprojection"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
775     pGridSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
776   }
777
778   m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
779   m_pListBoxInterp->SetSelection (iDefaultInterpID);
780   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
781   pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
782   
783   
784   pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
785   static const char* aszTraceTitle[] = {"None", "Full"};
786   static const char* aszTraceName[] = {"none", "full"};
787   m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);
788   iTrace = clamp(iTrace, 0, 1);
789   m_pListBoxTrace->SetSelection (iTrace);
790   pGridSizer->Add (m_pListBoxTrace);
791   
792   std::ostringstream osHammingParam;
793   osHammingParam << dDefaultFilterParam;
794   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
795   pGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
796   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
797   std::ostringstream os;
798   os << iDefaultXSize;
799   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
800   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
801   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
802   std::ostringstream osYSize;
803   osYSize << iDefaultYSize;
804   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
805   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
806   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
807
808   if (theApp->getAdvancedOptions()) {
809     std::ostringstream osZeropad;
810     osZeropad << iDefaultZeropad;
811     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
812     pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
813     pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
814   }
815
816 #if HAVE_FREQ_PREINTERP
817   std::ostringstream osInterpParam;
818   osInterpParam << iDefaultInterpParam;
819   m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
820   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
821   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
822 #endif  
823   
824   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
825   
826   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
827   
828   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
829   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
830   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
831   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
832   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
833   
834   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
835   
836   SetAutoLayout (true);
837   SetSizer (pTopSizer);
838   pTopSizer->Layout();
839   pTopSizer->Fit (this);
840   pTopSizer->SetSizeHints (this);
841 }
842
843 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
844 {
845 }
846
847
848 unsigned int
849 DialogGetReconstructionParameters::getXSize ()
850 {
851   wxString strCtrl = m_pTextCtrlXSize->GetValue();
852   unsigned long lValue;
853   if (strCtrl.ToULong (&lValue))
854     return lValue;
855   else
856     return (m_iDefaultXSize);
857 }
858
859 unsigned int
860 DialogGetReconstructionParameters::getYSize ()
861 {
862   wxString strCtrl = m_pTextCtrlYSize->GetValue();
863   unsigned long lValue;
864   if (strCtrl.ToULong (&lValue))
865     return lValue;
866   else
867     return (m_iDefaultYSize);
868 }
869
870 unsigned int
871 DialogGetReconstructionParameters::getZeropad ()
872 {
873   if (theApp->getAdvancedOptions()) {
874     wxString strCtrl = m_pTextCtrlZeropad->GetValue();
875     unsigned long lValue;
876     if (strCtrl.ToULong (&lValue))
877       return lValue;
878     else
879       return (m_iDefaultZeropad);
880   } else
881     return 1;
882 }
883
884
885 unsigned int
886 DialogGetReconstructionParameters::getInterpParam ()
887 {
888 #if HAVE_FREQ_PREINTERP
889   wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
890   unsigned long lValue;
891   if (strCtrl.ToULong (&lValue))
892     return lValue;
893   else
894     return (m_iDefaultInterpParam);
895 #else
896   return 1;
897 #endif
898 }
899
900 double
901 DialogGetReconstructionParameters::getFilterParam ()
902 {
903   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
904   double dValue;
905   if (strCtrl.ToDouble (&dValue))
906     return (dValue);
907   else
908     return (m_dDefaultFilterParam);
909 }
910
911 const char*
912 DialogGetReconstructionParameters::getFilterName ()
913 {
914   return m_pListBoxFilter->getSelectionStringValue();
915 }
916
917 const char*
918 DialogGetReconstructionParameters::getFilterMethodName ()
919 {
920   return m_pListBoxFilterMethod->getSelectionStringValue();
921 }
922
923 const char*
924 DialogGetReconstructionParameters::getInterpName ()
925 {
926   return m_pListBoxInterp->getSelectionStringValue();
927 }
928
929 int
930 DialogGetReconstructionParameters::getTrace ()
931 {
932   int iTrace = 0;
933   if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0)
934     iTrace = Trace::TRACE_PLOT;
935   return iTrace;
936 }
937
938 const char*
939 DialogGetReconstructionParameters::getBackprojectName ()
940 {
941   if (theApp->getAdvancedOptions()) {
942     return m_pListBoxBackproject->getSelectionStringValue();
943   } else
944     return "idiff";
945 }
946
947 const char*
948 DialogGetReconstructionParameters::getFilterGenerationName ()
949 {
950   if (theApp->getAdvancedOptions()) {
951     return m_pListBoxFilterGeneration->getSelectionStringValue();
952   } else {
953     if (ProcessSignal::convertFilterMethodNameToID(m_pListBoxFilterMethod->getSelectionStringValue())
954         == ProcessSignal::FILTER_METHOD_CONVOLUTION)
955       return "direct";
956     else
957       return "inverse-fourier";
958   }
959 }
960
961
962 /////////////////////////////////////////////////////////////////////
963 // CLASS IDENTIFICATION
964 //
965 // DialogGetFilterParameters
966 /////////////////////////////////////////////////////////////////////
967
968
969
970 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
971 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
972 {
973   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
974   
975   pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
976   
977   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
978   
979   std::ostringstream os;
980   os << iDefaultXSize;
981   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
982   std::ostringstream osYSize;
983   osYSize << iDefaultYSize;
984   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
985   std::ostringstream osFilterParam;
986   osFilterParam << dDefaultFilterParam;
987   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
988   std::ostringstream osBandwidth;
989   osBandwidth << dDefaultBandwidth;
990   m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
991   std::ostringstream osInputScale;
992   osInputScale << dDefaultInputScale;
993   m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
994   std::ostringstream osOutputScale;
995   osOutputScale << dDefaultOutputScale;
996   m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
997   
998   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
999   pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1000   m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1001   m_pListBoxFilter->SetSelection (iDefaultFilterID);
1002   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1003   
1004   m_pListBoxDomain = new StringValueAndTitleListBox (this, SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1005   m_pListBoxDomain->SetSelection (iDefaultDomainID);
1006   pGridSizer->Add (new wxStaticText (this, -1, "Domain"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1007   pGridSizer->Add (m_pListBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1008   
1009   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1010   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1011   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1012   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1013   pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1014   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1015   pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1016   pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1017   pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1018   pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1019   pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1020   pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1021   
1022   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1023   
1024   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1025   
1026   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1027   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1028   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1029   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1030   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1031   
1032   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1033   
1034   SetAutoLayout (true);
1035   SetSizer (pTopSizer);
1036   pTopSizer->Layout();
1037   pTopSizer->Fit (this);
1038   pTopSizer->SetSizeHints (this);
1039 }
1040
1041 DialogGetFilterParameters::~DialogGetFilterParameters ()
1042 {
1043 }
1044
1045
1046 unsigned int
1047 DialogGetFilterParameters::getXSize ()
1048 {
1049   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1050   unsigned long lValue;
1051   if (strCtrl.ToULong (&lValue))
1052     return lValue;
1053   else
1054     return (m_iDefaultXSize);
1055 }
1056
1057 unsigned int
1058 DialogGetFilterParameters::getYSize ()
1059 {
1060   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1061   unsigned long lValue;
1062   if (strCtrl.ToULong (&lValue))
1063     return lValue;
1064   else
1065     return (m_iDefaultYSize);
1066 }
1067
1068 double
1069 DialogGetFilterParameters::getBandwidth ()
1070 {
1071   wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1072   double dValue;
1073   if (strCtrl.ToDouble (&dValue))
1074     return dValue;
1075   else
1076     return (m_dDefaultBandwidth);
1077 }
1078
1079 double
1080 DialogGetFilterParameters::getFilterParam ()
1081 {
1082   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1083   double dValue;
1084   if (strCtrl.ToDouble (&dValue))
1085     return (dValue);
1086   else
1087     return (m_dDefaultFilterParam);
1088 }
1089
1090 double
1091 DialogGetFilterParameters::getInputScale ()
1092 {
1093   wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1094   double dValue;
1095   if (strCtrl.ToDouble (&dValue))
1096     return dValue;
1097   else
1098     return (m_dDefaultInputScale);
1099 }
1100
1101 double
1102 DialogGetFilterParameters::getOutputScale ()
1103 {
1104   wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1105   double dValue;
1106   if (strCtrl.ToDouble (&dValue))
1107     return dValue;
1108   else
1109     return (m_dDefaultOutputScale);
1110 }
1111
1112 const char*
1113 DialogGetFilterParameters::getFilterName ()
1114 {
1115   return m_pListBoxFilter->getSelectionStringValue();
1116 }
1117
1118 const char*
1119 DialogGetFilterParameters::getDomainName ()
1120 {
1121   return m_pListBoxDomain->getSelectionStringValue();
1122 }
1123
1124
1125 ///////////////////////////////////////////////////////////////////////
1126 // CLASS IMPLEMENTATION
1127 //    DialogExportParameters
1128 ///////////////////////////////////////////////////////////////////////
1129
1130 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1131 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1132 {
1133   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1134   
1135   pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1136   
1137   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1138   
1139   m_pListBoxFormat = new StringValueAndTitleListBox (this, ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1140   m_pListBoxFormat->SetSelection (iDefaultFormatID);
1141   pTopSizer->Add (m_pListBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
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->Fit (this);
1156   pTopSizer->SetSizeHints (this);
1157 }
1158
1159 const char*
1160 DialogExportParameters::getFormatName()
1161 {
1162   return m_pListBoxFormat->getSelectionStringValue();
1163 }
1164
1165
1166 /////////////////////////////////////////////////////////////////////
1167 // CLASS DiaglogGetXYSize Implementation
1168 /////////////////////////////////////////////////////////////////////
1169
1170 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1171 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1172 {
1173   m_iDefaultXSize = iDefaultXSize;
1174   m_iDefaultYSize = iDefaultYSize;
1175
1176   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1177   
1178   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1179   
1180   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1181   
1182   std::ostringstream os;
1183   os << iDefaultXSize;
1184   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1185   std::ostringstream osYSize;
1186   osYSize << iDefaultYSize;
1187   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1188   
1189   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1190   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1191   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1192   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1193   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1194   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1195   
1196   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1197   
1198   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1199   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1200   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1201   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1202   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1203   
1204   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1205   
1206   SetAutoLayout (true);
1207   SetSizer (pTopSizer);
1208   pTopSizer->Fit (this);
1209   pTopSizer->SetSizeHints (this);
1210 }
1211
1212 DialogGetXYSize::~DialogGetXYSize ()
1213 {
1214 }
1215
1216 unsigned int
1217 DialogGetXYSize::getXSize ()
1218 {
1219   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1220   long lValue;
1221   if (strCtrl.ToLong (&lValue))
1222     return lValue;
1223   else
1224     return (m_iDefaultXSize);
1225 }
1226
1227 unsigned int
1228 DialogGetXYSize::getYSize ()
1229 {
1230   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1231   long lValue;
1232   if (strCtrl.ToLong (&lValue))
1233     return lValue;
1234   else
1235     return (m_iDefaultYSize);
1236 }
1237
1238
1239
1240 /////////////////////////////////////////////////////////////////////
1241 // CLASS IDENTIFICATION
1242 //
1243 // DialogGetConvertPolarParameters
1244 /////////////////////////////////////////////////////////////////////
1245
1246 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, 
1247        int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1248 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1249 {
1250   m_iDefaultXSize = iDefaultXSize;
1251   m_iDefaultYSize = iDefaultYSize;
1252   m_iDefaultZeropad = iDefaultZeropad;
1253
1254   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1255   
1256   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1257   
1258   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1259   
1260   std::ostringstream os;
1261   os << iDefaultXSize;
1262   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1263   std::ostringstream osYSize;
1264   osYSize << iDefaultYSize;
1265   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1266   
1267   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1268   
1269   m_pListBoxInterpolation = new StringValueAndTitleListBox (this, Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1270   m_pListBoxInterpolation->SetSelection (iDefaultInterpolationID);
1271   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1272   pGridSizer->Add (m_pListBoxInterpolation, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1273   
1274   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1275   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1276   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1277   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1278   if (iDefaultZeropad >= 0) {
1279     std::ostringstream osZeropad;
1280     osZeropad << iDefaultZeropad;
1281     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1282     pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1283     pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1284   }
1285   
1286   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1287   
1288   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1289   
1290   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1291   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1292   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1293   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1294   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1295   
1296   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1297   
1298   SetAutoLayout (true);
1299   SetSizer (pTopSizer);
1300   pTopSizer->Layout();
1301   pTopSizer->Fit (this);
1302   pTopSizer->SetSizeHints (this);
1303 }
1304
1305
1306 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1307 {
1308 }
1309
1310
1311 unsigned int
1312 DialogGetConvertPolarParameters::getXSize ()
1313 {
1314   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1315   unsigned long lValue;
1316   if (strCtrl.ToULong (&lValue))
1317     return lValue;
1318   else
1319     return (m_iDefaultXSize);
1320 }
1321
1322 unsigned int
1323 DialogGetConvertPolarParameters::getYSize ()
1324 {
1325   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1326   unsigned long lValue;
1327   if (strCtrl.ToULong (&lValue))
1328     return lValue;
1329   else
1330     return (m_iDefaultYSize);
1331 }
1332
1333 unsigned int
1334 DialogGetConvertPolarParameters::getZeropad ()
1335 {
1336   wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1337   unsigned long lValue;
1338   if (strCtrl.ToULong (&lValue))
1339     return lValue;
1340   else
1341     return (m_iDefaultZeropad);
1342 }
1343
1344 const char*
1345 DialogGetConvertPolarParameters::getInterpolationName ()
1346 {
1347   return m_pListBoxInterpolation->getSelectionStringValue();
1348 }
1349