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.57 2002/05/03 09:57:41 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
29 // #pragma implementation
32 #include "wx/wxprec.h"
38 #if !wxUSE_DOC_VIEW_ARCHITECTURE
39 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
42 #include "wx/statline.h"
49 #include "imagefile.h"
50 #include "projections.h"
52 #if defined(MSVC) || HAVE_SSTREAM
55 #include <sstream_subst>
59 ///////////////////////////////////////////////////////////////////////
60 // CLASS IMPLEMENTATION
61 // StringValueAndTitleListBox
62 ///////////////////////////////////////////////////////////////////////
64 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[])
67 wxString* psTitle = new wxString [nChoices];
68 for (int i = 0; i < nChoices; i++)
69 psTitle[i] = aszTitle[i];
71 Create (pParent, -1, wxDefaultPosition, wxSize(-1,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
73 m_ppszValues = aszValue;
78 StringValueAndTitleListBox::getSelectionStringValue () const
80 return m_ppszValues[GetSelection()];
83 StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[])
86 wxString* psTitle = new wxString [nChoices];
87 for (int i = 0; i < nChoices; i++)
88 psTitle[i] = aszTitle[i];
90 Create (pParent, -1, strTitle, wxDefaultPosition, wxDefaultSize, nChoices, psTitle, 1, wxRA_SPECIFY_COLS);
92 m_ppszValues = aszValue;
97 StringValueAndTitleRadioBox::getSelectionStringValue () const
99 return m_ppszValues[GetSelection()];
102 ///////////////////////////////////////////////////////////////////////
103 // CLASS IMPLEMENTATION
105 ///////////////////////////////////////////////////////////////////////
107 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
108 : wxDialog (pParent, -1, _T("Select Phantom"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
110 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
112 pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxCENTER | wxALL, 5);
114 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
116 m_pRadioBoxPhantom = new StringValueAndTitleRadioBox (this, _T("Phantom"), Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
117 m_pRadioBoxPhantom->SetSelection (iDefaultPhantom);
118 pTopSizer->Add (m_pRadioBoxPhantom, 0, wxALL | wxALIGN_CENTER);
120 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
122 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
123 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
124 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
125 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
126 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
127 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PHANTOM);
128 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
130 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
131 pButtonOk->SetDefault();
133 SetAutoLayout (true);
134 SetSizer (pTopSizer);
135 pTopSizer->Fit (this);
136 pTopSizer->SetSizeHints (this);
140 DialogGetPhantom::getPhantom()
142 return m_pRadioBoxPhantom->getSelectionStringValue();
146 ///////////////////////////////////////////////////////////////////////
147 // CLASS IMPLEMENTATION
148 // DialogGetThetaRange
149 ///////////////////////////////////////////////////////////////////////
151 DialogGetThetaRange::DialogGetThetaRange (wxWindow* pParent, int iDefaultThetaRange)
152 : wxDialog (pParent, -1, _T("Select Phantom"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
154 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
156 pTopSizer->Add (new wxStaticText (this, -1, "Select Theta Range"), 0, wxCENTER | wxALL, 5);
158 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
160 wxString asTitle[] = {"Unconstrained", "Normalized to 2pi", "Fold to pi"};
162 m_pRadioBoxThetaRange = new wxRadioBox (this, -1, _T("Theta Range"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
163 if (iDefaultThetaRange == ParallelRaysums::THETA_RANGE_UNCONSTRAINED)
164 m_pRadioBoxThetaRange->SetSelection (0);
165 else if (iDefaultThetaRange == ParallelRaysums::THETA_RANGE_NORMALIZE_TO_TWOPI)
166 m_pRadioBoxThetaRange->SetSelection (1);
167 else if (iDefaultThetaRange == ParallelRaysums::THETA_RANGE_FOLD_TO_PI)
168 m_pRadioBoxThetaRange->SetSelection (2);
170 pTopSizer->Add (m_pRadioBoxThetaRange, 0, wxALL | wxALIGN_CENTER);
172 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
174 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
175 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
176 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
177 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
178 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
179 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_THETA_RANGE);
180 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
182 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
183 pButtonOk->SetDefault();
185 SetAutoLayout (true);
186 SetSizer (pTopSizer);
187 pTopSizer->Fit (this);
188 pTopSizer->SetSizeHints (this);
192 DialogGetThetaRange::getThetaRange()
194 int iSelection = m_pRadioBoxThetaRange->GetSelection();
196 return ParallelRaysums::THETA_RANGE_UNCONSTRAINED;
197 else if (iSelection == 1)
198 return ParallelRaysums::THETA_RANGE_NORMALIZE_TO_TWOPI;
200 return ParallelRaysums::THETA_RANGE_FOLD_TO_PI;
204 ///////////////////////////////////////////////////////////////////////
205 // CLASS IMPLEMENTATION
206 // DialogGetComparisonImage
207 ///////////////////////////////////////////////////////////////////////
209 DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
210 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
212 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
214 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
216 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
218 int iNImages = m_rVecIF.size();
219 wxString* pstrImages = new wxString [iNImages];
220 for (int i = 0; i < iNImages; i++) {
221 ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
223 pstrImages[i] = pView->getFrame()->GetTitle();
226 m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
227 delete [] pstrImages;
229 m_pListBoxImageChoices->SetSelection (0);
230 pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
232 if (bShowMakeDifference) {
233 m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
234 m_pMakeDifferenceImage->SetValue (FALSE);
235 pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
237 m_pMakeDifferenceImage = NULL;
239 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
241 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
242 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
243 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
244 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
245 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
246 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_COMPARISON);
247 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
249 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
250 pButtonOk->SetDefault();
252 SetAutoLayout (true);
253 SetSizer (pTopSizer);
254 pTopSizer->Fit (this);
255 pTopSizer->SetSizeHints (this);
259 DialogGetComparisonImage::getImageFileDocument()
261 return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
265 DialogGetComparisonImage::getMakeDifferenceImage()
267 if (m_pMakeDifferenceImage)
268 return m_pMakeDifferenceImage->GetValue();
274 /////////////////////////////////////////////////////////////////////
275 // CLASS DiaglogPreferences Implementation
276 /////////////////////////////////////////////////////////////////////
278 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle,
279 bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips, bool bUseBackgroundTasks)
280 : wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
282 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
284 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
286 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
288 m_pCBAdvancedOptions = new wxCheckBox (this, -1, "Advanced Options", wxDefaultPosition, wxSize(250, 25), 0);
289 m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
290 pTopSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
292 m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "Ask \"Save New Documents\" Before Closing", wxDefaultPosition, wxSize(250, 25), 0);
293 m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
294 pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
296 m_pCBVerboseLogging = new wxCheckBox (this, -1, "Verbose Logging", wxDefaultPosition, wxSize(250, 25), 0);
297 m_pCBVerboseLogging->SetValue (bVerboseLogging);
298 pTopSizer->Add (m_pCBVerboseLogging, 0, wxALIGN_CENTER_VERTICAL);
300 m_pCBStartupTips = new wxCheckBox (this, -1, "Show Tips at Start", wxDefaultPosition, wxSize(250, 25), 0);
301 m_pCBStartupTips->SetValue (bStartupTips);
302 pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL);
304 #if HAVE_WXTHREADS && MSVC
305 m_pCBUseBackgroundTasks = new wxCheckBox (this, -1, "Put Tasks in Background", wxDefaultPosition, wxSize(250, 25), 0);
306 m_pCBUseBackgroundTasks->SetValue (bUseBackgroundTasks);
307 pTopSizer->Add (m_pCBUseBackgroundTasks, 0, wxALIGN_CENTER_VERTICAL);
310 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
312 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
313 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
314 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
315 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
316 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
317 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
318 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
320 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
321 pButtonOk->SetDefault();
323 SetAutoLayout (true);
324 SetSizer (pTopSizer);
325 pTopSizer->Fit (this);
326 pTopSizer->SetSizeHints (this);
329 DialogPreferences::~DialogPreferences ()
334 DialogPreferences::getAdvancedOptions ()
336 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
340 DialogPreferences::getAskDeleteNewDocs ()
342 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
346 DialogPreferences::getVerboseLogging ()
348 return static_cast<bool>(m_pCBVerboseLogging->GetValue());
352 DialogPreferences::getStartupTips ()
354 return static_cast<bool>(m_pCBStartupTips->GetValue());
358 DialogPreferences::getUseBackgroundTasks ()
360 #if HAVE_WXTHREADS && MSVC
361 return static_cast<bool>(m_pCBUseBackgroundTasks->GetValue());
368 /////////////////////////////////////////////////////////////////////
369 // CLASS DiaglogGetMinMax Implementation
370 /////////////////////////////////////////////////////////////////////
372 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
373 : wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
375 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
377 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
379 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
381 std::ostringstream os;
383 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
384 std::ostringstream osMax;
385 osMax << dDefaultMax;
386 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
388 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
389 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
390 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
391 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
392 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
393 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
395 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
397 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
398 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
399 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
400 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
401 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
402 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
403 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
405 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
406 pButtonOk->SetDefault();
408 SetAutoLayout (true);
409 SetSizer (pTopSizer);
410 pTopSizer->Fit (this);
411 pTopSizer->SetSizeHints (this);
414 DialogGetMinMax::~DialogGetMinMax ()
419 DialogGetMinMax::getMinimum ()
421 wxString strCtrl = m_pTextCtrlMin->GetValue();
423 if (strCtrl.ToDouble (&dValue))
426 return (m_dDefaultMin);
430 DialogGetMinMax::getMaximum ()
432 wxString strCtrl = m_pTextCtrlMax->GetValue();
434 if (strCtrl.ToDouble (&dValue))
437 return (m_dDefaultMax);
441 /////////////////////////////////////////////////////////////////////
442 // CLASS DialogAutoScaleParameters IMPLEMENTATION
443 /////////////////////////////////////////////////////////////////////
445 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
446 : wxDialog (pParent, -1, _T("Auto Scale Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
448 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
450 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
452 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
454 wxString asTitle[] = {"Mode", "Median", "Mean"};
456 m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
457 m_pRadioBoxCenter->SetSelection (0);
458 pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
460 wxGridSizer *pGridSizer = new wxGridSizer (2);
461 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
462 std::ostringstream osDefaultFactor;
463 osDefaultFactor << dDefaultScaleFactor;
464 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
465 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
466 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
468 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
470 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
471 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
472 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
473 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
474 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
475 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
476 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
478 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
479 pButtonOk->SetDefault();
481 SetAutoLayout (true);
482 SetSizer (pTopSizer);
483 pTopSizer->Fit (this);
484 pTopSizer->SetSizeHints (this);
488 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
490 int iCenter = m_pRadioBoxCenter->GetSelection();
491 double dCenter = m_dMode;
494 else if (iCenter == 2)
497 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
499 if (! sStddevFactor.ToDouble (&dValue)) {
500 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
503 double dHalfWidth = dValue * m_dStdDev / 2;
504 *pMin = dCenter - dHalfWidth;
505 *pMax = dCenter + dHalfWidth;
506 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
512 DialogAutoScaleParameters::getAutoScaleFactor ()
514 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
516 if (! sStddevFactor.ToDouble (&dValue)) {
517 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
525 /////////////////////////////////////////////////////////////////////
526 // CLASS IDENTIFICATION
528 // DialogGetRasterParameters
529 /////////////////////////////////////////////////////////////////////
531 DialogGetRasterParameters::DialogGetRasterParameters
532 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
533 : wxDialog (pParent, -1, _T("Rasterization Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
535 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
537 pTopSizer->Add (new wxStaticText (this, -1, "Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
539 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
541 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
542 std::ostringstream os;
544 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
545 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
546 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
547 std::ostringstream osYSize;
548 osYSize << iDefaultYSize;
549 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
550 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
551 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
552 std::ostringstream osViewRatio;
553 osViewRatio << dDefaultViewRatio;
554 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
555 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
556 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
557 std::ostringstream osNSamples;
558 osNSamples << iDefaultNSamples;
559 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
560 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
561 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
563 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
565 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
567 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
568 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
569 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
570 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
571 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
572 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
573 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
575 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
576 pButtonOk->SetDefault();
578 SetAutoLayout (true);
579 SetSizer (pTopSizer);
580 pTopSizer->Fit (this);
581 pTopSizer->SetSizeHints (this);
584 DialogGetRasterParameters::~DialogGetRasterParameters ()
590 DialogGetRasterParameters::getXSize ()
592 wxString strCtrl = m_pTextCtrlXSize->GetValue();
593 unsigned long lValue;
594 if (strCtrl.ToULong (&lValue))
597 return (m_iDefaultXSize);
601 DialogGetRasterParameters::getYSize ()
603 wxString strCtrl = m_pTextCtrlYSize->GetValue();
604 unsigned long lValue;
605 if (strCtrl.ToULong (&lValue))
608 return (m_iDefaultYSize);
612 DialogGetRasterParameters::getNSamples ()
614 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
615 unsigned long lValue;
616 if (strCtrl.ToULong (&lValue))
619 return (m_iDefaultNSamples);
623 DialogGetRasterParameters::getViewRatio ()
625 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
627 if (strCtrl.ToDouble (&dValue))
630 return (m_dDefaultViewRatio);
634 /////////////////////////////////////////////////////////////////////
635 // CLASS IDENTIFICATION
637 // DialogGetProjectionParameters
638 /////////////////////////////////////////////////////////////////////
641 DialogGetProjectionParameters::DialogGetProjectionParameters
642 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultOffsetView, int iDefaultNSamples,
643 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultCenterDetectorLength,
644 double dDefaultViewRatio, double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
645 : wxDialog (pParent, -1, _T("Projection Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
647 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
649 m_dDefaultRotAngle = dDefaultRotAngle;
650 m_dDefaultFocalLength = dDefaultFocalLength;
651 m_dDefaultCenterDetectorLength = dDefaultCenterDetectorLength;
652 m_dDefaultViewRatio = dDefaultViewRatio;
653 m_dDefaultScanRatio = dDefaultScanRatio;
654 m_iDefaultNSamples = iDefaultNSamples;
655 m_iDefaultNView = iDefaultNView;
656 m_iDefaultNDet = iDefaultNDet;
657 m_iDefaultTrace = iDefaultTrace;
658 m_iDefaultGeometry = iDefaultGeometry;
660 pTopSizer->Add (new wxStaticText (this, -1, "Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
662 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
664 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
665 m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
666 m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
668 pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
670 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
671 m_pRadioBoxTrace->SetSelection (iDefaultTrace);
672 pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
674 wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
675 std::ostringstream os;
677 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
678 pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
679 pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
680 std::ostringstream osNView;
681 osNView << iDefaultNView;
682 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
683 pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
684 pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
685 std::ostringstream osNSamples;
686 osNSamples << iDefaultNSamples;
687 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
688 pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
689 pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
691 pGridSizer->Add (pText1Sizer);
693 wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
694 std::ostringstream osViewRatio;
695 osViewRatio << dDefaultViewRatio;
696 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
697 pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
698 pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
699 std::ostringstream osScanRatio;
700 osScanRatio << dDefaultScanRatio;
701 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
702 pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
703 pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
704 std::ostringstream osFocalLength;
705 osFocalLength << dDefaultFocalLength;
706 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
707 pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
708 pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
710 if (theApp->getAdvancedOptions()) {
711 std::ostringstream osCenterDetectorLength;
712 osCenterDetectorLength << dDefaultCenterDetectorLength;
713 m_pTextCtrlCenterDetectorLength = new wxTextCtrl (this, -1, osCenterDetectorLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
714 pText2Sizer->Add (new wxStaticText (this, -1, "Center-Detector Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
715 pText2Sizer->Add (m_pTextCtrlCenterDetectorLength, 0, wxALIGN_CENTER_VERTICAL);
717 std::ostringstream osRotAngle;
718 osRotAngle << dDefaultRotAngle;
719 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
720 pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
721 pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
723 std::ostringstream osOffsetView;
724 osOffsetView << iDefaultOffsetView;
725 m_pTextCtrlOffsetView = new wxTextCtrl (this, -1, osOffsetView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
726 pText2Sizer->Add (new wxStaticText (this, -1, "Gantry offset in units of 'views' "), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
727 pText2Sizer->Add (m_pTextCtrlOffsetView, 0, wxALIGN_CENTER_VERTICAL);
730 pGridSizer->Add (pText2Sizer);
732 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
734 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
736 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
737 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
738 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
739 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
740 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
741 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
742 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
744 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
745 pButtonOk->SetDefault();
747 SetAutoLayout (true);
748 SetSizer (pTopSizer);
749 pTopSizer->Fit (this);
750 pTopSizer->SetSizeHints (this);
752 m_pRadioBoxGeometry->SetFocus();
755 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
761 DialogGetProjectionParameters::getNDet ()
763 wxString strCtrl = m_pTextCtrlNDet->GetValue();
764 unsigned long lValue;
765 if (strCtrl.ToULong (&lValue))
768 return (m_iDefaultNDet);
772 DialogGetProjectionParameters::getNView ()
774 wxString strCtrl = m_pTextCtrlNView->GetValue();
775 unsigned long lValue;
776 if (strCtrl.ToULong (&lValue))
779 return (m_iDefaultNView);
783 DialogGetProjectionParameters::getOffsetView ()
785 if (theApp->getAdvancedOptions()) {
786 wxString strCtrl = m_pTextCtrlOffsetView->GetValue();
787 unsigned long lValue;
788 if (strCtrl.ToULong (&lValue))
791 return (m_iDefaultOffsetView);
798 DialogGetProjectionParameters::getNSamples ()
800 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
801 unsigned long lValue;
802 if (strCtrl.ToULong (&lValue))
805 return (m_iDefaultNSamples);
809 DialogGetProjectionParameters::getRotAngle ()
811 if (theApp->getAdvancedOptions()) {
812 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
814 if (strCtrl.ToDouble (&dValue))
815 return (dValue * TWOPI);
817 return (m_dDefaultRotAngle);
819 if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
820 Scanner::GEOMETRY_PARALLEL)
828 DialogGetProjectionParameters::getFocalLengthRatio ()
830 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
832 if (strCtrl.ToDouble (&dValue))
835 return (m_dDefaultFocalLength);
839 DialogGetProjectionParameters::getCenterDetectorLengthRatio ()
841 if (theApp->getAdvancedOptions()) {
842 wxString strCtrl = m_pTextCtrlCenterDetectorLength->GetValue();
844 if (strCtrl.ToDouble (&dValue))
847 return (m_dDefaultCenterDetectorLength);
849 return getFocalLengthRatio(); // default is to set equal to focal-length
853 DialogGetProjectionParameters::getViewRatio ()
855 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
857 if (strCtrl.ToDouble (&dValue))
860 return (m_dDefaultViewRatio);
864 DialogGetProjectionParameters::getScanRatio ()
866 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
868 if (strCtrl.ToDouble (&dValue))
871 return (m_dDefaultScanRatio);
875 DialogGetProjectionParameters::getGeometry ()
877 return m_pRadioBoxGeometry->getSelectionStringValue();
881 DialogGetProjectionParameters::getTrace ()
883 return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
888 /////////////////////////////////////////////////////////////////////
889 // CLASS IDENTIFICATION
891 // DialogGetReconstructionParameters
892 /////////////////////////////////////////////////////////////////////
895 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
896 int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
897 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
898 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace,
899 ReconstructionROI* pDefaultROI)
900 : wxDialog (pParent, -1, _T("Reconstruction Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
902 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
904 m_iDefaultXSize = iDefaultXSize;
905 m_iDefaultYSize = iDefaultYSize;
906 m_dDefaultFilterParam = dDefaultHammingParam;
907 m_iDefaultZeropad = iDefaultZeropad;
908 m_iDefaultInterpParam = iDefaultInterpParam;
909 m_dDefaultRoiXMin = pDefaultROI->m_dXMin;
910 m_dDefaultRoiXMax = pDefaultROI->m_dXMax;
911 m_dDefaultRoiYMin = pDefaultROI->m_dYMin;
912 m_dDefaultRoiYMax = pDefaultROI->m_dYMax;
914 pTopSizer->Add (new wxStaticText (this, -1, "Filtered Backprojection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
915 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
917 wxFlexGridSizer* pGridSizer = NULL;
918 if (theApp->getAdvancedOptions())
919 pGridSizer = new wxFlexGridSizer (4);
921 pGridSizer = new wxFlexGridSizer (3);
923 if (theApp->getAdvancedOptions())
924 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
926 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
927 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
928 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
930 if (theApp->getAdvancedOptions()) {
931 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
932 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
933 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
936 static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
937 static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
939 static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
940 static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
942 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
944 m_pRadioBoxFilterMethod->SetSelection (1);
946 m_pRadioBoxFilterMethod->SetSelection (0);
948 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
951 if (theApp->getAdvancedOptions()) {
952 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
953 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
954 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
956 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
957 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
958 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
961 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
962 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
963 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
965 static const char* aszTraceTitle[] = {"None", "Full"};
966 static const char* aszTraceName[] = {"none", "full"};
967 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
968 iTrace = clamp(iTrace, 0, 1);
969 m_pRadioBoxTrace->SetSelection (iTrace);
970 pGridSizer->Add (m_pRadioBoxTrace);
972 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
973 std::ostringstream os;
975 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
976 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
977 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
978 std::ostringstream osYSize;
979 osYSize << iDefaultYSize;
980 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
981 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
982 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
984 std::ostringstream osHammingParam;
985 osHammingParam << dDefaultHammingParam;
986 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
987 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
988 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
990 if (theApp->getAdvancedOptions()) {
991 std::ostringstream osZeropad;
992 osZeropad << iDefaultZeropad;
993 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
994 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
995 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
997 pGridSizer->Add (pTextGridSizer);
999 #if HAVE_FREQ_PREINTERP
1000 std::ostringstream osInterpParam;
1001 osInterpParam << iDefaultInterpParam;
1002 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1003 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1004 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1007 if (theApp->getAdvancedOptions()) {
1008 wxFlexGridSizer* pROIGridSizer = new wxFlexGridSizer (2);
1009 std::ostringstream osRoiXMin;
1010 osRoiXMin << m_dDefaultRoiXMin;
1011 m_pTextCtrlRoiXMin = new wxTextCtrl (this, -1, osRoiXMin.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1012 pROIGridSizer->Add (new wxStaticText (this, -1, "ROI XMin"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1013 pROIGridSizer->Add (m_pTextCtrlRoiXMin, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1014 std::ostringstream osRoiXMax;
1015 osRoiXMax << m_dDefaultRoiXMax;
1016 m_pTextCtrlRoiXMax = new wxTextCtrl (this, -1, osRoiXMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1017 pROIGridSizer->Add (new wxStaticText (this, -1, "ROI XMax"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1018 pROIGridSizer->Add (m_pTextCtrlRoiXMax, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1019 std::ostringstream osRoiYMin;
1020 osRoiYMin << m_dDefaultRoiYMin;
1021 m_pTextCtrlRoiYMin = new wxTextCtrl (this, -1, osRoiYMin.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1022 pROIGridSizer->Add (new wxStaticText (this, -1, "ROI YMin"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1023 pROIGridSizer->Add (m_pTextCtrlRoiYMin, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1024 std::ostringstream osRoiYMax;
1025 osRoiYMax << m_dDefaultRoiYMax;
1026 m_pTextCtrlRoiYMax = new wxTextCtrl (this, -1, osRoiYMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1027 pROIGridSizer->Add (new wxStaticText (this, -1, "ROI YMax"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1028 pROIGridSizer->Add (m_pTextCtrlRoiYMax, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1030 pGridSizer->Add (pROIGridSizer);
1033 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1035 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1037 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1038 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1039 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1040 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1041 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1042 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
1043 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1045 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1046 pButtonOk->SetDefault();
1048 SetAutoLayout (true);
1049 SetSizer (pTopSizer);
1050 pTopSizer->Layout();
1051 pTopSizer->Fit (this);
1052 pTopSizer->SetSizeHints (this);
1055 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
1061 DialogGetReconstructionParameters::getXSize ()
1063 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1064 unsigned long lValue;
1065 if (strCtrl.ToULong (&lValue))
1068 return (m_iDefaultXSize);
1072 DialogGetReconstructionParameters::getYSize ()
1074 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1075 unsigned long lValue;
1076 if (strCtrl.ToULong (&lValue))
1079 return (m_iDefaultYSize);
1083 DialogGetReconstructionParameters::getZeropad ()
1085 if (theApp->getAdvancedOptions()) {
1086 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1087 unsigned long lValue;
1088 if (strCtrl.ToULong (&lValue))
1091 return (m_iDefaultZeropad);
1098 DialogGetReconstructionParameters::getInterpParam ()
1100 #if HAVE_FREQ_PREINTERP
1101 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
1102 unsigned long lValue;
1103 if (strCtrl.ToULong (&lValue))
1106 return (m_iDefaultInterpParam);
1113 DialogGetReconstructionParameters::getFilterParam ()
1115 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1117 if (strCtrl.ToDouble (&dValue))
1120 return (m_dDefaultFilterParam);
1124 DialogGetReconstructionParameters::getFilterName ()
1126 return m_pRadioBoxFilter->getSelectionStringValue();
1130 DialogGetReconstructionParameters::getFilterMethodName ()
1132 return m_pRadioBoxFilterMethod->getSelectionStringValue();
1136 DialogGetReconstructionParameters::getInterpName ()
1138 return m_pRadioBoxInterp->getSelectionStringValue();
1142 DialogGetReconstructionParameters::getTrace ()
1145 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
1146 iTrace = Trace::TRACE_PLOT;
1151 DialogGetReconstructionParameters::getBackprojectName ()
1153 if (theApp->getAdvancedOptions()) {
1154 return m_pRadioBoxBackproject->getSelectionStringValue();
1160 DialogGetReconstructionParameters::getFilterGenerationName ()
1162 if (theApp->getAdvancedOptions()) {
1163 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
1165 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
1166 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
1169 return "inverse-fourier";
1174 DialogGetReconstructionParameters::getROI (ReconstructionROI* pROI)
1176 if (theApp->getAdvancedOptions()) {
1178 if (m_pTextCtrlRoiXMin->GetValue().ToDouble (&dValue))
1179 pROI->m_dXMin = dValue;
1181 pROI->m_dXMin = m_dDefaultRoiXMin;
1183 if (m_pTextCtrlRoiXMax->GetValue().ToDouble (&dValue))
1184 pROI->m_dXMax = dValue;
1186 pROI->m_dXMax = m_dDefaultRoiXMax;
1188 if (m_pTextCtrlRoiYMin->GetValue().ToDouble (&dValue))
1189 pROI->m_dYMin = dValue;
1191 pROI->m_dYMin = m_dDefaultRoiYMin;
1193 if (m_pTextCtrlRoiYMax->GetValue().ToDouble (&dValue))
1194 pROI->m_dYMax = dValue;
1196 pROI->m_dYMax = m_dDefaultRoiYMax;
1198 pROI->m_dXMin = m_dDefaultRoiXMin;
1199 pROI->m_dXMax = m_dDefaultRoiXMax;
1200 pROI->m_dYMin = m_dDefaultRoiYMin;
1201 pROI->m_dYMax = m_dDefaultRoiYMax;
1205 /////////////////////////////////////////////////////////////////////
1206 // CLASS IDENTIFICATION
1208 // DialogGetFilterParameters
1209 /////////////////////////////////////////////////////////////////////
1213 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1214 : wxDialog (pParent, -1, _T("Filter Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1216 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1218 pTopSizer->Add (new wxStaticText (this, -1, "Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1219 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1221 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1223 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1224 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1225 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1227 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1228 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1229 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1231 std::ostringstream os;
1232 os << iDefaultXSize;
1233 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1234 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1235 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1237 std::ostringstream osYSize;
1238 osYSize << iDefaultYSize;
1239 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1240 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1241 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1243 std::ostringstream osFilterParam;
1244 osFilterParam << dDefaultFilterParam;
1245 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1246 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1247 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1249 std::ostringstream osBandwidth;
1250 osBandwidth << dDefaultBandwidth;
1251 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1252 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1253 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1255 std::ostringstream osInputScale;
1256 osInputScale << dDefaultInputScale;
1257 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1258 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1259 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1261 std::ostringstream osOutputScale;
1262 osOutputScale << dDefaultOutputScale;
1263 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1264 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1265 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1267 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1269 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1271 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1272 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1273 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1274 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1275 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1276 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1277 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1279 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1280 pButtonOk->SetDefault();
1282 SetAutoLayout (true);
1283 SetSizer (pTopSizer);
1284 pTopSizer->Layout();
1285 pTopSizer->Fit (this);
1286 pTopSizer->SetSizeHints (this);
1289 DialogGetFilterParameters::~DialogGetFilterParameters ()
1295 DialogGetFilterParameters::getXSize ()
1297 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1298 unsigned long lValue;
1299 if (strCtrl.ToULong (&lValue))
1302 return (m_iDefaultXSize);
1306 DialogGetFilterParameters::getYSize ()
1308 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1309 unsigned long lValue;
1310 if (strCtrl.ToULong (&lValue))
1313 return (m_iDefaultYSize);
1317 DialogGetFilterParameters::getBandwidth ()
1319 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1321 if (strCtrl.ToDouble (&dValue))
1324 return (m_dDefaultBandwidth);
1328 DialogGetFilterParameters::getFilterParam ()
1330 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1332 if (strCtrl.ToDouble (&dValue))
1335 return (m_dDefaultFilterParam);
1339 DialogGetFilterParameters::getInputScale ()
1341 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1343 if (strCtrl.ToDouble (&dValue))
1346 return (m_dDefaultInputScale);
1350 DialogGetFilterParameters::getOutputScale ()
1352 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1354 if (strCtrl.ToDouble (&dValue))
1357 return (m_dDefaultOutputScale);
1361 DialogGetFilterParameters::getFilterName ()
1363 return m_pRadioBoxFilter->getSelectionStringValue();
1367 DialogGetFilterParameters::getDomainName ()
1369 return m_pRadioBoxDomain->getSelectionStringValue();
1373 ///////////////////////////////////////////////////////////////////////
1374 // CLASS IMPLEMENTATION
1375 // DialogExportParameters
1376 ///////////////////////////////////////////////////////////////////////
1378 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1379 : wxDialog (pParent, -1, _T("Select ExportParameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1381 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1383 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1385 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1387 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("File Type"),
1388 ImageFile::getExportFormatCount(), ImageFile::getExportFormatTitleArray(), ImageFile::getExportFormatNameArray());
1389 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1390 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER);
1392 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1394 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1395 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1396 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1397 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1398 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1399 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1400 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1402 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1403 pButtonOk->SetDefault();
1405 SetAutoLayout (true);
1406 SetSizer (pTopSizer);
1407 pTopSizer->Fit (this);
1408 pTopSizer->SetSizeHints (this);
1412 DialogExportParameters::getFormatName()
1414 return m_pRadioBoxFormat->getSelectionStringValue();
1418 ///////////////////////////////////////////////////////////////////////
1419 // CLASS IMPLEMENTATION
1420 // DialogImportParameters
1421 ///////////////////////////////////////////////////////////////////////
1423 DialogImportParameters::DialogImportParameters (wxWindow* pParent, int iDefaultFormatID)
1424 : wxDialog (pParent, -1, _T("Select Import Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1426 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1428 pTopSizer->Add (new wxStaticText (this, -1, "Select Import Format"), 0, wxALIGN_CENTER | wxALL, 5);
1430 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1432 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("File Type"),
1433 ImageFile::getImportFormatCount(), ImageFile::getImportFormatTitleArray(), ImageFile::getImportFormatNameArray());
1434 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1435 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER);
1437 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1439 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1440 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1441 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1442 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1443 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1444 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_IMPORT);
1445 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1447 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1448 pButtonOk->SetDefault();
1450 SetAutoLayout (true);
1451 SetSizer (pTopSizer);
1452 pTopSizer->Fit (this);
1453 pTopSizer->SetSizeHints (this);
1457 DialogImportParameters::getFormatName()
1459 return m_pRadioBoxFormat->getSelectionStringValue();
1463 /////////////////////////////////////////////////////////////////////
1464 // CLASS DiaglogGetXYSize Implementation
1465 /////////////////////////////////////////////////////////////////////
1467 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1468 : wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1470 m_iDefaultXSize = iDefaultXSize;
1471 m_iDefaultYSize = iDefaultYSize;
1473 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1475 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1477 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1479 std::ostringstream os;
1480 os << iDefaultXSize;
1481 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1482 std::ostringstream osYSize;
1483 osYSize << iDefaultYSize;
1484 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1486 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1487 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1488 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1489 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1490 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1491 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1493 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1495 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1496 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1497 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1498 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1499 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1501 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1502 pButtonOk->SetDefault();
1504 SetAutoLayout (true);
1505 SetSizer (pTopSizer);
1506 pTopSizer->Fit (this);
1507 pTopSizer->SetSizeHints (this);
1510 DialogGetXYSize::~DialogGetXYSize ()
1515 DialogGetXYSize::getXSize ()
1517 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1519 if (strCtrl.ToLong (&lValue))
1522 return (m_iDefaultXSize);
1526 DialogGetXYSize::getYSize ()
1528 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1530 if (strCtrl.ToLong (&lValue))
1533 return (m_iDefaultYSize);
1538 /////////////////////////////////////////////////////////////////////
1539 // CLASS IDENTIFICATION
1541 // DialogGetConvertPolarParameters
1542 /////////////////////////////////////////////////////////////////////
1544 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1545 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad, int iHelpID)
1546 : wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1548 m_iDefaultXSize = iDefaultXSize;
1549 m_iDefaultYSize = iDefaultYSize;
1550 m_iDefaultZeropad = iDefaultZeropad;
1552 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1554 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1555 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1557 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1559 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1560 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1561 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1563 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1564 std::ostringstream os;
1565 os << iDefaultXSize;
1566 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1567 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1568 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1569 std::ostringstream osYSize;
1570 osYSize << iDefaultYSize;
1571 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1572 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1573 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1574 if (m_iDefaultZeropad >= 0) {
1575 std::ostringstream osZeropad;
1576 osZeropad << iDefaultZeropad;
1577 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1578 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1579 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1582 pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1584 pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1586 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1588 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1589 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1590 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1591 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1592 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1593 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, iHelpID);
1594 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1596 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1597 pButtonOk->SetDefault();
1598 SetAutoLayout (true);
1599 SetSizer (pTopSizer);
1600 pTopSizer->Layout();
1601 pTopSizer->Fit (this);
1602 pTopSizer->SetSizeHints (this);
1606 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1612 DialogGetConvertPolarParameters::getXSize ()
1614 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1615 unsigned long lValue;
1616 if (strCtrl.ToULong (&lValue))
1619 return (m_iDefaultXSize);
1623 DialogGetConvertPolarParameters::getYSize ()
1625 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1626 unsigned long lValue;
1627 if (strCtrl.ToULong (&lValue))
1630 return (m_iDefaultYSize);
1634 DialogGetConvertPolarParameters::getZeropad ()
1636 if (m_iDefaultZeropad >= 0) {
1637 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1638 unsigned long lValue;
1639 if (strCtrl.ToULong (&lValue))
1642 return (m_iDefaultZeropad);
1648 DialogGetConvertPolarParameters::getInterpolationName ()
1650 return m_pRadioBoxInterpolation->getSelectionStringValue();