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.39 2001/02/22 00:56:50 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"
54 #include "imagefile.h"
56 #if defined(MSVC) || HAVE_SSTREAM
59 #include <sstream_subst>
63 ///////////////////////////////////////////////////////////////////////
64 // CLASS IMPLEMENTATION
65 // StringValueAndTitleListBox
66 ///////////////////////////////////////////////////////////////////////
68 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
71 wxString* psTitle = new wxString [nChoices];
72 for (int i = 0; i < nChoices; i++)
73 psTitle[i] = aszTitle[i];
75 Create (pParent, -1, wxDefaultPosition, wxSize(-1,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
77 m_ppszValues = aszValue;
82 StringValueAndTitleListBox::getSelectionStringValue () const
84 return m_ppszValues[GetSelection()];
87 StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[])
90 wxString* psTitle = new wxString [nChoices];
91 for (int i = 0; i < nChoices; i++)
92 psTitle[i] = aszTitle[i];
94 Create (pParent, -1, strTitle, wxDefaultPosition, wxDefaultSize, nChoices, psTitle, 1, wxRA_SPECIFY_COLS);
96 m_ppszValues = aszValue;
101 StringValueAndTitleRadioBox::getSelectionStringValue () const
103 return m_ppszValues[GetSelection()];
106 ///////////////////////////////////////////////////////////////////////
107 // CLASS IMPLEMENTATION
109 ///////////////////////////////////////////////////////////////////////
111 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
112 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
114 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
116 pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxCENTER | wxALL, 5);
118 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
120 m_pRadioBoxPhantom = new StringValueAndTitleRadioBox (this, _T("Phantom"), Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
121 m_pRadioBoxPhantom->SetSelection (iDefaultPhantom);
122 pTopSizer->Add (m_pRadioBoxPhantom, 0, wxALL | wxALIGN_CENTER);
124 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
126 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
127 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
128 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
129 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
130 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
131 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PHANTOM);
132 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
134 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
135 pButtonOk->SetDefault();
137 SetAutoLayout (true);
138 SetSizer (pTopSizer);
139 pTopSizer->Fit (this);
140 pTopSizer->SetSizeHints (this);
144 DialogGetPhantom::getPhantom()
146 return m_pRadioBoxPhantom->getSelectionStringValue();
150 ///////////////////////////////////////////////////////////////////////
151 // CLASS IMPLEMENTATION
152 // DialogGetComparisonImage
153 ///////////////////////////////////////////////////////////////////////
155 DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
156 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
158 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
160 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
162 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
164 int iNImages = m_rVecIF.size();
165 wxString* pstrImages = new wxString [iNImages];
166 for (int i = 0; i < iNImages; i++) {
167 ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
169 pstrImages[i] = pView->getFrame()->GetTitle();
172 m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
173 delete [] pstrImages;
175 m_pListBoxImageChoices->SetSelection (0);
176 pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
178 if (bShowMakeDifference) {
179 m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
180 m_pMakeDifferenceImage->SetValue (FALSE);
181 pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
183 m_pMakeDifferenceImage = NULL;
185 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
187 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
188 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
189 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
190 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
191 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
192 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_COMPARISON);
193 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
195 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
196 pButtonOk->SetDefault();
198 SetAutoLayout (true);
199 SetSizer (pTopSizer);
200 pTopSizer->Fit (this);
201 pTopSizer->SetSizeHints (this);
205 DialogGetComparisonImage::getImageFileDocument()
207 return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
211 DialogGetComparisonImage::getMakeDifferenceImage()
213 if (m_pMakeDifferenceImage)
214 return m_pMakeDifferenceImage->GetValue();
220 /////////////////////////////////////////////////////////////////////
221 // CLASS DiaglogPreferences Implementation
222 /////////////////////////////////////////////////////////////////////
224 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle,
225 bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips)
226 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
228 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
230 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
232 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
234 m_pCBAdvancedOptions = new wxCheckBox (this, -1, "Advanced Options", wxDefaultPosition, wxSize(250, 25), 0);
235 m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
236 pTopSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
238 m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "Ask \"Save New Documents\" Before Closing", wxDefaultPosition, wxSize(250, 25), 0);
239 m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
240 pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
242 m_pCBVerboseLogging = new wxCheckBox (this, -1, "Verbose Logging", wxDefaultPosition, wxSize(250, 25), 0);
243 m_pCBVerboseLogging->SetValue (bVerboseLogging);
244 pTopSizer->Add (m_pCBVerboseLogging, 0, wxALIGN_CENTER_VERTICAL);
246 m_pCBStartupTips = new wxCheckBox (this, -1, "Show Tips at Start", wxDefaultPosition, wxSize(250, 25), 0);
247 m_pCBStartupTips->SetValue (bStartupTips);
248 pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL);
250 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
252 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
253 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
254 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
255 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
256 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
257 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
258 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
260 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
261 pButtonOk->SetDefault();
263 SetAutoLayout (true);
264 SetSizer (pTopSizer);
265 pTopSizer->Fit (this);
266 pTopSizer->SetSizeHints (this);
269 DialogPreferences::~DialogPreferences ()
274 DialogPreferences::getAdvancedOptions ()
276 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
280 DialogPreferences::getAskDeleteNewDocs ()
282 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
286 DialogPreferences::getVerboseLogging ()
288 return static_cast<bool>(m_pCBVerboseLogging->GetValue());
292 DialogPreferences::getStartupTips ()
294 return static_cast<bool>(m_pCBStartupTips->GetValue());
298 /////////////////////////////////////////////////////////////////////
299 // CLASS DiaglogGetMinMax Implementation
300 /////////////////////////////////////////////////////////////////////
302 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
303 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
305 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
307 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
309 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
311 std::ostringstream os;
313 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
314 std::ostringstream osMax;
315 osMax << dDefaultMax;
316 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
318 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
319 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
320 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
321 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
322 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
323 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
325 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
327 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
328 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
329 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
330 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
331 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
332 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
333 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
335 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
336 pButtonOk->SetDefault();
338 SetAutoLayout (true);
339 SetSizer (pTopSizer);
340 pTopSizer->Fit (this);
341 pTopSizer->SetSizeHints (this);
344 DialogGetMinMax::~DialogGetMinMax ()
349 DialogGetMinMax::getMinimum ()
351 wxString strCtrl = m_pTextCtrlMin->GetValue();
353 if (strCtrl.ToDouble (&dValue))
356 return (m_dDefaultMin);
360 DialogGetMinMax::getMaximum ()
362 wxString strCtrl = m_pTextCtrlMax->GetValue();
364 if (strCtrl.ToDouble (&dValue))
367 return (m_dDefaultMax);
371 /////////////////////////////////////////////////////////////////////
372 // CLASS DialogAutoScaleParameters IMPLEMENTATION
373 /////////////////////////////////////////////////////////////////////
375 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
376 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
378 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
380 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
382 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
384 wxString asTitle[] = {"Median", "Mode", "Mean"};
386 m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
387 m_pRadioBoxCenter->SetSelection (0);
388 pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
390 wxGridSizer *pGridSizer = new wxGridSizer (2);
391 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
392 std::ostringstream osDefaultFactor;
393 osDefaultFactor << dDefaultScaleFactor;
394 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
395 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
396 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
398 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
400 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
401 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
402 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
403 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
404 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
405 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
406 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
408 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
409 pButtonOk->SetDefault();
411 SetAutoLayout (true);
412 SetSizer (pTopSizer);
413 pTopSizer->Fit (this);
414 pTopSizer->SetSizeHints (this);
418 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
420 int iCenter = m_pRadioBoxCenter->GetSelection();
421 double dCenter = m_dMedian;
424 else if (iCenter == 2)
427 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
429 if (! sStddevFactor.ToDouble (&dValue)) {
430 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
433 double dHalfWidth = dValue * m_dStdDev / 2;
434 *pMin = dCenter - dHalfWidth;
435 *pMax = dCenter + dHalfWidth;
436 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
442 DialogAutoScaleParameters::getAutoScaleFactor ()
444 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
446 if (! sStddevFactor.ToDouble (&dValue)) {
447 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
455 /////////////////////////////////////////////////////////////////////
456 // CLASS IDENTIFICATION
458 // DialogGetRasterParameters
459 /////////////////////////////////////////////////////////////////////
461 DialogGetRasterParameters::DialogGetRasterParameters
462 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
463 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
465 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
467 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
469 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
471 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
472 std::ostringstream os;
474 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
475 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
476 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
477 std::ostringstream osYSize;
478 osYSize << iDefaultYSize;
479 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
480 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
481 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
482 std::ostringstream osViewRatio;
483 osViewRatio << dDefaultViewRatio;
484 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
485 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
486 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
487 std::ostringstream osNSamples;
488 osNSamples << iDefaultNSamples;
489 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
490 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
491 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
493 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
495 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
497 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
498 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
499 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
500 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
501 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
502 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
503 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
505 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
506 pButtonOk->SetDefault();
508 SetAutoLayout (true);
509 SetSizer (pTopSizer);
510 pTopSizer->Fit (this);
511 pTopSizer->SetSizeHints (this);
514 DialogGetRasterParameters::~DialogGetRasterParameters ()
520 DialogGetRasterParameters::getXSize ()
522 wxString strCtrl = m_pTextCtrlXSize->GetValue();
523 unsigned long lValue;
524 if (strCtrl.ToULong (&lValue))
527 return (m_iDefaultXSize);
531 DialogGetRasterParameters::getYSize ()
533 wxString strCtrl = m_pTextCtrlYSize->GetValue();
534 unsigned long lValue;
535 if (strCtrl.ToULong (&lValue))
538 return (m_iDefaultYSize);
542 DialogGetRasterParameters::getNSamples ()
544 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
545 unsigned long lValue;
546 if (strCtrl.ToULong (&lValue))
549 return (m_iDefaultNSamples);
553 DialogGetRasterParameters::getViewRatio ()
555 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
557 if (strCtrl.ToDouble (&dValue))
560 return (m_dDefaultViewRatio);
564 /////////////////////////////////////////////////////////////////////
565 // CLASS IDENTIFICATION
567 // DialogGetProjectionParameters
568 /////////////////////////////////////////////////////////////////////
571 DialogGetProjectionParameters::DialogGetProjectionParameters
572 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
573 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
574 double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
575 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
577 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
579 m_dDefaultRotAngle = dDefaultRotAngle;
580 m_dDefaultFocalLength = dDefaultFocalLength;
581 m_dDefaultViewRatio = dDefaultViewRatio;
582 m_dDefaultScanRatio = dDefaultScanRatio;
583 m_iDefaultNSamples = iDefaultNSamples;
584 m_iDefaultNView = iDefaultNView;
585 m_iDefaultNDet = iDefaultNDet;
586 m_iDefaultTrace = iDefaultTrace;
587 m_iDefaultGeometry = iDefaultGeometry;
589 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
591 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
593 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
594 m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
595 m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
597 pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
599 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
600 m_pRadioBoxTrace->SetSelection (iDefaultTrace);
601 pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
603 wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
604 std::ostringstream os;
606 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
607 pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
608 pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
609 std::ostringstream osNView;
610 osNView << iDefaultNView;
611 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
612 pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
613 pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
614 std::ostringstream osNSamples;
615 osNSamples << iDefaultNSamples;
616 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
617 pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
618 pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
620 pGridSizer->Add (pText1Sizer);
622 wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
623 std::ostringstream osViewRatio;
624 osViewRatio << dDefaultViewRatio;
625 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
626 pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
627 pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
628 std::ostringstream osScanRatio;
629 osScanRatio << dDefaultScanRatio;
630 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
631 pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
632 pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
633 std::ostringstream osFocalLength;
634 osFocalLength << dDefaultFocalLength;
635 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
636 pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
637 pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
639 if (theApp->getAdvancedOptions()) {
640 std::ostringstream osRotAngle;
641 osRotAngle << dDefaultRotAngle;
642 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
643 pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
644 pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
646 pGridSizer->Add (pText2Sizer);
648 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
650 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
652 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
653 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
654 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
655 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
656 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
657 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
658 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
660 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
661 pButtonOk->SetDefault();
663 SetAutoLayout (true);
664 SetSizer (pTopSizer);
665 pTopSizer->Fit (this);
666 pTopSizer->SetSizeHints (this);
669 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
675 DialogGetProjectionParameters::getNDet ()
677 wxString strCtrl = m_pTextCtrlNDet->GetValue();
678 unsigned long lValue;
679 if (strCtrl.ToULong (&lValue))
682 return (m_iDefaultNDet);
686 DialogGetProjectionParameters::getNView ()
688 wxString strCtrl = m_pTextCtrlNView->GetValue();
689 unsigned long lValue;
690 if (strCtrl.ToULong (&lValue))
693 return (m_iDefaultNView);
698 DialogGetProjectionParameters::getNSamples ()
700 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
701 unsigned long lValue;
702 if (strCtrl.ToULong (&lValue))
705 return (m_iDefaultNSamples);
709 DialogGetProjectionParameters::getRotAngle ()
711 if (theApp->getAdvancedOptions()) {
712 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
714 if (strCtrl.ToDouble (&dValue))
715 return (dValue * TWOPI);
717 return (m_dDefaultRotAngle);
719 if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
720 Scanner::GEOMETRY_PARALLEL)
728 DialogGetProjectionParameters::getFocalLengthRatio ()
730 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
732 if (strCtrl.ToDouble (&dValue))
735 return (m_dDefaultFocalLength);
739 DialogGetProjectionParameters::getViewRatio ()
741 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
743 if (strCtrl.ToDouble (&dValue))
746 return (m_dDefaultViewRatio);
750 DialogGetProjectionParameters::getScanRatio ()
752 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
754 if (strCtrl.ToDouble (&dValue))
757 return (m_dDefaultScanRatio);
761 DialogGetProjectionParameters::getGeometry ()
763 return m_pRadioBoxGeometry->getSelectionStringValue();
767 DialogGetProjectionParameters::getTrace ()
769 return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
774 /////////////////////////////////////////////////////////////////////
775 // CLASS IDENTIFICATION
777 // DialogGetReconstructionParameters
778 /////////////////////////////////////////////////////////////////////
781 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
782 int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
783 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
784 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
785 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
787 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
789 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
790 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
792 wxFlexGridSizer* pGridSizer = NULL;
793 if (theApp->getAdvancedOptions())
794 pGridSizer = new wxFlexGridSizer (4);
796 pGridSizer = new wxFlexGridSizer (3);
798 if (theApp->getAdvancedOptions())
799 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
801 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
802 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
803 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
805 if (theApp->getAdvancedOptions()) {
806 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
807 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
808 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
811 static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
812 static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
814 static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
815 static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
817 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
819 m_pRadioBoxFilterMethod->SetSelection (1);
821 m_pRadioBoxFilterMethod->SetSelection (0);
823 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
826 if (theApp->getAdvancedOptions()) {
827 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
828 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
829 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
831 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
832 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
833 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
836 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
837 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
838 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
840 static const char* aszTraceTitle[] = {"None", "Full"};
841 static const char* aszTraceName[] = {"none", "full"};
842 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
843 iTrace = clamp(iTrace, 0, 1);
844 m_pRadioBoxTrace->SetSelection (iTrace);
845 pGridSizer->Add (m_pRadioBoxTrace);
847 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
848 std::ostringstream os;
850 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
851 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
852 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
853 std::ostringstream osYSize;
854 osYSize << iDefaultYSize;
855 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
856 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
857 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
859 std::ostringstream osHammingParam;
860 osHammingParam << dDefaultHammingParam;
861 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
862 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
863 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
865 if (theApp->getAdvancedOptions()) {
866 std::ostringstream osZeropad;
867 osZeropad << iDefaultZeropad;
868 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
869 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
870 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
872 pGridSizer->Add (pTextGridSizer);
874 #if HAVE_FREQ_PREINTERP
875 std::ostringstream osInterpParam;
876 osInterpParam << iDefaultInterpParam;
877 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
878 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
879 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
882 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
884 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
886 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
887 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
888 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
889 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
890 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
891 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
892 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
894 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
895 pButtonOk->SetDefault();
897 SetAutoLayout (true);
898 SetSizer (pTopSizer);
900 pTopSizer->Fit (this);
901 pTopSizer->SetSizeHints (this);
904 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
910 DialogGetReconstructionParameters::getXSize ()
912 wxString strCtrl = m_pTextCtrlXSize->GetValue();
913 unsigned long lValue;
914 if (strCtrl.ToULong (&lValue))
917 return (m_iDefaultXSize);
921 DialogGetReconstructionParameters::getYSize ()
923 wxString strCtrl = m_pTextCtrlYSize->GetValue();
924 unsigned long lValue;
925 if (strCtrl.ToULong (&lValue))
928 return (m_iDefaultYSize);
932 DialogGetReconstructionParameters::getZeropad ()
934 if (theApp->getAdvancedOptions()) {
935 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
936 unsigned long lValue;
937 if (strCtrl.ToULong (&lValue))
940 return (m_iDefaultZeropad);
947 DialogGetReconstructionParameters::getInterpParam ()
949 #if HAVE_FREQ_PREINTERP
950 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
951 unsigned long lValue;
952 if (strCtrl.ToULong (&lValue))
955 return (m_iDefaultInterpParam);
962 DialogGetReconstructionParameters::getFilterParam ()
964 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
966 if (strCtrl.ToDouble (&dValue))
969 return (m_dDefaultFilterParam);
973 DialogGetReconstructionParameters::getFilterName ()
975 return m_pRadioBoxFilter->getSelectionStringValue();
979 DialogGetReconstructionParameters::getFilterMethodName ()
981 return m_pRadioBoxFilterMethod->getSelectionStringValue();
985 DialogGetReconstructionParameters::getInterpName ()
987 return m_pRadioBoxInterp->getSelectionStringValue();
991 DialogGetReconstructionParameters::getTrace ()
994 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
995 iTrace = Trace::TRACE_PLOT;
1000 DialogGetReconstructionParameters::getBackprojectName ()
1002 if (theApp->getAdvancedOptions()) {
1003 return m_pRadioBoxBackproject->getSelectionStringValue();
1009 DialogGetReconstructionParameters::getFilterGenerationName ()
1011 if (theApp->getAdvancedOptions()) {
1012 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
1014 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
1015 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
1018 return "inverse-fourier";
1023 /////////////////////////////////////////////////////////////////////
1024 // CLASS IDENTIFICATION
1026 // DialogGetFilterParameters
1027 /////////////////////////////////////////////////////////////////////
1031 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1032 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1034 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1036 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1037 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1039 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1041 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1042 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1043 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1045 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1046 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1047 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1049 std::ostringstream os;
1050 os << iDefaultXSize;
1051 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1052 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1053 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1055 std::ostringstream osYSize;
1056 osYSize << iDefaultYSize;
1057 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1058 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1059 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1061 std::ostringstream osFilterParam;
1062 osFilterParam << dDefaultFilterParam;
1063 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1064 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1065 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1067 std::ostringstream osBandwidth;
1068 osBandwidth << dDefaultBandwidth;
1069 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1070 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1071 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1073 std::ostringstream osInputScale;
1074 osInputScale << dDefaultInputScale;
1075 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1076 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1077 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1079 std::ostringstream osOutputScale;
1080 osOutputScale << dDefaultOutputScale;
1081 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1082 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1083 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1085 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1087 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1089 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1090 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1091 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1092 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1093 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1094 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1095 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1097 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1098 pButtonOk->SetDefault();
1100 SetAutoLayout (true);
1101 SetSizer (pTopSizer);
1102 pTopSizer->Layout();
1103 pTopSizer->Fit (this);
1104 pTopSizer->SetSizeHints (this);
1107 DialogGetFilterParameters::~DialogGetFilterParameters ()
1113 DialogGetFilterParameters::getXSize ()
1115 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1116 unsigned long lValue;
1117 if (strCtrl.ToULong (&lValue))
1120 return (m_iDefaultXSize);
1124 DialogGetFilterParameters::getYSize ()
1126 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1127 unsigned long lValue;
1128 if (strCtrl.ToULong (&lValue))
1131 return (m_iDefaultYSize);
1135 DialogGetFilterParameters::getBandwidth ()
1137 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1139 if (strCtrl.ToDouble (&dValue))
1142 return (m_dDefaultBandwidth);
1146 DialogGetFilterParameters::getFilterParam ()
1148 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1150 if (strCtrl.ToDouble (&dValue))
1153 return (m_dDefaultFilterParam);
1157 DialogGetFilterParameters::getInputScale ()
1159 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1161 if (strCtrl.ToDouble (&dValue))
1164 return (m_dDefaultInputScale);
1168 DialogGetFilterParameters::getOutputScale ()
1170 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1172 if (strCtrl.ToDouble (&dValue))
1175 return (m_dDefaultOutputScale);
1179 DialogGetFilterParameters::getFilterName ()
1181 return m_pRadioBoxFilter->getSelectionStringValue();
1185 DialogGetFilterParameters::getDomainName ()
1187 return m_pRadioBoxDomain->getSelectionStringValue();
1191 ///////////////////////////////////////////////////////////////////////
1192 // CLASS IMPLEMENTATION
1193 // DialogExportParameters
1194 ///////////////////////////////////////////////////////////////////////
1196 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1197 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1199 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1201 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1203 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1205 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1206 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1207 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1209 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1211 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1212 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1213 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1214 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1215 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1216 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1217 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1219 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1220 pButtonOk->SetDefault();
1222 SetAutoLayout (true);
1223 SetSizer (pTopSizer);
1224 pTopSizer->Fit (this);
1225 pTopSizer->SetSizeHints (this);
1229 DialogExportParameters::getFormatName()
1231 return m_pRadioBoxFormat->getSelectionStringValue();
1235 /////////////////////////////////////////////////////////////////////
1236 // CLASS DiaglogGetXYSize Implementation
1237 /////////////////////////////////////////////////////////////////////
1239 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1240 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1242 m_iDefaultXSize = iDefaultXSize;
1243 m_iDefaultYSize = iDefaultYSize;
1245 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1247 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1249 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1251 std::ostringstream os;
1252 os << iDefaultXSize;
1253 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1254 std::ostringstream osYSize;
1255 osYSize << iDefaultYSize;
1256 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1258 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1259 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1260 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1261 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1262 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1263 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1265 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1267 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1268 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1269 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1270 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1271 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1273 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1274 pButtonOk->SetDefault();
1276 SetAutoLayout (true);
1277 SetSizer (pTopSizer);
1278 pTopSizer->Fit (this);
1279 pTopSizer->SetSizeHints (this);
1282 DialogGetXYSize::~DialogGetXYSize ()
1287 DialogGetXYSize::getXSize ()
1289 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1291 if (strCtrl.ToLong (&lValue))
1294 return (m_iDefaultXSize);
1298 DialogGetXYSize::getYSize ()
1300 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1302 if (strCtrl.ToLong (&lValue))
1305 return (m_iDefaultYSize);
1310 /////////////////////////////////////////////////////////////////////
1311 // CLASS IDENTIFICATION
1313 // DialogGetConvertPolarParameters
1314 /////////////////////////////////////////////////////////////////////
1316 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1317 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1318 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1320 m_iDefaultXSize = iDefaultXSize;
1321 m_iDefaultYSize = iDefaultYSize;
1322 m_iDefaultZeropad = iDefaultZeropad;
1324 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1326 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1327 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1329 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1331 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1332 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1333 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1335 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1336 std::ostringstream os;
1337 os << iDefaultXSize;
1338 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1339 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1340 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1341 std::ostringstream osYSize;
1342 osYSize << iDefaultYSize;
1343 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1344 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1345 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1347 if (iDefaultZeropad >= 0) {
1348 std::ostringstream osZeropad;
1349 osZeropad << iDefaultZeropad;
1350 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1351 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1352 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1356 pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1358 pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1360 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1362 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1363 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1364 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1365 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1366 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1367 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1368 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1370 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1371 pButtonOk->SetDefault();
1372 SetAutoLayout (true);
1373 SetSizer (pTopSizer);
1374 pTopSizer->Layout();
1375 pTopSizer->Fit (this);
1376 pTopSizer->SetSizeHints (this);
1380 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1386 DialogGetConvertPolarParameters::getXSize ()
1388 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1389 unsigned long lValue;
1390 if (strCtrl.ToULong (&lValue))
1393 return (m_iDefaultXSize);
1397 DialogGetConvertPolarParameters::getYSize ()
1399 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1400 unsigned long lValue;
1401 if (strCtrl.ToULong (&lValue))
1404 return (m_iDefaultYSize);
1408 DialogGetConvertPolarParameters::getZeropad ()
1411 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1412 unsigned long lValue;
1413 if (strCtrl.ToULong (&lValue))
1416 return (m_iDefaultZeropad);
1423 DialogGetConvertPolarParameters::getInterpolationName ()
1425 return m_pRadioBoxInterpolation->getSelectionStringValue();