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.35 2001/02/16 22:31:18 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)
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 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
244 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
245 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
246 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
247 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
248 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
249 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
250 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
252 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
253 pButtonOk->SetDefault();
255 SetAutoLayout (true);
256 SetSizer (pTopSizer);
257 pTopSizer->Fit (this);
258 pTopSizer->SetSizeHints (this);
261 DialogPreferences::~DialogPreferences ()
266 DialogPreferences::getAdvancedOptions ()
268 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
272 DialogPreferences::getAskDeleteNewDocs ()
274 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
278 /////////////////////////////////////////////////////////////////////
279 // CLASS DiaglogGetMinMax Implementation
280 /////////////////////////////////////////////////////////////////////
282 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
283 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
285 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
287 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
289 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
291 std::ostringstream os;
293 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
294 std::ostringstream osMax;
295 osMax << dDefaultMax;
296 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
298 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
299 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
300 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
301 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
302 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
303 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
305 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
307 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
308 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
309 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
310 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
311 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
312 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
313 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
315 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
316 pButtonOk->SetDefault();
318 SetAutoLayout (true);
319 SetSizer (pTopSizer);
320 pTopSizer->Fit (this);
321 pTopSizer->SetSizeHints (this);
324 DialogGetMinMax::~DialogGetMinMax ()
329 DialogGetMinMax::getMinimum ()
331 wxString strCtrl = m_pTextCtrlMin->GetValue();
333 if (strCtrl.ToDouble (&dValue))
336 return (m_dDefaultMin);
340 DialogGetMinMax::getMaximum ()
342 wxString strCtrl = m_pTextCtrlMax->GetValue();
344 if (strCtrl.ToDouble (&dValue))
347 return (m_dDefaultMax);
351 /////////////////////////////////////////////////////////////////////
352 // CLASS DialogAutoScaleParameters IMPLEMENTATION
353 /////////////////////////////////////////////////////////////////////
355 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
356 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
358 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
360 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
362 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
364 wxString asTitle[] = {"Median", "Mode", "Mean"};
366 m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
367 m_pRadioBoxCenter->SetSelection (0);
368 pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
370 wxGridSizer *pGridSizer = new wxGridSizer (2);
371 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
372 std::ostringstream osDefaultFactor;
373 osDefaultFactor << dDefaultScaleFactor;
374 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
375 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
376 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
378 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
380 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
381 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
382 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
383 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
384 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
385 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
386 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
388 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
389 pButtonOk->SetDefault();
391 SetAutoLayout (true);
392 SetSizer (pTopSizer);
393 pTopSizer->Fit (this);
394 pTopSizer->SetSizeHints (this);
398 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
400 int iCenter = m_pRadioBoxCenter->GetSelection();
401 double dCenter = m_dMedian;
404 else if (iCenter == 2)
407 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
409 if (! sStddevFactor.ToDouble (&dValue)) {
410 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
413 double dHalfWidth = dValue * m_dStdDev / 2;
414 *pMin = dCenter - dHalfWidth;
415 *pMax = dCenter + dHalfWidth;
416 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
422 DialogAutoScaleParameters::getAutoScaleFactor ()
424 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
426 if (! sStddevFactor.ToDouble (&dValue)) {
427 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
435 /////////////////////////////////////////////////////////////////////
436 // CLASS IDENTIFICATION
438 // DialogGetRasterParameters
439 /////////////////////////////////////////////////////////////////////
441 DialogGetRasterParameters::DialogGetRasterParameters
442 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
443 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
445 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
447 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
449 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
451 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
452 std::ostringstream os;
454 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
455 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
456 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
457 std::ostringstream osYSize;
458 osYSize << iDefaultYSize;
459 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
460 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
461 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
462 std::ostringstream osViewRatio;
463 osViewRatio << dDefaultViewRatio;
464 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
465 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
466 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
467 std::ostringstream osNSamples;
468 osNSamples << iDefaultNSamples;
469 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
470 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
471 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
473 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
475 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
477 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
478 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
479 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
480 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
481 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
482 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
483 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
485 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
486 pButtonOk->SetDefault();
488 SetAutoLayout (true);
489 SetSizer (pTopSizer);
490 pTopSizer->Fit (this);
491 pTopSizer->SetSizeHints (this);
494 DialogGetRasterParameters::~DialogGetRasterParameters ()
500 DialogGetRasterParameters::getXSize ()
502 wxString strCtrl = m_pTextCtrlXSize->GetValue();
503 unsigned long lValue;
504 if (strCtrl.ToULong (&lValue))
507 return (m_iDefaultXSize);
511 DialogGetRasterParameters::getYSize ()
513 wxString strCtrl = m_pTextCtrlYSize->GetValue();
514 unsigned long lValue;
515 if (strCtrl.ToULong (&lValue))
518 return (m_iDefaultYSize);
522 DialogGetRasterParameters::getNSamples ()
524 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
525 unsigned long lValue;
526 if (strCtrl.ToULong (&lValue))
529 return (m_iDefaultNSamples);
533 DialogGetRasterParameters::getViewRatio ()
535 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
537 if (strCtrl.ToDouble (&dValue))
540 return (m_dDefaultViewRatio);
544 /////////////////////////////////////////////////////////////////////
545 // CLASS IDENTIFICATION
547 // DialogGetProjectionParameters
548 /////////////////////////////////////////////////////////////////////
551 DialogGetProjectionParameters::DialogGetProjectionParameters
552 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
553 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
554 double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
555 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
557 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
559 m_dDefaultRotAngle = dDefaultRotAngle;
560 m_dDefaultFocalLength = dDefaultFocalLength;
561 m_dDefaultViewRatio = dDefaultViewRatio;
562 m_dDefaultScanRatio = dDefaultScanRatio;
563 m_iDefaultNSamples = iDefaultNSamples;
564 m_iDefaultNView = iDefaultNView;
565 m_iDefaultNDet = iDefaultNDet;
566 m_iDefaultTrace = iDefaultTrace;
567 m_iDefaultGeometry = iDefaultGeometry;
569 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
571 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
573 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
574 m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
575 m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
577 pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
579 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
580 m_pRadioBoxTrace->SetSelection (iDefaultTrace);
581 pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
583 wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
584 std::ostringstream os;
586 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
587 pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
588 pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
589 std::ostringstream osNView;
590 osNView << iDefaultNView;
591 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
592 pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
593 pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
594 std::ostringstream osNSamples;
595 osNSamples << iDefaultNSamples;
596 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
597 pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
598 pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
600 pGridSizer->Add (pText1Sizer);
602 wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
603 std::ostringstream osViewRatio;
604 osViewRatio << dDefaultViewRatio;
605 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
606 pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
607 pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
608 std::ostringstream osScanRatio;
609 osScanRatio << dDefaultScanRatio;
610 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
611 pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
612 pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
613 std::ostringstream osFocalLength;
614 osFocalLength << dDefaultFocalLength;
615 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
616 pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
617 pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
619 if (theApp->getAdvancedOptions()) {
620 std::ostringstream osRotAngle;
621 osRotAngle << dDefaultRotAngle;
622 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
623 pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
624 pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
626 pGridSizer->Add (pText2Sizer);
628 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
630 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
632 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
633 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
634 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
635 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
636 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
637 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
638 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
640 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
641 pButtonOk->SetDefault();
643 SetAutoLayout (true);
644 SetSizer (pTopSizer);
645 pTopSizer->Fit (this);
646 pTopSizer->SetSizeHints (this);
649 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
655 DialogGetProjectionParameters::getNDet ()
657 wxString strCtrl = m_pTextCtrlNDet->GetValue();
658 unsigned long lValue;
659 if (strCtrl.ToULong (&lValue))
662 return (m_iDefaultNDet);
666 DialogGetProjectionParameters::getNView ()
668 wxString strCtrl = m_pTextCtrlNView->GetValue();
669 unsigned long lValue;
670 if (strCtrl.ToULong (&lValue))
673 return (m_iDefaultNView);
678 DialogGetProjectionParameters::getNSamples ()
680 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
681 unsigned long lValue;
682 if (strCtrl.ToULong (&lValue))
685 return (m_iDefaultNSamples);
689 DialogGetProjectionParameters::getRotAngle ()
691 if (theApp->getAdvancedOptions()) {
692 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
694 if (strCtrl.ToDouble (&dValue))
695 return (dValue * PI);
697 return (m_dDefaultRotAngle);
699 if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
700 Scanner::GEOMETRY_PARALLEL)
708 DialogGetProjectionParameters::getFocalLengthRatio ()
710 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
712 if (strCtrl.ToDouble (&dValue))
715 return (m_dDefaultFocalLength);
719 DialogGetProjectionParameters::getViewRatio ()
721 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
723 if (strCtrl.ToDouble (&dValue))
726 return (m_dDefaultViewRatio);
730 DialogGetProjectionParameters::getScanRatio ()
732 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
734 if (strCtrl.ToDouble (&dValue))
737 return (m_dDefaultScanRatio);
741 DialogGetProjectionParameters::getGeometry ()
743 return m_pRadioBoxGeometry->getSelectionStringValue();
747 DialogGetProjectionParameters::getTrace ()
749 return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
754 /////////////////////////////////////////////////////////////////////
755 // CLASS IDENTIFICATION
757 // DialogGetReconstructionParameters
758 /////////////////////////////////////////////////////////////////////
761 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
762 int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
763 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
764 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
765 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
767 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
769 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
770 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
772 wxFlexGridSizer* pGridSizer = NULL;
773 if (theApp->getAdvancedOptions())
774 pGridSizer = new wxFlexGridSizer (4);
776 pGridSizer = new wxFlexGridSizer (3);
778 if (theApp->getAdvancedOptions())
779 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
781 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
782 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
783 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
785 if (theApp->getAdvancedOptions()) {
786 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
787 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
788 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
791 static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
792 static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
794 static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
795 static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
797 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
799 m_pRadioBoxFilterMethod->SetSelection (1);
801 m_pRadioBoxFilterMethod->SetSelection (0);
803 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
806 if (theApp->getAdvancedOptions()) {
807 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
808 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
809 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
811 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
812 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
813 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
816 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
817 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
818 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
820 static const char* aszTraceTitle[] = {"None", "Full"};
821 static const char* aszTraceName[] = {"none", "full"};
822 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
823 iTrace = clamp(iTrace, 0, 1);
824 m_pRadioBoxTrace->SetSelection (iTrace);
825 pGridSizer->Add (m_pRadioBoxTrace);
827 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
828 std::ostringstream os;
830 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
831 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
832 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
833 std::ostringstream osYSize;
834 osYSize << iDefaultYSize;
835 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
836 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
837 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
839 std::ostringstream osHammingParam;
840 osHammingParam << dDefaultHammingParam;
841 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
842 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
843 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
845 if (theApp->getAdvancedOptions()) {
846 std::ostringstream osZeropad;
847 osZeropad << iDefaultZeropad;
848 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
849 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
850 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
852 pGridSizer->Add (pTextGridSizer);
854 #if HAVE_FREQ_PREINTERP
855 std::ostringstream osInterpParam;
856 osInterpParam << iDefaultInterpParam;
857 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
858 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
859 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
862 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
864 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
866 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
867 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
868 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
869 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
870 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
871 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
872 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
874 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
875 pButtonOk->SetDefault();
877 SetAutoLayout (true);
878 SetSizer (pTopSizer);
880 pTopSizer->Fit (this);
881 pTopSizer->SetSizeHints (this);
884 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
890 DialogGetReconstructionParameters::getXSize ()
892 wxString strCtrl = m_pTextCtrlXSize->GetValue();
893 unsigned long lValue;
894 if (strCtrl.ToULong (&lValue))
897 return (m_iDefaultXSize);
901 DialogGetReconstructionParameters::getYSize ()
903 wxString strCtrl = m_pTextCtrlYSize->GetValue();
904 unsigned long lValue;
905 if (strCtrl.ToULong (&lValue))
908 return (m_iDefaultYSize);
912 DialogGetReconstructionParameters::getZeropad ()
914 if (theApp->getAdvancedOptions()) {
915 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
916 unsigned long lValue;
917 if (strCtrl.ToULong (&lValue))
920 return (m_iDefaultZeropad);
927 DialogGetReconstructionParameters::getInterpParam ()
929 #if HAVE_FREQ_PREINTERP
930 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
931 unsigned long lValue;
932 if (strCtrl.ToULong (&lValue))
935 return (m_iDefaultInterpParam);
942 DialogGetReconstructionParameters::getFilterParam ()
944 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
946 if (strCtrl.ToDouble (&dValue))
949 return (m_dDefaultFilterParam);
953 DialogGetReconstructionParameters::getFilterName ()
955 return m_pRadioBoxFilter->getSelectionStringValue();
959 DialogGetReconstructionParameters::getFilterMethodName ()
961 return m_pRadioBoxFilterMethod->getSelectionStringValue();
965 DialogGetReconstructionParameters::getInterpName ()
967 return m_pRadioBoxInterp->getSelectionStringValue();
971 DialogGetReconstructionParameters::getTrace ()
974 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
975 iTrace = Trace::TRACE_PLOT;
980 DialogGetReconstructionParameters::getBackprojectName ()
982 if (theApp->getAdvancedOptions()) {
983 return m_pRadioBoxBackproject->getSelectionStringValue();
989 DialogGetReconstructionParameters::getFilterGenerationName ()
991 if (theApp->getAdvancedOptions()) {
992 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
994 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
995 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
998 return "inverse-fourier";
1003 /////////////////////////////////////////////////////////////////////
1004 // CLASS IDENTIFICATION
1006 // DialogGetFilterParameters
1007 /////////////////////////////////////////////////////////////////////
1011 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1012 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1014 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1016 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1017 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1019 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1021 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1022 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1023 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1025 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1026 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1027 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1029 std::ostringstream os;
1030 os << iDefaultXSize;
1031 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1032 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1033 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1035 std::ostringstream osYSize;
1036 osYSize << iDefaultYSize;
1037 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1038 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1039 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1041 std::ostringstream osFilterParam;
1042 osFilterParam << dDefaultFilterParam;
1043 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1044 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1045 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1047 std::ostringstream osBandwidth;
1048 osBandwidth << dDefaultBandwidth;
1049 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1050 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1051 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1053 std::ostringstream osInputScale;
1054 osInputScale << dDefaultInputScale;
1055 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1056 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1057 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1059 std::ostringstream osOutputScale;
1060 osOutputScale << dDefaultOutputScale;
1061 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1062 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1063 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1065 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1067 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1069 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1070 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1071 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1072 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1073 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1074 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1075 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1077 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1078 pButtonOk->SetDefault();
1080 SetAutoLayout (true);
1081 SetSizer (pTopSizer);
1082 pTopSizer->Layout();
1083 pTopSizer->Fit (this);
1084 pTopSizer->SetSizeHints (this);
1087 DialogGetFilterParameters::~DialogGetFilterParameters ()
1093 DialogGetFilterParameters::getXSize ()
1095 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1096 unsigned long lValue;
1097 if (strCtrl.ToULong (&lValue))
1100 return (m_iDefaultXSize);
1104 DialogGetFilterParameters::getYSize ()
1106 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1107 unsigned long lValue;
1108 if (strCtrl.ToULong (&lValue))
1111 return (m_iDefaultYSize);
1115 DialogGetFilterParameters::getBandwidth ()
1117 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1119 if (strCtrl.ToDouble (&dValue))
1122 return (m_dDefaultBandwidth);
1126 DialogGetFilterParameters::getFilterParam ()
1128 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1130 if (strCtrl.ToDouble (&dValue))
1133 return (m_dDefaultFilterParam);
1137 DialogGetFilterParameters::getInputScale ()
1139 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1141 if (strCtrl.ToDouble (&dValue))
1144 return (m_dDefaultInputScale);
1148 DialogGetFilterParameters::getOutputScale ()
1150 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1152 if (strCtrl.ToDouble (&dValue))
1155 return (m_dDefaultOutputScale);
1159 DialogGetFilterParameters::getFilterName ()
1161 return m_pRadioBoxFilter->getSelectionStringValue();
1165 DialogGetFilterParameters::getDomainName ()
1167 return m_pRadioBoxDomain->getSelectionStringValue();
1171 ///////////////////////////////////////////////////////////////////////
1172 // CLASS IMPLEMENTATION
1173 // DialogExportParameters
1174 ///////////////////////////////////////////////////////////////////////
1176 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1177 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1179 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1181 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1183 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1185 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1186 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1187 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1189 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1191 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1192 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1193 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1194 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1195 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1196 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1197 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1199 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1200 pButtonOk->SetDefault();
1202 SetAutoLayout (true);
1203 SetSizer (pTopSizer);
1204 pTopSizer->Fit (this);
1205 pTopSizer->SetSizeHints (this);
1209 DialogExportParameters::getFormatName()
1211 return m_pRadioBoxFormat->getSelectionStringValue();
1215 /////////////////////////////////////////////////////////////////////
1216 // CLASS DiaglogGetXYSize Implementation
1217 /////////////////////////////////////////////////////////////////////
1219 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1220 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1222 m_iDefaultXSize = iDefaultXSize;
1223 m_iDefaultYSize = iDefaultYSize;
1225 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1227 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1229 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1231 std::ostringstream os;
1232 os << iDefaultXSize;
1233 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1234 std::ostringstream osYSize;
1235 osYSize << iDefaultYSize;
1236 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1238 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1239 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1240 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1241 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1242 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1243 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1245 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1247 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1248 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1249 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1250 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1251 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1253 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1254 pButtonOk->SetDefault();
1256 SetAutoLayout (true);
1257 SetSizer (pTopSizer);
1258 pTopSizer->Fit (this);
1259 pTopSizer->SetSizeHints (this);
1262 DialogGetXYSize::~DialogGetXYSize ()
1267 DialogGetXYSize::getXSize ()
1269 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1271 if (strCtrl.ToLong (&lValue))
1274 return (m_iDefaultXSize);
1278 DialogGetXYSize::getYSize ()
1280 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1282 if (strCtrl.ToLong (&lValue))
1285 return (m_iDefaultYSize);
1290 /////////////////////////////////////////////////////////////////////
1291 // CLASS IDENTIFICATION
1293 // DialogGetConvertPolarParameters
1294 /////////////////////////////////////////////////////////////////////
1296 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1297 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1298 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1300 m_iDefaultXSize = iDefaultXSize;
1301 m_iDefaultYSize = iDefaultYSize;
1302 m_iDefaultZeropad = iDefaultZeropad;
1304 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1306 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1308 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1310 std::ostringstream os;
1311 os << iDefaultXSize;
1312 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1313 std::ostringstream osYSize;
1314 osYSize << iDefaultYSize;
1315 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1317 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1319 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1320 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1321 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1323 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1324 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1325 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1326 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1327 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1328 if (iDefaultZeropad >= 0) {
1329 std::ostringstream osZeropad;
1330 osZeropad << iDefaultZeropad;
1331 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1332 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1333 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1336 pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1338 pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1340 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1342 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1343 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1344 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1345 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1346 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1347 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1348 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1350 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1351 pButtonOk->SetDefault();
1352 SetAutoLayout (true);
1353 SetSizer (pTopSizer);
1354 pTopSizer->Layout();
1355 pTopSizer->Fit (this);
1356 pTopSizer->SetSizeHints (this);
1360 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1366 DialogGetConvertPolarParameters::getXSize ()
1368 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1369 unsigned long lValue;
1370 if (strCtrl.ToULong (&lValue))
1373 return (m_iDefaultXSize);
1377 DialogGetConvertPolarParameters::getYSize ()
1379 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1380 unsigned long lValue;
1381 if (strCtrl.ToULong (&lValue))
1384 return (m_iDefaultYSize);
1388 DialogGetConvertPolarParameters::getZeropad ()
1390 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1391 unsigned long lValue;
1392 if (strCtrl.ToULong (&lValue))
1395 return (m_iDefaultZeropad);
1399 DialogGetConvertPolarParameters::getInterpolationName ()
1401 return m_pRadioBoxInterpolation->getSelectionStringValue();