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.40 2001/02/22 11:05:38 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* aszTitle[], const char* 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* aszTitle[], const char* 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)
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 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
247 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
248 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
249 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
250 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
251 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
252 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
253 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
255 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
256 pButtonOk->SetDefault();
258 SetAutoLayout (true);
259 SetSizer (pTopSizer);
260 pTopSizer->Fit (this);
261 pTopSizer->SetSizeHints (this);
264 DialogPreferences::~DialogPreferences ()
269 DialogPreferences::getAdvancedOptions ()
271 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
275 DialogPreferences::getAskDeleteNewDocs ()
277 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
281 DialogPreferences::getVerboseLogging ()
283 return static_cast<bool>(m_pCBVerboseLogging->GetValue());
287 DialogPreferences::getStartupTips ()
289 return static_cast<bool>(m_pCBStartupTips->GetValue());
293 /////////////////////////////////////////////////////////////////////
294 // CLASS DiaglogGetMinMax Implementation
295 /////////////////////////////////////////////////////////////////////
297 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
298 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
300 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
302 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
304 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
306 std::ostringstream os;
308 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
309 std::ostringstream osMax;
310 osMax << dDefaultMax;
311 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
313 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
314 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
315 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
316 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
317 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
318 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
320 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
322 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
323 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
324 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
325 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
326 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
327 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
328 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
330 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
331 pButtonOk->SetDefault();
333 SetAutoLayout (true);
334 SetSizer (pTopSizer);
335 pTopSizer->Fit (this);
336 pTopSizer->SetSizeHints (this);
339 DialogGetMinMax::~DialogGetMinMax ()
344 DialogGetMinMax::getMinimum ()
346 wxString strCtrl = m_pTextCtrlMin->GetValue();
348 if (strCtrl.ToDouble (&dValue))
351 return (m_dDefaultMin);
355 DialogGetMinMax::getMaximum ()
357 wxString strCtrl = m_pTextCtrlMax->GetValue();
359 if (strCtrl.ToDouble (&dValue))
362 return (m_dDefaultMax);
366 /////////////////////////////////////////////////////////////////////
367 // CLASS DialogAutoScaleParameters IMPLEMENTATION
368 /////////////////////////////////////////////////////////////////////
370 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
371 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
373 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
375 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
377 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
379 wxString asTitle[] = {"Median", "Mode", "Mean"};
381 m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
382 m_pRadioBoxCenter->SetSelection (0);
383 pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
385 wxGridSizer *pGridSizer = new wxGridSizer (2);
386 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
387 std::ostringstream osDefaultFactor;
388 osDefaultFactor << dDefaultScaleFactor;
389 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
390 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
391 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
393 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
395 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
396 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
397 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
398 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
399 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
400 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
401 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
403 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
404 pButtonOk->SetDefault();
406 SetAutoLayout (true);
407 SetSizer (pTopSizer);
408 pTopSizer->Fit (this);
409 pTopSizer->SetSizeHints (this);
413 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
415 int iCenter = m_pRadioBoxCenter->GetSelection();
416 double dCenter = m_dMedian;
419 else if (iCenter == 2)
422 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
424 if (! sStddevFactor.ToDouble (&dValue)) {
425 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
428 double dHalfWidth = dValue * m_dStdDev / 2;
429 *pMin = dCenter - dHalfWidth;
430 *pMax = dCenter + dHalfWidth;
431 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
437 DialogAutoScaleParameters::getAutoScaleFactor ()
439 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
441 if (! sStddevFactor.ToDouble (&dValue)) {
442 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
450 /////////////////////////////////////////////////////////////////////
451 // CLASS IDENTIFICATION
453 // DialogGetRasterParameters
454 /////////////////////////////////////////////////////////////////////
456 DialogGetRasterParameters::DialogGetRasterParameters
457 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
458 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
460 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
462 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
464 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
466 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
467 std::ostringstream os;
469 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
470 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
471 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
472 std::ostringstream osYSize;
473 osYSize << iDefaultYSize;
474 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
475 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
476 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
477 std::ostringstream osViewRatio;
478 osViewRatio << dDefaultViewRatio;
479 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
480 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
481 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
482 std::ostringstream osNSamples;
483 osNSamples << iDefaultNSamples;
484 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
485 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
486 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
488 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
490 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
492 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
493 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
494 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
495 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
496 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
497 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
498 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
500 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
501 pButtonOk->SetDefault();
503 SetAutoLayout (true);
504 SetSizer (pTopSizer);
505 pTopSizer->Fit (this);
506 pTopSizer->SetSizeHints (this);
509 DialogGetRasterParameters::~DialogGetRasterParameters ()
515 DialogGetRasterParameters::getXSize ()
517 wxString strCtrl = m_pTextCtrlXSize->GetValue();
518 unsigned long lValue;
519 if (strCtrl.ToULong (&lValue))
522 return (m_iDefaultXSize);
526 DialogGetRasterParameters::getYSize ()
528 wxString strCtrl = m_pTextCtrlYSize->GetValue();
529 unsigned long lValue;
530 if (strCtrl.ToULong (&lValue))
533 return (m_iDefaultYSize);
537 DialogGetRasterParameters::getNSamples ()
539 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
540 unsigned long lValue;
541 if (strCtrl.ToULong (&lValue))
544 return (m_iDefaultNSamples);
548 DialogGetRasterParameters::getViewRatio ()
550 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
552 if (strCtrl.ToDouble (&dValue))
555 return (m_dDefaultViewRatio);
559 /////////////////////////////////////////////////////////////////////
560 // CLASS IDENTIFICATION
562 // DialogGetProjectionParameters
563 /////////////////////////////////////////////////////////////////////
566 DialogGetProjectionParameters::DialogGetProjectionParameters
567 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
568 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
569 double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
570 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
572 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
574 m_dDefaultRotAngle = dDefaultRotAngle;
575 m_dDefaultFocalLength = dDefaultFocalLength;
576 m_dDefaultViewRatio = dDefaultViewRatio;
577 m_dDefaultScanRatio = dDefaultScanRatio;
578 m_iDefaultNSamples = iDefaultNSamples;
579 m_iDefaultNView = iDefaultNView;
580 m_iDefaultNDet = iDefaultNDet;
581 m_iDefaultTrace = iDefaultTrace;
582 m_iDefaultGeometry = iDefaultGeometry;
584 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
586 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
588 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
589 m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
590 m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
592 pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
594 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
595 m_pRadioBoxTrace->SetSelection (iDefaultTrace);
596 pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
598 wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
599 std::ostringstream os;
601 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
602 pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
603 pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
604 std::ostringstream osNView;
605 osNView << iDefaultNView;
606 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
607 pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
608 pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
609 std::ostringstream osNSamples;
610 osNSamples << iDefaultNSamples;
611 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
612 pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
613 pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
615 pGridSizer->Add (pText1Sizer);
617 wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
618 std::ostringstream osViewRatio;
619 osViewRatio << dDefaultViewRatio;
620 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
621 pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
622 pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
623 std::ostringstream osScanRatio;
624 osScanRatio << dDefaultScanRatio;
625 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
626 pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
627 pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
628 std::ostringstream osFocalLength;
629 osFocalLength << dDefaultFocalLength;
630 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
631 pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
632 pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
634 if (theApp->getAdvancedOptions()) {
635 std::ostringstream osRotAngle;
636 osRotAngle << dDefaultRotAngle;
637 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
638 pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
639 pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
641 pGridSizer->Add (pText2Sizer);
643 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
645 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
647 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
648 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
649 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
650 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
651 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
652 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
653 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
655 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
656 pButtonOk->SetDefault();
658 SetAutoLayout (true);
659 SetSizer (pTopSizer);
660 pTopSizer->Fit (this);
661 pTopSizer->SetSizeHints (this);
664 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
670 DialogGetProjectionParameters::getNDet ()
672 wxString strCtrl = m_pTextCtrlNDet->GetValue();
673 unsigned long lValue;
674 if (strCtrl.ToULong (&lValue))
677 return (m_iDefaultNDet);
681 DialogGetProjectionParameters::getNView ()
683 wxString strCtrl = m_pTextCtrlNView->GetValue();
684 unsigned long lValue;
685 if (strCtrl.ToULong (&lValue))
688 return (m_iDefaultNView);
693 DialogGetProjectionParameters::getNSamples ()
695 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
696 unsigned long lValue;
697 if (strCtrl.ToULong (&lValue))
700 return (m_iDefaultNSamples);
704 DialogGetProjectionParameters::getRotAngle ()
706 if (theApp->getAdvancedOptions()) {
707 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
709 if (strCtrl.ToDouble (&dValue))
710 return (dValue * TWOPI);
712 return (m_dDefaultRotAngle);
714 if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
715 Scanner::GEOMETRY_PARALLEL)
723 DialogGetProjectionParameters::getFocalLengthRatio ()
725 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
727 if (strCtrl.ToDouble (&dValue))
730 return (m_dDefaultFocalLength);
734 DialogGetProjectionParameters::getViewRatio ()
736 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
738 if (strCtrl.ToDouble (&dValue))
741 return (m_dDefaultViewRatio);
745 DialogGetProjectionParameters::getScanRatio ()
747 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
749 if (strCtrl.ToDouble (&dValue))
752 return (m_dDefaultScanRatio);
756 DialogGetProjectionParameters::getGeometry ()
758 return m_pRadioBoxGeometry->getSelectionStringValue();
762 DialogGetProjectionParameters::getTrace ()
764 return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
769 /////////////////////////////////////////////////////////////////////
770 // CLASS IDENTIFICATION
772 // DialogGetReconstructionParameters
773 /////////////////////////////////////////////////////////////////////
776 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
777 int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
778 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
779 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
780 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
782 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
784 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
785 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
787 wxFlexGridSizer* pGridSizer = NULL;
788 if (theApp->getAdvancedOptions())
789 pGridSizer = new wxFlexGridSizer (4);
791 pGridSizer = new wxFlexGridSizer (3);
793 if (theApp->getAdvancedOptions())
794 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
796 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
797 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
798 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
800 if (theApp->getAdvancedOptions()) {
801 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
802 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
803 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
806 static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
807 static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
809 static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
810 static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
812 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
814 m_pRadioBoxFilterMethod->SetSelection (1);
816 m_pRadioBoxFilterMethod->SetSelection (0);
818 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
821 if (theApp->getAdvancedOptions()) {
822 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
823 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
824 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
826 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
827 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
828 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
831 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
832 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
833 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
835 static const char* aszTraceTitle[] = {"None", "Full"};
836 static const char* aszTraceName[] = {"none", "full"};
837 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
838 iTrace = clamp(iTrace, 0, 1);
839 m_pRadioBoxTrace->SetSelection (iTrace);
840 pGridSizer->Add (m_pRadioBoxTrace);
842 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
843 std::ostringstream os;
845 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
846 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
847 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
848 std::ostringstream osYSize;
849 osYSize << iDefaultYSize;
850 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
851 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
852 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
854 std::ostringstream osHammingParam;
855 osHammingParam << dDefaultHammingParam;
856 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
857 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
858 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
860 if (theApp->getAdvancedOptions()) {
861 std::ostringstream osZeropad;
862 osZeropad << iDefaultZeropad;
863 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
864 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
865 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
867 pGridSizer->Add (pTextGridSizer);
869 #if HAVE_FREQ_PREINTERP
870 std::ostringstream osInterpParam;
871 osInterpParam << iDefaultInterpParam;
872 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
873 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
874 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
877 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
879 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
881 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
882 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
883 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
884 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
885 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
886 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
887 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
889 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
890 pButtonOk->SetDefault();
892 SetAutoLayout (true);
893 SetSizer (pTopSizer);
895 pTopSizer->Fit (this);
896 pTopSizer->SetSizeHints (this);
899 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
905 DialogGetReconstructionParameters::getXSize ()
907 wxString strCtrl = m_pTextCtrlXSize->GetValue();
908 unsigned long lValue;
909 if (strCtrl.ToULong (&lValue))
912 return (m_iDefaultXSize);
916 DialogGetReconstructionParameters::getYSize ()
918 wxString strCtrl = m_pTextCtrlYSize->GetValue();
919 unsigned long lValue;
920 if (strCtrl.ToULong (&lValue))
923 return (m_iDefaultYSize);
927 DialogGetReconstructionParameters::getZeropad ()
929 if (theApp->getAdvancedOptions()) {
930 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
931 unsigned long lValue;
932 if (strCtrl.ToULong (&lValue))
935 return (m_iDefaultZeropad);
942 DialogGetReconstructionParameters::getInterpParam ()
944 #if HAVE_FREQ_PREINTERP
945 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
946 unsigned long lValue;
947 if (strCtrl.ToULong (&lValue))
950 return (m_iDefaultInterpParam);
957 DialogGetReconstructionParameters::getFilterParam ()
959 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
961 if (strCtrl.ToDouble (&dValue))
964 return (m_dDefaultFilterParam);
968 DialogGetReconstructionParameters::getFilterName ()
970 return m_pRadioBoxFilter->getSelectionStringValue();
974 DialogGetReconstructionParameters::getFilterMethodName ()
976 return m_pRadioBoxFilterMethod->getSelectionStringValue();
980 DialogGetReconstructionParameters::getInterpName ()
982 return m_pRadioBoxInterp->getSelectionStringValue();
986 DialogGetReconstructionParameters::getTrace ()
989 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
990 iTrace = Trace::TRACE_PLOT;
995 DialogGetReconstructionParameters::getBackprojectName ()
997 if (theApp->getAdvancedOptions()) {
998 return m_pRadioBoxBackproject->getSelectionStringValue();
1004 DialogGetReconstructionParameters::getFilterGenerationName ()
1006 if (theApp->getAdvancedOptions()) {
1007 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
1009 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
1010 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
1013 return "inverse-fourier";
1018 /////////////////////////////////////////////////////////////////////
1019 // CLASS IDENTIFICATION
1021 // DialogGetFilterParameters
1022 /////////////////////////////////////////////////////////////////////
1026 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1027 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1029 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1031 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1032 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1034 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1036 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1037 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1038 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1040 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1041 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1042 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1044 std::ostringstream os;
1045 os << iDefaultXSize;
1046 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1047 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1048 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1050 std::ostringstream osYSize;
1051 osYSize << iDefaultYSize;
1052 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1053 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1054 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1056 std::ostringstream osFilterParam;
1057 osFilterParam << dDefaultFilterParam;
1058 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1059 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1060 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1062 std::ostringstream osBandwidth;
1063 osBandwidth << dDefaultBandwidth;
1064 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1065 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1066 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1068 std::ostringstream osInputScale;
1069 osInputScale << dDefaultInputScale;
1070 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1071 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1072 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1074 std::ostringstream osOutputScale;
1075 osOutputScale << dDefaultOutputScale;
1076 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1077 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1078 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1080 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1082 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1084 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1085 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1086 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1087 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1088 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1089 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1090 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1092 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1093 pButtonOk->SetDefault();
1095 SetAutoLayout (true);
1096 SetSizer (pTopSizer);
1097 pTopSizer->Layout();
1098 pTopSizer->Fit (this);
1099 pTopSizer->SetSizeHints (this);
1102 DialogGetFilterParameters::~DialogGetFilterParameters ()
1108 DialogGetFilterParameters::getXSize ()
1110 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1111 unsigned long lValue;
1112 if (strCtrl.ToULong (&lValue))
1115 return (m_iDefaultXSize);
1119 DialogGetFilterParameters::getYSize ()
1121 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1122 unsigned long lValue;
1123 if (strCtrl.ToULong (&lValue))
1126 return (m_iDefaultYSize);
1130 DialogGetFilterParameters::getBandwidth ()
1132 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1134 if (strCtrl.ToDouble (&dValue))
1137 return (m_dDefaultBandwidth);
1141 DialogGetFilterParameters::getFilterParam ()
1143 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1145 if (strCtrl.ToDouble (&dValue))
1148 return (m_dDefaultFilterParam);
1152 DialogGetFilterParameters::getInputScale ()
1154 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1156 if (strCtrl.ToDouble (&dValue))
1159 return (m_dDefaultInputScale);
1163 DialogGetFilterParameters::getOutputScale ()
1165 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1167 if (strCtrl.ToDouble (&dValue))
1170 return (m_dDefaultOutputScale);
1174 DialogGetFilterParameters::getFilterName ()
1176 return m_pRadioBoxFilter->getSelectionStringValue();
1180 DialogGetFilterParameters::getDomainName ()
1182 return m_pRadioBoxDomain->getSelectionStringValue();
1186 ///////////////////////////////////////////////////////////////////////
1187 // CLASS IMPLEMENTATION
1188 // DialogExportParameters
1189 ///////////////////////////////////////////////////////////////////////
1191 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1192 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1194 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1196 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1198 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1200 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1201 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1202 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1204 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1206 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1207 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1208 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1209 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1210 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1211 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1212 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1214 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1215 pButtonOk->SetDefault();
1217 SetAutoLayout (true);
1218 SetSizer (pTopSizer);
1219 pTopSizer->Fit (this);
1220 pTopSizer->SetSizeHints (this);
1224 DialogExportParameters::getFormatName()
1226 return m_pRadioBoxFormat->getSelectionStringValue();
1230 /////////////////////////////////////////////////////////////////////
1231 // CLASS DiaglogGetXYSize Implementation
1232 /////////////////////////////////////////////////////////////////////
1234 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1235 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1237 m_iDefaultXSize = iDefaultXSize;
1238 m_iDefaultYSize = iDefaultYSize;
1240 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1242 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1244 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1246 std::ostringstream os;
1247 os << iDefaultXSize;
1248 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1249 std::ostringstream osYSize;
1250 osYSize << iDefaultYSize;
1251 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1253 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1254 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1255 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1256 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1257 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1258 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1260 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1262 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1263 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1264 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1265 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1266 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1268 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1269 pButtonOk->SetDefault();
1271 SetAutoLayout (true);
1272 SetSizer (pTopSizer);
1273 pTopSizer->Fit (this);
1274 pTopSizer->SetSizeHints (this);
1277 DialogGetXYSize::~DialogGetXYSize ()
1282 DialogGetXYSize::getXSize ()
1284 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1286 if (strCtrl.ToLong (&lValue))
1289 return (m_iDefaultXSize);
1293 DialogGetXYSize::getYSize ()
1295 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1297 if (strCtrl.ToLong (&lValue))
1300 return (m_iDefaultYSize);
1305 /////////////////////////////////////////////////////////////////////
1306 // CLASS IDENTIFICATION
1308 // DialogGetConvertPolarParameters
1309 /////////////////////////////////////////////////////////////////////
1311 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1312 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1313 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1315 m_iDefaultXSize = iDefaultXSize;
1316 m_iDefaultYSize = iDefaultYSize;
1317 m_iDefaultZeropad = iDefaultZeropad;
1319 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1321 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1322 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1324 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1326 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1327 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1328 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1330 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1331 std::ostringstream os;
1332 os << iDefaultXSize;
1333 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1334 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1335 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1336 std::ostringstream osYSize;
1337 osYSize << iDefaultYSize;
1338 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1339 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1340 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1342 if (iDefaultZeropad >= 0) {
1343 std::ostringstream osZeropad;
1344 osZeropad << iDefaultZeropad;
1345 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1346 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1347 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1351 pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1353 pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1355 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1357 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1358 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1359 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1360 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1361 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1362 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1363 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1365 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1366 pButtonOk->SetDefault();
1367 SetAutoLayout (true);
1368 SetSizer (pTopSizer);
1369 pTopSizer->Layout();
1370 pTopSizer->Fit (this);
1371 pTopSizer->SetSizeHints (this);
1375 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1381 DialogGetConvertPolarParameters::getXSize ()
1383 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1384 unsigned long lValue;
1385 if (strCtrl.ToULong (&lValue))
1388 return (m_iDefaultXSize);
1392 DialogGetConvertPolarParameters::getYSize ()
1394 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1395 unsigned long lValue;
1396 if (strCtrl.ToULong (&lValue))
1399 return (m_iDefaultYSize);
1403 DialogGetConvertPolarParameters::getZeropad ()
1406 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1407 unsigned long lValue;
1408 if (strCtrl.ToULong (&lValue))
1411 return (m_iDefaultZeropad);
1418 DialogGetConvertPolarParameters::getInterpolationName ()
1420 return m_pRadioBoxInterpolation->getSelectionStringValue();