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.43 2001/02/25 06:32:12 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 #include "wx/wxprec.h"
38 #if !wxUSE_DOC_VIEW_ARCHITECTURE
39 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
42 #include "wx/statline.h"
49 #include "imagefile.h"
51 #if defined(MSVC) || HAVE_SSTREAM
54 #include <sstream_subst>
58 ///////////////////////////////////////////////////////////////////////
59 // CLASS IMPLEMENTATION
60 // StringValueAndTitleListBox
61 ///////////////////////////////////////////////////////////////////////
63 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[])
66 wxString* psTitle = new wxString [nChoices];
67 for (int i = 0; i < nChoices; i++)
68 psTitle[i] = aszTitle[i];
70 Create (pParent, -1, wxDefaultPosition, wxSize(-1,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
72 m_ppszValues = aszValue;
77 StringValueAndTitleListBox::getSelectionStringValue () const
79 return m_ppszValues[GetSelection()];
82 StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[])
85 wxString* psTitle = new wxString [nChoices];
86 for (int i = 0; i < nChoices; i++)
87 psTitle[i] = aszTitle[i];
89 Create (pParent, -1, strTitle, wxDefaultPosition, wxDefaultSize, nChoices, psTitle, 1, wxRA_SPECIFY_COLS);
91 m_ppszValues = aszValue;
96 StringValueAndTitleRadioBox::getSelectionStringValue () const
98 return m_ppszValues[GetSelection()];
101 ///////////////////////////////////////////////////////////////////////
102 // CLASS IMPLEMENTATION
104 ///////////////////////////////////////////////////////////////////////
106 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
107 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
109 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
111 pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxCENTER | wxALL, 5);
113 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
115 m_pRadioBoxPhantom = new StringValueAndTitleRadioBox (this, _T("Phantom"), Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
116 m_pRadioBoxPhantom->SetSelection (iDefaultPhantom);
117 pTopSizer->Add (m_pRadioBoxPhantom, 0, wxALL | wxALIGN_CENTER);
119 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
121 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
122 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
123 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
124 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
125 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
126 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PHANTOM);
127 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
129 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
130 pButtonOk->SetDefault();
132 SetAutoLayout (true);
133 SetSizer (pTopSizer);
134 pTopSizer->Fit (this);
135 pTopSizer->SetSizeHints (this);
139 DialogGetPhantom::getPhantom()
141 return m_pRadioBoxPhantom->getSelectionStringValue();
145 ///////////////////////////////////////////////////////////////////////
146 // CLASS IMPLEMENTATION
147 // DialogGetComparisonImage
148 ///////////////////////////////////////////////////////////////////////
150 DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
151 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
153 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
155 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
157 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
159 int iNImages = m_rVecIF.size();
160 wxString* pstrImages = new wxString [iNImages];
161 for (int i = 0; i < iNImages; i++) {
162 ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
164 pstrImages[i] = pView->getFrame()->GetTitle();
167 m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
168 delete [] pstrImages;
170 m_pListBoxImageChoices->SetSelection (0);
171 pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
173 if (bShowMakeDifference) {
174 m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
175 m_pMakeDifferenceImage->SetValue (FALSE);
176 pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
178 m_pMakeDifferenceImage = NULL;
180 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
182 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
183 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
184 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
185 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
186 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
187 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_COMPARISON);
188 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
190 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
191 pButtonOk->SetDefault();
193 SetAutoLayout (true);
194 SetSizer (pTopSizer);
195 pTopSizer->Fit (this);
196 pTopSizer->SetSizeHints (this);
200 DialogGetComparisonImage::getImageFileDocument()
202 return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
206 DialogGetComparisonImage::getMakeDifferenceImage()
208 if (m_pMakeDifferenceImage)
209 return m_pMakeDifferenceImage->GetValue();
215 /////////////////////////////////////////////////////////////////////
216 // CLASS DiaglogPreferences Implementation
217 /////////////////////////////////////////////////////////////////////
219 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle,
220 bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips, bool bUseBackgroundTasks)
221 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
223 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
225 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
227 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
229 m_pCBAdvancedOptions = new wxCheckBox (this, -1, "Advanced Options", wxDefaultPosition, wxSize(250, 25), 0);
230 m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
231 pTopSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
233 m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "Ask \"Save New Documents\" Before Closing", wxDefaultPosition, wxSize(250, 25), 0);
234 m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
235 pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
237 m_pCBVerboseLogging = new wxCheckBox (this, -1, "Verbose Logging", wxDefaultPosition, wxSize(250, 25), 0);
238 m_pCBVerboseLogging->SetValue (bVerboseLogging);
239 pTopSizer->Add (m_pCBVerboseLogging, 0, wxALIGN_CENTER_VERTICAL);
241 m_pCBStartupTips = new wxCheckBox (this, -1, "Show Tips at Start", wxDefaultPosition, wxSize(250, 25), 0);
242 m_pCBStartupTips->SetValue (bStartupTips);
243 pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL);
245 m_pCBUseBackgroundTasks = new wxCheckBox (this, -1, "Put Tasks in Background", wxDefaultPosition, wxSize(250, 25), 0);
246 m_pCBUseBackgroundTasks->SetValue (bUseBackgroundTasks);
247 pTopSizer->Add (m_pCBUseBackgroundTasks, 0, wxALIGN_CENTER_VERTICAL);
249 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
251 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
252 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
253 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
254 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
255 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
256 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
257 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
259 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
260 pButtonOk->SetDefault();
262 SetAutoLayout (true);
263 SetSizer (pTopSizer);
264 pTopSizer->Fit (this);
265 pTopSizer->SetSizeHints (this);
268 DialogPreferences::~DialogPreferences ()
273 DialogPreferences::getAdvancedOptions ()
275 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
279 DialogPreferences::getAskDeleteNewDocs ()
281 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
285 DialogPreferences::getVerboseLogging ()
287 return static_cast<bool>(m_pCBVerboseLogging->GetValue());
291 DialogPreferences::getStartupTips ()
293 return static_cast<bool>(m_pCBStartupTips->GetValue());
297 DialogPreferences::getUseBackgroundTasks ()
299 return static_cast<bool>(m_pCBUseBackgroundTasks->GetValue());
303 /////////////////////////////////////////////////////////////////////
304 // CLASS DiaglogGetMinMax Implementation
305 /////////////////////////////////////////////////////////////////////
307 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
308 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
310 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
312 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
314 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
316 std::ostringstream os;
318 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
319 std::ostringstream osMax;
320 osMax << dDefaultMax;
321 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
323 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
324 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
325 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
326 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
327 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
328 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
330 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
332 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
333 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
334 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
335 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
336 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
337 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
338 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
340 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
341 pButtonOk->SetDefault();
343 SetAutoLayout (true);
344 SetSizer (pTopSizer);
345 pTopSizer->Fit (this);
346 pTopSizer->SetSizeHints (this);
349 DialogGetMinMax::~DialogGetMinMax ()
354 DialogGetMinMax::getMinimum ()
356 wxString strCtrl = m_pTextCtrlMin->GetValue();
358 if (strCtrl.ToDouble (&dValue))
361 return (m_dDefaultMin);
365 DialogGetMinMax::getMaximum ()
367 wxString strCtrl = m_pTextCtrlMax->GetValue();
369 if (strCtrl.ToDouble (&dValue))
372 return (m_dDefaultMax);
376 /////////////////////////////////////////////////////////////////////
377 // CLASS DialogAutoScaleParameters IMPLEMENTATION
378 /////////////////////////////////////////////////////////////////////
380 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
381 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
383 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
385 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
387 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
389 wxString asTitle[] = {"Median", "Mode", "Mean"};
391 m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
392 m_pRadioBoxCenter->SetSelection (0);
393 pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
395 wxGridSizer *pGridSizer = new wxGridSizer (2);
396 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
397 std::ostringstream osDefaultFactor;
398 osDefaultFactor << dDefaultScaleFactor;
399 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
400 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
401 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
403 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
405 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
406 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
407 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
408 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
409 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
410 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
411 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
413 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
414 pButtonOk->SetDefault();
416 SetAutoLayout (true);
417 SetSizer (pTopSizer);
418 pTopSizer->Fit (this);
419 pTopSizer->SetSizeHints (this);
423 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
425 int iCenter = m_pRadioBoxCenter->GetSelection();
426 double dCenter = m_dMedian;
429 else if (iCenter == 2)
432 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
434 if (! sStddevFactor.ToDouble (&dValue)) {
435 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
438 double dHalfWidth = dValue * m_dStdDev / 2;
439 *pMin = dCenter - dHalfWidth;
440 *pMax = dCenter + dHalfWidth;
441 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
447 DialogAutoScaleParameters::getAutoScaleFactor ()
449 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
451 if (! sStddevFactor.ToDouble (&dValue)) {
452 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
460 /////////////////////////////////////////////////////////////////////
461 // CLASS IDENTIFICATION
463 // DialogGetRasterParameters
464 /////////////////////////////////////////////////////////////////////
466 DialogGetRasterParameters::DialogGetRasterParameters
467 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
468 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
470 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
472 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
474 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
476 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
477 std::ostringstream os;
479 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
480 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
481 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
482 std::ostringstream osYSize;
483 osYSize << iDefaultYSize;
484 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
485 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
486 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
487 std::ostringstream osViewRatio;
488 osViewRatio << dDefaultViewRatio;
489 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
490 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
491 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
492 std::ostringstream osNSamples;
493 osNSamples << iDefaultNSamples;
494 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
495 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
496 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
498 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
500 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
502 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
503 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
504 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
505 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
506 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
507 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
508 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
510 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
511 pButtonOk->SetDefault();
513 SetAutoLayout (true);
514 SetSizer (pTopSizer);
515 pTopSizer->Fit (this);
516 pTopSizer->SetSizeHints (this);
519 DialogGetRasterParameters::~DialogGetRasterParameters ()
525 DialogGetRasterParameters::getXSize ()
527 wxString strCtrl = m_pTextCtrlXSize->GetValue();
528 unsigned long lValue;
529 if (strCtrl.ToULong (&lValue))
532 return (m_iDefaultXSize);
536 DialogGetRasterParameters::getYSize ()
538 wxString strCtrl = m_pTextCtrlYSize->GetValue();
539 unsigned long lValue;
540 if (strCtrl.ToULong (&lValue))
543 return (m_iDefaultYSize);
547 DialogGetRasterParameters::getNSamples ()
549 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
550 unsigned long lValue;
551 if (strCtrl.ToULong (&lValue))
554 return (m_iDefaultNSamples);
558 DialogGetRasterParameters::getViewRatio ()
560 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
562 if (strCtrl.ToDouble (&dValue))
565 return (m_dDefaultViewRatio);
569 /////////////////////////////////////////////////////////////////////
570 // CLASS IDENTIFICATION
572 // DialogGetProjectionParameters
573 /////////////////////////////////////////////////////////////////////
576 DialogGetProjectionParameters::DialogGetProjectionParameters
577 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
578 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
579 double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
580 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
582 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
584 m_dDefaultRotAngle = dDefaultRotAngle;
585 m_dDefaultFocalLength = dDefaultFocalLength;
586 m_dDefaultViewRatio = dDefaultViewRatio;
587 m_dDefaultScanRatio = dDefaultScanRatio;
588 m_iDefaultNSamples = iDefaultNSamples;
589 m_iDefaultNView = iDefaultNView;
590 m_iDefaultNDet = iDefaultNDet;
591 m_iDefaultTrace = iDefaultTrace;
592 m_iDefaultGeometry = iDefaultGeometry;
594 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
596 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
598 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
599 m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
600 m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
602 pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
604 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
605 m_pRadioBoxTrace->SetSelection (iDefaultTrace);
606 pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
608 wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
609 std::ostringstream os;
611 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
612 pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
613 pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
614 std::ostringstream osNView;
615 osNView << iDefaultNView;
616 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
617 pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
618 pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
619 std::ostringstream osNSamples;
620 osNSamples << iDefaultNSamples;
621 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
622 pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
623 pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
625 pGridSizer->Add (pText1Sizer);
627 wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
628 std::ostringstream osViewRatio;
629 osViewRatio << dDefaultViewRatio;
630 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
631 pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
632 pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
633 std::ostringstream osScanRatio;
634 osScanRatio << dDefaultScanRatio;
635 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
636 pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
637 pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
638 std::ostringstream osFocalLength;
639 osFocalLength << dDefaultFocalLength;
640 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
641 pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
642 pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
644 if (theApp->getAdvancedOptions()) {
645 std::ostringstream osRotAngle;
646 osRotAngle << dDefaultRotAngle;
647 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
648 pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
649 pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
651 pGridSizer->Add (pText2Sizer);
653 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
655 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
657 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
658 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
659 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
660 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
661 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
662 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
663 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
665 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
666 pButtonOk->SetDefault();
668 SetAutoLayout (true);
669 SetSizer (pTopSizer);
670 pTopSizer->Fit (this);
671 pTopSizer->SetSizeHints (this);
674 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
680 DialogGetProjectionParameters::getNDet ()
682 wxString strCtrl = m_pTextCtrlNDet->GetValue();
683 unsigned long lValue;
684 if (strCtrl.ToULong (&lValue))
687 return (m_iDefaultNDet);
691 DialogGetProjectionParameters::getNView ()
693 wxString strCtrl = m_pTextCtrlNView->GetValue();
694 unsigned long lValue;
695 if (strCtrl.ToULong (&lValue))
698 return (m_iDefaultNView);
703 DialogGetProjectionParameters::getNSamples ()
705 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
706 unsigned long lValue;
707 if (strCtrl.ToULong (&lValue))
710 return (m_iDefaultNSamples);
714 DialogGetProjectionParameters::getRotAngle ()
716 if (theApp->getAdvancedOptions()) {
717 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
719 if (strCtrl.ToDouble (&dValue))
720 return (dValue * TWOPI);
722 return (m_dDefaultRotAngle);
724 if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
725 Scanner::GEOMETRY_PARALLEL)
733 DialogGetProjectionParameters::getFocalLengthRatio ()
735 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
737 if (strCtrl.ToDouble (&dValue))
740 return (m_dDefaultFocalLength);
744 DialogGetProjectionParameters::getViewRatio ()
746 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
748 if (strCtrl.ToDouble (&dValue))
751 return (m_dDefaultViewRatio);
755 DialogGetProjectionParameters::getScanRatio ()
757 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
759 if (strCtrl.ToDouble (&dValue))
762 return (m_dDefaultScanRatio);
766 DialogGetProjectionParameters::getGeometry ()
768 return m_pRadioBoxGeometry->getSelectionStringValue();
772 DialogGetProjectionParameters::getTrace ()
774 return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
779 /////////////////////////////////////////////////////////////////////
780 // CLASS IDENTIFICATION
782 // DialogGetReconstructionParameters
783 /////////////////////////////////////////////////////////////////////
786 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
787 int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
788 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
789 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
790 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
792 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
794 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
795 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
797 wxFlexGridSizer* pGridSizer = NULL;
798 if (theApp->getAdvancedOptions())
799 pGridSizer = new wxFlexGridSizer (4);
801 pGridSizer = new wxFlexGridSizer (3);
803 if (theApp->getAdvancedOptions())
804 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
806 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
807 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
808 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
810 if (theApp->getAdvancedOptions()) {
811 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
812 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
813 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
816 static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
817 static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
819 static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
820 static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
822 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
824 m_pRadioBoxFilterMethod->SetSelection (1);
826 m_pRadioBoxFilterMethod->SetSelection (0);
828 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
831 if (theApp->getAdvancedOptions()) {
832 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
833 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
834 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
836 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
837 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
838 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
841 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
842 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
843 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
845 static const char* aszTraceTitle[] = {"None", "Full"};
846 static const char* aszTraceName[] = {"none", "full"};
847 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
848 iTrace = clamp(iTrace, 0, 1);
849 m_pRadioBoxTrace->SetSelection (iTrace);
850 pGridSizer->Add (m_pRadioBoxTrace);
852 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
853 std::ostringstream os;
855 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
856 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
857 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
858 std::ostringstream osYSize;
859 osYSize << iDefaultYSize;
860 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
861 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
862 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
864 std::ostringstream osHammingParam;
865 osHammingParam << dDefaultHammingParam;
866 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
867 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
868 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
870 if (theApp->getAdvancedOptions()) {
871 std::ostringstream osZeropad;
872 osZeropad << iDefaultZeropad;
873 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
874 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
875 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
877 pGridSizer->Add (pTextGridSizer);
879 #if HAVE_FREQ_PREINTERP
880 std::ostringstream osInterpParam;
881 osInterpParam << iDefaultInterpParam;
882 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
883 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
884 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
887 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
889 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
891 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
892 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
893 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
894 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
895 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
896 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
897 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
899 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
900 pButtonOk->SetDefault();
902 SetAutoLayout (true);
903 SetSizer (pTopSizer);
905 pTopSizer->Fit (this);
906 pTopSizer->SetSizeHints (this);
909 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
915 DialogGetReconstructionParameters::getXSize ()
917 wxString strCtrl = m_pTextCtrlXSize->GetValue();
918 unsigned long lValue;
919 if (strCtrl.ToULong (&lValue))
922 return (m_iDefaultXSize);
926 DialogGetReconstructionParameters::getYSize ()
928 wxString strCtrl = m_pTextCtrlYSize->GetValue();
929 unsigned long lValue;
930 if (strCtrl.ToULong (&lValue))
933 return (m_iDefaultYSize);
937 DialogGetReconstructionParameters::getZeropad ()
939 if (theApp->getAdvancedOptions()) {
940 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
941 unsigned long lValue;
942 if (strCtrl.ToULong (&lValue))
945 return (m_iDefaultZeropad);
952 DialogGetReconstructionParameters::getInterpParam ()
954 #if HAVE_FREQ_PREINTERP
955 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
956 unsigned long lValue;
957 if (strCtrl.ToULong (&lValue))
960 return (m_iDefaultInterpParam);
967 DialogGetReconstructionParameters::getFilterParam ()
969 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
971 if (strCtrl.ToDouble (&dValue))
974 return (m_dDefaultFilterParam);
978 DialogGetReconstructionParameters::getFilterName ()
980 return m_pRadioBoxFilter->getSelectionStringValue();
984 DialogGetReconstructionParameters::getFilterMethodName ()
986 return m_pRadioBoxFilterMethod->getSelectionStringValue();
990 DialogGetReconstructionParameters::getInterpName ()
992 return m_pRadioBoxInterp->getSelectionStringValue();
996 DialogGetReconstructionParameters::getTrace ()
999 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
1000 iTrace = Trace::TRACE_PLOT;
1005 DialogGetReconstructionParameters::getBackprojectName ()
1007 if (theApp->getAdvancedOptions()) {
1008 return m_pRadioBoxBackproject->getSelectionStringValue();
1014 DialogGetReconstructionParameters::getFilterGenerationName ()
1016 if (theApp->getAdvancedOptions()) {
1017 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
1019 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
1020 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
1023 return "inverse-fourier";
1028 /////////////////////////////////////////////////////////////////////
1029 // CLASS IDENTIFICATION
1031 // DialogGetFilterParameters
1032 /////////////////////////////////////////////////////////////////////
1036 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1037 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1039 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1041 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1042 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1044 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1046 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1047 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1048 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1050 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1051 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1052 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1054 std::ostringstream os;
1055 os << iDefaultXSize;
1056 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1057 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1058 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1060 std::ostringstream osYSize;
1061 osYSize << iDefaultYSize;
1062 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1063 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1064 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1066 std::ostringstream osFilterParam;
1067 osFilterParam << dDefaultFilterParam;
1068 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1069 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1070 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1072 std::ostringstream osBandwidth;
1073 osBandwidth << dDefaultBandwidth;
1074 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1075 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1076 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1078 std::ostringstream osInputScale;
1079 osInputScale << dDefaultInputScale;
1080 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1081 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1082 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1084 std::ostringstream osOutputScale;
1085 osOutputScale << dDefaultOutputScale;
1086 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1087 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1088 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1090 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1092 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1094 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1095 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1096 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1097 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1098 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1099 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1100 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1102 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1103 pButtonOk->SetDefault();
1105 SetAutoLayout (true);
1106 SetSizer (pTopSizer);
1107 pTopSizer->Layout();
1108 pTopSizer->Fit (this);
1109 pTopSizer->SetSizeHints (this);
1112 DialogGetFilterParameters::~DialogGetFilterParameters ()
1118 DialogGetFilterParameters::getXSize ()
1120 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1121 unsigned long lValue;
1122 if (strCtrl.ToULong (&lValue))
1125 return (m_iDefaultXSize);
1129 DialogGetFilterParameters::getYSize ()
1131 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1132 unsigned long lValue;
1133 if (strCtrl.ToULong (&lValue))
1136 return (m_iDefaultYSize);
1140 DialogGetFilterParameters::getBandwidth ()
1142 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1144 if (strCtrl.ToDouble (&dValue))
1147 return (m_dDefaultBandwidth);
1151 DialogGetFilterParameters::getFilterParam ()
1153 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1155 if (strCtrl.ToDouble (&dValue))
1158 return (m_dDefaultFilterParam);
1162 DialogGetFilterParameters::getInputScale ()
1164 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1166 if (strCtrl.ToDouble (&dValue))
1169 return (m_dDefaultInputScale);
1173 DialogGetFilterParameters::getOutputScale ()
1175 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1177 if (strCtrl.ToDouble (&dValue))
1180 return (m_dDefaultOutputScale);
1184 DialogGetFilterParameters::getFilterName ()
1186 return m_pRadioBoxFilter->getSelectionStringValue();
1190 DialogGetFilterParameters::getDomainName ()
1192 return m_pRadioBoxDomain->getSelectionStringValue();
1196 ///////////////////////////////////////////////////////////////////////
1197 // CLASS IMPLEMENTATION
1198 // DialogExportParameters
1199 ///////////////////////////////////////////////////////////////////////
1201 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1202 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1204 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1206 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1208 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1210 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1211 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1212 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1214 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1216 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1217 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1218 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1219 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1220 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1221 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1222 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1224 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1225 pButtonOk->SetDefault();
1227 SetAutoLayout (true);
1228 SetSizer (pTopSizer);
1229 pTopSizer->Fit (this);
1230 pTopSizer->SetSizeHints (this);
1234 DialogExportParameters::getFormatName()
1236 return m_pRadioBoxFormat->getSelectionStringValue();
1240 /////////////////////////////////////////////////////////////////////
1241 // CLASS DiaglogGetXYSize Implementation
1242 /////////////////////////////////////////////////////////////////////
1244 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1245 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1247 m_iDefaultXSize = iDefaultXSize;
1248 m_iDefaultYSize = iDefaultYSize;
1250 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1252 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1254 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1256 std::ostringstream os;
1257 os << iDefaultXSize;
1258 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1259 std::ostringstream osYSize;
1260 osYSize << iDefaultYSize;
1261 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1263 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1264 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1265 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1266 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1267 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1268 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1270 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1272 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1273 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1274 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1275 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1276 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1278 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1279 pButtonOk->SetDefault();
1281 SetAutoLayout (true);
1282 SetSizer (pTopSizer);
1283 pTopSizer->Fit (this);
1284 pTopSizer->SetSizeHints (this);
1287 DialogGetXYSize::~DialogGetXYSize ()
1292 DialogGetXYSize::getXSize ()
1294 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1296 if (strCtrl.ToLong (&lValue))
1299 return (m_iDefaultXSize);
1303 DialogGetXYSize::getYSize ()
1305 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1307 if (strCtrl.ToLong (&lValue))
1310 return (m_iDefaultYSize);
1315 /////////////////////////////////////////////////////////////////////
1316 // CLASS IDENTIFICATION
1318 // DialogGetConvertPolarParameters
1319 /////////////////////////////////////////////////////////////////////
1321 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1322 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1323 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1325 m_iDefaultXSize = iDefaultXSize;
1326 m_iDefaultYSize = iDefaultYSize;
1327 m_iDefaultZeropad = iDefaultZeropad;
1329 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1331 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1332 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1334 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1336 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1337 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1338 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1340 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1341 std::ostringstream os;
1342 os << iDefaultXSize;
1343 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1344 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1345 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1346 std::ostringstream osYSize;
1347 osYSize << iDefaultYSize;
1348 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1349 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1350 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1352 if (iDefaultZeropad >= 0) {
1353 std::ostringstream osZeropad;
1354 osZeropad << iDefaultZeropad;
1355 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1356 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1357 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1361 pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1363 pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1365 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1367 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1368 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1369 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1370 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1371 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1372 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1373 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1375 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1376 pButtonOk->SetDefault();
1377 SetAutoLayout (true);
1378 SetSizer (pTopSizer);
1379 pTopSizer->Layout();
1380 pTopSizer->Fit (this);
1381 pTopSizer->SetSizeHints (this);
1385 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1391 DialogGetConvertPolarParameters::getXSize ()
1393 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1394 unsigned long lValue;
1395 if (strCtrl.ToULong (&lValue))
1398 return (m_iDefaultXSize);
1402 DialogGetConvertPolarParameters::getYSize ()
1404 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1405 unsigned long lValue;
1406 if (strCtrl.ToULong (&lValue))
1409 return (m_iDefaultYSize);
1413 DialogGetConvertPolarParameters::getZeropad ()
1416 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1417 unsigned long lValue;
1418 if (strCtrl.ToULong (&lValue))
1421 return (m_iDefaultZeropad);
1428 DialogGetConvertPolarParameters::getInterpolationName ()
1430 return m_pRadioBoxInterpolation->getSelectionStringValue();