1 /*****************************************************************************
5 ** Purpose: Dialog routines for CTSim program
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 2000
9 ** This is part of the CTSim program
10 ** Copyright (c) 1983-2001 Kevin Rosenberg
12 ** $Id: dialogs.cpp,v 1.31 2001/02/14 16:37:14 kevin Exp $
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.
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.
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 ******************************************************************************/
29 // #pragma implementation
32 // For compilers that support precompilation, includes "wx/wx.h".
33 #include "wx/wxprec.h"
43 #if !wxUSE_DOC_VIEW_ARCHITECTURE
44 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
47 #include "wx/statline.h"
52 //#include "ctsupport.h"
53 //#include "scanner.h"
54 //#include "phantom.h"
56 //#include "backprojectors.h"
59 #include "imagefile.h"
61 #if defined(MSVC) || HAVE_SSTREAM
64 #include <sstream_subst>
68 ///////////////////////////////////////////////////////////////////////
69 // CLASS IMPLEMENTATION
70 // StringValueAndTitleListBox
71 ///////////////////////////////////////////////////////////////////////
73 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
76 wxString* psTitle = new wxString [nChoices];
77 for (int i = 0; i < nChoices; i++)
78 psTitle[i] = aszTitle[i];
80 Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
82 m_ppszValues = aszValue;
87 StringValueAndTitleListBox::getSelectionStringValue () const
89 return m_ppszValues[GetSelection()];
93 ///////////////////////////////////////////////////////////////////////
94 // CLASS IMPLEMENTATION
96 ///////////////////////////////////////////////////////////////////////
98 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
99 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
101 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
103 pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxALL, 5);
105 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
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);
111 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
119 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
121 SetAutoLayout (true);
122 SetSizer (pTopSizer);
123 pTopSizer->Fit (this);
124 pTopSizer->SetSizeHints (this);
128 DialogGetPhantom::getPhantom()
130 return m_pListBoxPhantom->getSelectionStringValue();
134 ///////////////////////////////////////////////////////////////////////
135 // CLASS IMPLEMENTATION
136 // DialogGetComparisonImage
137 ///////////////////////////////////////////////////////////////////////
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)
142 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
144 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
146 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
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());
153 pstrImages[i] = pView->getFrame()->GetTitle();
156 m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
157 delete [] pstrImages;
159 m_pListBoxImageChoices->SetSelection (0);
160 pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
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);
167 m_pMakeDifferenceImage = NULL;
169 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
177 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
179 SetAutoLayout (true);
180 SetSizer (pTopSizer);
181 pTopSizer->Fit (this);
182 pTopSizer->SetSizeHints (this);
186 DialogGetComparisonImage::getImageFileDocument()
188 return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
192 DialogGetComparisonImage::getMakeDifferenceImage()
194 if (m_pMakeDifferenceImage)
195 return m_pMakeDifferenceImage->GetValue();
201 /////////////////////////////////////////////////////////////////////
202 // CLASS DiaglogPreferences Implementation
203 /////////////////////////////////////////////////////////////////////
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)
209 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
211 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
213 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
215 m_pCBAdvancedOptions = new wxCheckBox (this, -1, "Advanced Options", wxDefaultPosition, wxSize(100, 25), 0);
216 m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
218 m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "Ask Save New Documents Before Closing", wxDefaultPosition, wxSize(100, 25), 0);
219 m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
221 pTopSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
222 pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
224 m_pCBAdvancedOptions = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
225 m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
227 m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
228 m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
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);
238 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
246 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
248 SetAutoLayout (true);
249 SetSizer (pTopSizer);
250 pTopSizer->Fit (this);
251 pTopSizer->SetSizeHints (this);
254 DialogPreferences::~DialogPreferences ()
259 DialogPreferences::getAdvancedOptions ()
261 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
265 DialogPreferences::getAskDeleteNewDocs ()
267 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
271 /////////////////////////////////////////////////////////////////////
272 // CLASS DiaglogGetMinMax Implementation
273 /////////////////////////////////////////////////////////////////////
275 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
276 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
278 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
280 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
282 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
284 std::ostringstream os;
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);
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);
298 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
306 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
308 SetAutoLayout (true);
309 SetSizer (pTopSizer);
310 pTopSizer->Fit (this);
311 pTopSizer->SetSizeHints (this);
314 DialogGetMinMax::~DialogGetMinMax ()
319 DialogGetMinMax::getMinimum ()
321 wxString strCtrl = m_pTextCtrlMin->GetValue();
323 if (strCtrl.ToDouble (&dValue))
326 return (m_dDefaultMin);
330 DialogGetMinMax::getMaximum ()
332 wxString strCtrl = m_pTextCtrlMax->GetValue();
334 if (strCtrl.ToDouble (&dValue))
337 return (m_dDefaultMax);
341 /////////////////////////////////////////////////////////////////////
342 // CLASS DialogAutoScaleParameters IMPLEMENTATION
343 /////////////////////////////////////////////////////////////////////
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)
348 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
350 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
352 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
355 asTitle[0] = "Median";
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);
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);
371 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
379 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
381 SetAutoLayout (true);
382 SetSizer (pTopSizer);
383 pTopSizer->Fit (this);
384 pTopSizer->SetSizeHints (this);
388 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
390 int iCenter = m_pListBoxCenter->GetSelection();
391 double dCenter = m_dMedian;
394 else if (iCenter == 2)
397 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
399 if (! sStddevFactor.ToDouble (&dValue)) {
400 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
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";
412 DialogAutoScaleParameters::getAutoScaleFactor ()
414 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
416 if (! sStddevFactor.ToDouble (&dValue)) {
417 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
424 /////////////////////////////////////////////////////////////////////
425 // CLASS IDENTIFICATION
427 // DialogGetRasterParameters
428 /////////////////////////////////////////////////////////////////////
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)
434 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
436 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
438 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
440 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
441 std::ostringstream os;
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);
462 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
464 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
472 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
474 SetAutoLayout (true);
475 SetSizer (pTopSizer);
476 pTopSizer->Fit (this);
477 pTopSizer->SetSizeHints (this);
480 DialogGetRasterParameters::~DialogGetRasterParameters ()
486 DialogGetRasterParameters::getXSize ()
488 wxString strCtrl = m_pTextCtrlXSize->GetValue();
489 unsigned long lValue;
490 if (strCtrl.ToULong (&lValue))
493 return (m_iDefaultXSize);
497 DialogGetRasterParameters::getYSize ()
499 wxString strCtrl = m_pTextCtrlYSize->GetValue();
500 unsigned long lValue;
501 if (strCtrl.ToULong (&lValue))
504 return (m_iDefaultYSize);
508 DialogGetRasterParameters::getNSamples ()
510 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
511 unsigned long lValue;
512 if (strCtrl.ToULong (&lValue))
515 return (m_iDefaultNSamples);
519 DialogGetRasterParameters::getViewRatio ()
521 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
523 if (strCtrl.ToDouble (&dValue))
526 return (m_dDefaultViewRatio);
530 /////////////////////////////////////////////////////////////////////
531 // CLASS IDENTIFICATION
533 // DialogGetProjectionParameters
534 /////////////////////////////////////////////////////////////////////
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)
543 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
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;
555 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
557 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
564 pGridSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
566 std::ostringstream os;
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);
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);
604 m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
605 m_pListBoxTrace->SetSelection (iDefaultTrace);
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);
611 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
619 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
621 SetAutoLayout (true);
622 SetSizer (pTopSizer);
623 pTopSizer->Fit (this);
624 pTopSizer->SetSizeHints (this);
627 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
633 DialogGetProjectionParameters::getNDet ()
635 wxString strCtrl = m_pTextCtrlNDet->GetValue();
636 unsigned long lValue;
637 if (strCtrl.ToULong (&lValue))
640 return (m_iDefaultNDet);
644 DialogGetProjectionParameters::getNView ()
646 wxString strCtrl = m_pTextCtrlNView->GetValue();
647 unsigned long lValue;
648 if (strCtrl.ToULong (&lValue))
651 return (m_iDefaultNView);
656 DialogGetProjectionParameters::getNSamples ()
658 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
659 unsigned long lValue;
660 if (strCtrl.ToULong (&lValue))
663 return (m_iDefaultNSamples);
667 DialogGetProjectionParameters::getRotAngle ()
669 if (theApp->getAdvancedOptions()) {
670 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
672 if (strCtrl.ToDouble (&dValue))
673 return (dValue * PI);
675 return (m_dDefaultRotAngle);
677 if (Scanner::convertGeometryNameToID (m_pListBoxGeometry->getSelectionStringValue()) ==
678 Scanner::GEOMETRY_PARALLEL)
686 DialogGetProjectionParameters::getFocalLengthRatio ()
688 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
690 if (strCtrl.ToDouble (&dValue))
693 return (m_dDefaultFocalLength);
697 DialogGetProjectionParameters::getViewRatio ()
699 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
701 if (strCtrl.ToDouble (&dValue))
704 return (m_dDefaultViewRatio);
708 DialogGetProjectionParameters::getScanRatio ()
710 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
712 if (strCtrl.ToDouble (&dValue))
715 return (m_dDefaultScanRatio);
719 DialogGetProjectionParameters::getGeometry ()
721 return m_pListBoxGeometry->getSelectionStringValue();
725 DialogGetProjectionParameters::getTrace ()
727 return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
732 /////////////////////////////////////////////////////////////////////
733 // CLASS IDENTIFICATION
735 // DialogGetReconstructionParameters
736 /////////////////////////////////////////////////////////////////////
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)
745 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
747 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
749 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
751 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (6);
752 pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
754 if (theApp->getAdvancedOptions())
755 m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
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);
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);
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);
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);
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);
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);
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;
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);
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);
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);
824 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
826 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
834 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
836 SetAutoLayout (true);
837 SetSizer (pTopSizer);
839 pTopSizer->Fit (this);
840 pTopSizer->SetSizeHints (this);
843 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
849 DialogGetReconstructionParameters::getXSize ()
851 wxString strCtrl = m_pTextCtrlXSize->GetValue();
852 unsigned long lValue;
853 if (strCtrl.ToULong (&lValue))
856 return (m_iDefaultXSize);
860 DialogGetReconstructionParameters::getYSize ()
862 wxString strCtrl = m_pTextCtrlYSize->GetValue();
863 unsigned long lValue;
864 if (strCtrl.ToULong (&lValue))
867 return (m_iDefaultYSize);
871 DialogGetReconstructionParameters::getZeropad ()
873 if (theApp->getAdvancedOptions()) {
874 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
875 unsigned long lValue;
876 if (strCtrl.ToULong (&lValue))
879 return (m_iDefaultZeropad);
886 DialogGetReconstructionParameters::getInterpParam ()
888 #if HAVE_FREQ_PREINTERP
889 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
890 unsigned long lValue;
891 if (strCtrl.ToULong (&lValue))
894 return (m_iDefaultInterpParam);
901 DialogGetReconstructionParameters::getFilterParam ()
903 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
905 if (strCtrl.ToDouble (&dValue))
908 return (m_dDefaultFilterParam);
912 DialogGetReconstructionParameters::getFilterName ()
914 return m_pListBoxFilter->getSelectionStringValue();
918 DialogGetReconstructionParameters::getFilterMethodName ()
920 return m_pListBoxFilterMethod->getSelectionStringValue();
924 DialogGetReconstructionParameters::getInterpName ()
926 return m_pListBoxInterp->getSelectionStringValue();
930 DialogGetReconstructionParameters::getTrace ()
933 if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0)
934 iTrace = Trace::TRACE_PLOT;
939 DialogGetReconstructionParameters::getBackprojectName ()
941 if (theApp->getAdvancedOptions()) {
942 return m_pListBoxBackproject->getSelectionStringValue();
948 DialogGetReconstructionParameters::getFilterGenerationName ()
950 if (theApp->getAdvancedOptions()) {
951 return m_pListBoxFilterGeneration->getSelectionStringValue();
953 if (ProcessSignal::convertFilterMethodNameToID(m_pListBoxFilterMethod->getSelectionStringValue())
954 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
957 return "inverse-fourier";
962 /////////////////////////////////////////////////////////////////////
963 // CLASS IDENTIFICATION
965 // DialogGetFilterParameters
966 /////////////////////////////////////////////////////////////////////
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)
973 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
975 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
977 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
979 std::ostringstream os;
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);
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);
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);
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);
1022 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1024 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
1032 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1034 SetAutoLayout (true);
1035 SetSizer (pTopSizer);
1036 pTopSizer->Layout();
1037 pTopSizer->Fit (this);
1038 pTopSizer->SetSizeHints (this);
1041 DialogGetFilterParameters::~DialogGetFilterParameters ()
1047 DialogGetFilterParameters::getXSize ()
1049 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1050 unsigned long lValue;
1051 if (strCtrl.ToULong (&lValue))
1054 return (m_iDefaultXSize);
1058 DialogGetFilterParameters::getYSize ()
1060 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1061 unsigned long lValue;
1062 if (strCtrl.ToULong (&lValue))
1065 return (m_iDefaultYSize);
1069 DialogGetFilterParameters::getBandwidth ()
1071 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1073 if (strCtrl.ToDouble (&dValue))
1076 return (m_dDefaultBandwidth);
1080 DialogGetFilterParameters::getFilterParam ()
1082 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1084 if (strCtrl.ToDouble (&dValue))
1087 return (m_dDefaultFilterParam);
1091 DialogGetFilterParameters::getInputScale ()
1093 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1095 if (strCtrl.ToDouble (&dValue))
1098 return (m_dDefaultInputScale);
1102 DialogGetFilterParameters::getOutputScale ()
1104 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1106 if (strCtrl.ToDouble (&dValue))
1109 return (m_dDefaultOutputScale);
1113 DialogGetFilterParameters::getFilterName ()
1115 return m_pListBoxFilter->getSelectionStringValue();
1119 DialogGetFilterParameters::getDomainName ()
1121 return m_pListBoxDomain->getSelectionStringValue();
1125 ///////////////////////////////////////////////////////////////////////
1126 // CLASS IMPLEMENTATION
1127 // DialogExportParameters
1128 ///////////////////////////////////////////////////////////////////////
1130 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1131 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1133 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1135 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1137 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
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);
1143 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
1151 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1153 SetAutoLayout (true);
1154 SetSizer (pTopSizer);
1155 pTopSizer->Fit (this);
1156 pTopSizer->SetSizeHints (this);
1160 DialogExportParameters::getFormatName()
1162 return m_pListBoxFormat->getSelectionStringValue();
1166 /////////////////////////////////////////////////////////////////////
1167 // CLASS DiaglogGetXYSize Implementation
1168 /////////////////////////////////////////////////////////////////////
1170 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1171 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1173 m_iDefaultXSize = iDefaultXSize;
1174 m_iDefaultYSize = iDefaultYSize;
1176 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1178 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1180 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
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);
1196 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
1204 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1206 SetAutoLayout (true);
1207 SetSizer (pTopSizer);
1208 pTopSizer->Fit (this);
1209 pTopSizer->SetSizeHints (this);
1212 DialogGetXYSize::~DialogGetXYSize ()
1217 DialogGetXYSize::getXSize ()
1219 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1221 if (strCtrl.ToLong (&lValue))
1224 return (m_iDefaultXSize);
1228 DialogGetXYSize::getYSize ()
1230 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1232 if (strCtrl.ToLong (&lValue))
1235 return (m_iDefaultYSize);
1240 /////////////////////////////////////////////////////////////////////
1241 // CLASS IDENTIFICATION
1243 // DialogGetConvertPolarParameters
1244 /////////////////////////////////////////////////////////////////////
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)
1250 m_iDefaultXSize = iDefaultXSize;
1251 m_iDefaultYSize = iDefaultYSize;
1252 m_iDefaultZeropad = iDefaultZeropad;
1254 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1256 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1258 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
1267 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
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);
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);
1286 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1288 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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);
1296 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1298 SetAutoLayout (true);
1299 SetSizer (pTopSizer);
1300 pTopSizer->Layout();
1301 pTopSizer->Fit (this);
1302 pTopSizer->SetSizeHints (this);
1306 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1312 DialogGetConvertPolarParameters::getXSize ()
1314 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1315 unsigned long lValue;
1316 if (strCtrl.ToULong (&lValue))
1319 return (m_iDefaultXSize);
1323 DialogGetConvertPolarParameters::getYSize ()
1325 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1326 unsigned long lValue;
1327 if (strCtrl.ToULong (&lValue))
1330 return (m_iDefaultYSize);
1334 DialogGetConvertPolarParameters::getZeropad ()
1336 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1337 unsigned long lValue;
1338 if (strCtrl.ToULong (&lValue))
1341 return (m_iDefaultZeropad);
1345 DialogGetConvertPolarParameters::getInterpolationName ()
1347 return m_pListBoxInterpolation->getSelectionStringValue();