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.38 2001/02/21 20:13:03 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)
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 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
248 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
249 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
250 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
251 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
252 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
253 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
254 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
256 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
257 pButtonOk->SetDefault();
259 SetAutoLayout (true);
260 SetSizer (pTopSizer);
261 pTopSizer->Fit (this);
262 pTopSizer->SetSizeHints (this);
265 DialogPreferences::~DialogPreferences ()
270 DialogPreferences::getAdvancedOptions ()
272 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
276 DialogPreferences::getAskDeleteNewDocs ()
278 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
282 DialogPreferences::getVerboseLogging ()
284 return static_cast<bool>(m_pCBVerboseLogging->GetValue());
288 /////////////////////////////////////////////////////////////////////
289 // CLASS DiaglogGetMinMax Implementation
290 /////////////////////////////////////////////////////////////////////
292 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
293 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
295 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
297 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
299 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
301 std::ostringstream os;
303 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
304 std::ostringstream osMax;
305 osMax << dDefaultMax;
306 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
308 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
309 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
310 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
311 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
312 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
313 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
315 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
317 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
318 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
319 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
320 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
321 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
322 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
323 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
325 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
326 pButtonOk->SetDefault();
328 SetAutoLayout (true);
329 SetSizer (pTopSizer);
330 pTopSizer->Fit (this);
331 pTopSizer->SetSizeHints (this);
334 DialogGetMinMax::~DialogGetMinMax ()
339 DialogGetMinMax::getMinimum ()
341 wxString strCtrl = m_pTextCtrlMin->GetValue();
343 if (strCtrl.ToDouble (&dValue))
346 return (m_dDefaultMin);
350 DialogGetMinMax::getMaximum ()
352 wxString strCtrl = m_pTextCtrlMax->GetValue();
354 if (strCtrl.ToDouble (&dValue))
357 return (m_dDefaultMax);
361 /////////////////////////////////////////////////////////////////////
362 // CLASS DialogAutoScaleParameters IMPLEMENTATION
363 /////////////////////////////////////////////////////////////////////
365 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
366 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
368 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
370 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
372 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
374 wxString asTitle[] = {"Median", "Mode", "Mean"};
376 m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
377 m_pRadioBoxCenter->SetSelection (0);
378 pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
380 wxGridSizer *pGridSizer = new wxGridSizer (2);
381 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
382 std::ostringstream osDefaultFactor;
383 osDefaultFactor << dDefaultScaleFactor;
384 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
385 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
386 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
388 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
390 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
391 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
392 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
393 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
394 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
395 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
396 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
398 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
399 pButtonOk->SetDefault();
401 SetAutoLayout (true);
402 SetSizer (pTopSizer);
403 pTopSizer->Fit (this);
404 pTopSizer->SetSizeHints (this);
408 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
410 int iCenter = m_pRadioBoxCenter->GetSelection();
411 double dCenter = m_dMedian;
414 else if (iCenter == 2)
417 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
419 if (! sStddevFactor.ToDouble (&dValue)) {
420 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
423 double dHalfWidth = dValue * m_dStdDev / 2;
424 *pMin = dCenter - dHalfWidth;
425 *pMax = dCenter + dHalfWidth;
426 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
432 DialogAutoScaleParameters::getAutoScaleFactor ()
434 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
436 if (! sStddevFactor.ToDouble (&dValue)) {
437 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
445 /////////////////////////////////////////////////////////////////////
446 // CLASS IDENTIFICATION
448 // DialogGetRasterParameters
449 /////////////////////////////////////////////////////////////////////
451 DialogGetRasterParameters::DialogGetRasterParameters
452 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
453 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
455 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
457 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
459 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
461 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
462 std::ostringstream os;
464 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
465 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
466 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
467 std::ostringstream osYSize;
468 osYSize << iDefaultYSize;
469 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
470 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
471 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
472 std::ostringstream osViewRatio;
473 osViewRatio << dDefaultViewRatio;
474 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
475 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
476 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
477 std::ostringstream osNSamples;
478 osNSamples << iDefaultNSamples;
479 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
480 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
481 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
483 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
485 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
487 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
488 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
489 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
490 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
491 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
492 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
493 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
495 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
496 pButtonOk->SetDefault();
498 SetAutoLayout (true);
499 SetSizer (pTopSizer);
500 pTopSizer->Fit (this);
501 pTopSizer->SetSizeHints (this);
504 DialogGetRasterParameters::~DialogGetRasterParameters ()
510 DialogGetRasterParameters::getXSize ()
512 wxString strCtrl = m_pTextCtrlXSize->GetValue();
513 unsigned long lValue;
514 if (strCtrl.ToULong (&lValue))
517 return (m_iDefaultXSize);
521 DialogGetRasterParameters::getYSize ()
523 wxString strCtrl = m_pTextCtrlYSize->GetValue();
524 unsigned long lValue;
525 if (strCtrl.ToULong (&lValue))
528 return (m_iDefaultYSize);
532 DialogGetRasterParameters::getNSamples ()
534 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
535 unsigned long lValue;
536 if (strCtrl.ToULong (&lValue))
539 return (m_iDefaultNSamples);
543 DialogGetRasterParameters::getViewRatio ()
545 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
547 if (strCtrl.ToDouble (&dValue))
550 return (m_dDefaultViewRatio);
554 /////////////////////////////////////////////////////////////////////
555 // CLASS IDENTIFICATION
557 // DialogGetProjectionParameters
558 /////////////////////////////////////////////////////////////////////
561 DialogGetProjectionParameters::DialogGetProjectionParameters
562 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
563 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
564 double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
565 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
567 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
569 m_dDefaultRotAngle = dDefaultRotAngle;
570 m_dDefaultFocalLength = dDefaultFocalLength;
571 m_dDefaultViewRatio = dDefaultViewRatio;
572 m_dDefaultScanRatio = dDefaultScanRatio;
573 m_iDefaultNSamples = iDefaultNSamples;
574 m_iDefaultNView = iDefaultNView;
575 m_iDefaultNDet = iDefaultNDet;
576 m_iDefaultTrace = iDefaultTrace;
577 m_iDefaultGeometry = iDefaultGeometry;
579 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
581 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
583 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
584 m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
585 m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
587 pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
589 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
590 m_pRadioBoxTrace->SetSelection (iDefaultTrace);
591 pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
593 wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
594 std::ostringstream os;
596 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
597 pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
598 pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
599 std::ostringstream osNView;
600 osNView << iDefaultNView;
601 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
602 pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
603 pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
604 std::ostringstream osNSamples;
605 osNSamples << iDefaultNSamples;
606 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
607 pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
608 pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
610 pGridSizer->Add (pText1Sizer);
612 wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
613 std::ostringstream osViewRatio;
614 osViewRatio << dDefaultViewRatio;
615 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
616 pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
617 pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
618 std::ostringstream osScanRatio;
619 osScanRatio << dDefaultScanRatio;
620 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
621 pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
622 pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
623 std::ostringstream osFocalLength;
624 osFocalLength << dDefaultFocalLength;
625 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
626 pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
627 pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
629 if (theApp->getAdvancedOptions()) {
630 std::ostringstream osRotAngle;
631 osRotAngle << dDefaultRotAngle;
632 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
633 pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
634 pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
636 pGridSizer->Add (pText2Sizer);
638 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
640 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
642 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
643 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
644 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
645 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
646 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
647 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
648 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
650 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
651 pButtonOk->SetDefault();
653 SetAutoLayout (true);
654 SetSizer (pTopSizer);
655 pTopSizer->Fit (this);
656 pTopSizer->SetSizeHints (this);
659 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
665 DialogGetProjectionParameters::getNDet ()
667 wxString strCtrl = m_pTextCtrlNDet->GetValue();
668 unsigned long lValue;
669 if (strCtrl.ToULong (&lValue))
672 return (m_iDefaultNDet);
676 DialogGetProjectionParameters::getNView ()
678 wxString strCtrl = m_pTextCtrlNView->GetValue();
679 unsigned long lValue;
680 if (strCtrl.ToULong (&lValue))
683 return (m_iDefaultNView);
688 DialogGetProjectionParameters::getNSamples ()
690 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
691 unsigned long lValue;
692 if (strCtrl.ToULong (&lValue))
695 return (m_iDefaultNSamples);
699 DialogGetProjectionParameters::getRotAngle ()
701 if (theApp->getAdvancedOptions()) {
702 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
704 if (strCtrl.ToDouble (&dValue))
705 return (dValue * TWOPI);
707 return (m_dDefaultRotAngle);
709 if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
710 Scanner::GEOMETRY_PARALLEL)
718 DialogGetProjectionParameters::getFocalLengthRatio ()
720 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
722 if (strCtrl.ToDouble (&dValue))
725 return (m_dDefaultFocalLength);
729 DialogGetProjectionParameters::getViewRatio ()
731 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
733 if (strCtrl.ToDouble (&dValue))
736 return (m_dDefaultViewRatio);
740 DialogGetProjectionParameters::getScanRatio ()
742 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
744 if (strCtrl.ToDouble (&dValue))
747 return (m_dDefaultScanRatio);
751 DialogGetProjectionParameters::getGeometry ()
753 return m_pRadioBoxGeometry->getSelectionStringValue();
757 DialogGetProjectionParameters::getTrace ()
759 return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
764 /////////////////////////////////////////////////////////////////////
765 // CLASS IDENTIFICATION
767 // DialogGetReconstructionParameters
768 /////////////////////////////////////////////////////////////////////
771 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
772 int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
773 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
774 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
775 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
777 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
779 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
780 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
782 wxFlexGridSizer* pGridSizer = NULL;
783 if (theApp->getAdvancedOptions())
784 pGridSizer = new wxFlexGridSizer (4);
786 pGridSizer = new wxFlexGridSizer (3);
788 if (theApp->getAdvancedOptions())
789 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
791 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
792 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
793 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
795 if (theApp->getAdvancedOptions()) {
796 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
797 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
798 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
801 static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
802 static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
804 static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
805 static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
807 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
809 m_pRadioBoxFilterMethod->SetSelection (1);
811 m_pRadioBoxFilterMethod->SetSelection (0);
813 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
816 if (theApp->getAdvancedOptions()) {
817 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
818 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
819 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
821 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
822 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
823 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
826 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
827 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
828 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
830 static const char* aszTraceTitle[] = {"None", "Full"};
831 static const char* aszTraceName[] = {"none", "full"};
832 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
833 iTrace = clamp(iTrace, 0, 1);
834 m_pRadioBoxTrace->SetSelection (iTrace);
835 pGridSizer->Add (m_pRadioBoxTrace);
837 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
838 std::ostringstream os;
840 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
841 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
842 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
843 std::ostringstream osYSize;
844 osYSize << iDefaultYSize;
845 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
846 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
847 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
849 std::ostringstream osHammingParam;
850 osHammingParam << dDefaultHammingParam;
851 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
852 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
853 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
855 if (theApp->getAdvancedOptions()) {
856 std::ostringstream osZeropad;
857 osZeropad << iDefaultZeropad;
858 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
859 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
860 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
862 pGridSizer->Add (pTextGridSizer);
864 #if HAVE_FREQ_PREINTERP
865 std::ostringstream osInterpParam;
866 osInterpParam << iDefaultInterpParam;
867 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
868 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
869 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
872 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
874 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
876 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
877 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
878 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
879 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
880 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
881 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
882 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
884 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
885 pButtonOk->SetDefault();
887 SetAutoLayout (true);
888 SetSizer (pTopSizer);
890 pTopSizer->Fit (this);
891 pTopSizer->SetSizeHints (this);
894 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
900 DialogGetReconstructionParameters::getXSize ()
902 wxString strCtrl = m_pTextCtrlXSize->GetValue();
903 unsigned long lValue;
904 if (strCtrl.ToULong (&lValue))
907 return (m_iDefaultXSize);
911 DialogGetReconstructionParameters::getYSize ()
913 wxString strCtrl = m_pTextCtrlYSize->GetValue();
914 unsigned long lValue;
915 if (strCtrl.ToULong (&lValue))
918 return (m_iDefaultYSize);
922 DialogGetReconstructionParameters::getZeropad ()
924 if (theApp->getAdvancedOptions()) {
925 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
926 unsigned long lValue;
927 if (strCtrl.ToULong (&lValue))
930 return (m_iDefaultZeropad);
937 DialogGetReconstructionParameters::getInterpParam ()
939 #if HAVE_FREQ_PREINTERP
940 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
941 unsigned long lValue;
942 if (strCtrl.ToULong (&lValue))
945 return (m_iDefaultInterpParam);
952 DialogGetReconstructionParameters::getFilterParam ()
954 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
956 if (strCtrl.ToDouble (&dValue))
959 return (m_dDefaultFilterParam);
963 DialogGetReconstructionParameters::getFilterName ()
965 return m_pRadioBoxFilter->getSelectionStringValue();
969 DialogGetReconstructionParameters::getFilterMethodName ()
971 return m_pRadioBoxFilterMethod->getSelectionStringValue();
975 DialogGetReconstructionParameters::getInterpName ()
977 return m_pRadioBoxInterp->getSelectionStringValue();
981 DialogGetReconstructionParameters::getTrace ()
984 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
985 iTrace = Trace::TRACE_PLOT;
990 DialogGetReconstructionParameters::getBackprojectName ()
992 if (theApp->getAdvancedOptions()) {
993 return m_pRadioBoxBackproject->getSelectionStringValue();
999 DialogGetReconstructionParameters::getFilterGenerationName ()
1001 if (theApp->getAdvancedOptions()) {
1002 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
1004 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
1005 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
1008 return "inverse-fourier";
1013 /////////////////////////////////////////////////////////////////////
1014 // CLASS IDENTIFICATION
1016 // DialogGetFilterParameters
1017 /////////////////////////////////////////////////////////////////////
1021 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1022 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1024 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1026 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1027 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1029 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1031 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1032 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1033 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1035 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1036 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1037 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1039 std::ostringstream os;
1040 os << iDefaultXSize;
1041 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1042 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1043 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1045 std::ostringstream osYSize;
1046 osYSize << iDefaultYSize;
1047 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1048 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1049 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1051 std::ostringstream osFilterParam;
1052 osFilterParam << dDefaultFilterParam;
1053 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1054 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1055 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1057 std::ostringstream osBandwidth;
1058 osBandwidth << dDefaultBandwidth;
1059 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1060 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1061 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1063 std::ostringstream osInputScale;
1064 osInputScale << dDefaultInputScale;
1065 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1066 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1067 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1069 std::ostringstream osOutputScale;
1070 osOutputScale << dDefaultOutputScale;
1071 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1072 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1073 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1075 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1077 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1079 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1080 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1081 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1082 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1083 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1084 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1085 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1087 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1088 pButtonOk->SetDefault();
1090 SetAutoLayout (true);
1091 SetSizer (pTopSizer);
1092 pTopSizer->Layout();
1093 pTopSizer->Fit (this);
1094 pTopSizer->SetSizeHints (this);
1097 DialogGetFilterParameters::~DialogGetFilterParameters ()
1103 DialogGetFilterParameters::getXSize ()
1105 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1106 unsigned long lValue;
1107 if (strCtrl.ToULong (&lValue))
1110 return (m_iDefaultXSize);
1114 DialogGetFilterParameters::getYSize ()
1116 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1117 unsigned long lValue;
1118 if (strCtrl.ToULong (&lValue))
1121 return (m_iDefaultYSize);
1125 DialogGetFilterParameters::getBandwidth ()
1127 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1129 if (strCtrl.ToDouble (&dValue))
1132 return (m_dDefaultBandwidth);
1136 DialogGetFilterParameters::getFilterParam ()
1138 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1140 if (strCtrl.ToDouble (&dValue))
1143 return (m_dDefaultFilterParam);
1147 DialogGetFilterParameters::getInputScale ()
1149 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1151 if (strCtrl.ToDouble (&dValue))
1154 return (m_dDefaultInputScale);
1158 DialogGetFilterParameters::getOutputScale ()
1160 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1162 if (strCtrl.ToDouble (&dValue))
1165 return (m_dDefaultOutputScale);
1169 DialogGetFilterParameters::getFilterName ()
1171 return m_pRadioBoxFilter->getSelectionStringValue();
1175 DialogGetFilterParameters::getDomainName ()
1177 return m_pRadioBoxDomain->getSelectionStringValue();
1181 ///////////////////////////////////////////////////////////////////////
1182 // CLASS IMPLEMENTATION
1183 // DialogExportParameters
1184 ///////////////////////////////////////////////////////////////////////
1186 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1187 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1189 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1191 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1193 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1195 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1196 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1197 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1199 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1201 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1202 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1203 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1204 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1205 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1206 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1207 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1209 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1210 pButtonOk->SetDefault();
1212 SetAutoLayout (true);
1213 SetSizer (pTopSizer);
1214 pTopSizer->Fit (this);
1215 pTopSizer->SetSizeHints (this);
1219 DialogExportParameters::getFormatName()
1221 return m_pRadioBoxFormat->getSelectionStringValue();
1225 /////////////////////////////////////////////////////////////////////
1226 // CLASS DiaglogGetXYSize Implementation
1227 /////////////////////////////////////////////////////////////////////
1229 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1230 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1232 m_iDefaultXSize = iDefaultXSize;
1233 m_iDefaultYSize = iDefaultYSize;
1235 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1237 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1239 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1241 std::ostringstream os;
1242 os << iDefaultXSize;
1243 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1244 std::ostringstream osYSize;
1245 osYSize << iDefaultYSize;
1246 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1248 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1249 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1250 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1251 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1252 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1253 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1255 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1257 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1258 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1259 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1260 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1261 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1263 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1264 pButtonOk->SetDefault();
1266 SetAutoLayout (true);
1267 SetSizer (pTopSizer);
1268 pTopSizer->Fit (this);
1269 pTopSizer->SetSizeHints (this);
1272 DialogGetXYSize::~DialogGetXYSize ()
1277 DialogGetXYSize::getXSize ()
1279 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1281 if (strCtrl.ToLong (&lValue))
1284 return (m_iDefaultXSize);
1288 DialogGetXYSize::getYSize ()
1290 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1292 if (strCtrl.ToLong (&lValue))
1295 return (m_iDefaultYSize);
1300 /////////////////////////////////////////////////////////////////////
1301 // CLASS IDENTIFICATION
1303 // DialogGetConvertPolarParameters
1304 /////////////////////////////////////////////////////////////////////
1306 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1307 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1308 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1310 m_iDefaultXSize = iDefaultXSize;
1311 m_iDefaultYSize = iDefaultYSize;
1312 m_iDefaultZeropad = iDefaultZeropad;
1314 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1316 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1317 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1319 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1321 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1322 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1323 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1325 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1326 std::ostringstream os;
1327 os << iDefaultXSize;
1328 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1329 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1330 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1331 std::ostringstream osYSize;
1332 osYSize << iDefaultYSize;
1333 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1334 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1335 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1337 if (iDefaultZeropad >= 0) {
1338 std::ostringstream osZeropad;
1339 osZeropad << iDefaultZeropad;
1340 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1341 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1342 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1346 pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1348 pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1350 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1352 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1353 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1354 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1355 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1356 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1357 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1358 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1360 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1361 pButtonOk->SetDefault();
1362 SetAutoLayout (true);
1363 SetSizer (pTopSizer);
1364 pTopSizer->Layout();
1365 pTopSizer->Fit (this);
1366 pTopSizer->SetSizeHints (this);
1370 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1376 DialogGetConvertPolarParameters::getXSize ()
1378 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1379 unsigned long lValue;
1380 if (strCtrl.ToULong (&lValue))
1383 return (m_iDefaultXSize);
1387 DialogGetConvertPolarParameters::getYSize ()
1389 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1390 unsigned long lValue;
1391 if (strCtrl.ToULong (&lValue))
1394 return (m_iDefaultYSize);
1398 DialogGetConvertPolarParameters::getZeropad ()
1401 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1402 unsigned long lValue;
1403 if (strCtrl.ToULong (&lValue))
1406 return (m_iDefaultZeropad);
1413 DialogGetConvertPolarParameters::getInterpolationName ()
1415 return m_pRadioBoxInterpolation->getSelectionStringValue();