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.33 2001/02/16 00:28: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 // 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 m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
786 m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
787 pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
789 if (theApp->getAdvancedOptions()) {
790 m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
791 m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
792 pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
794 m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
795 m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
796 pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
799 m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
800 m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
801 pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
803 static const char* aszTraceTitle[] = {"None", "Full"};
804 static const char* aszTraceName[] = {"none", "full"};
805 m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
806 iTrace = clamp(iTrace, 0, 1);
807 m_pRadioBoxTrace->SetSelection (iTrace);
808 pGridSizer->Add (m_pRadioBoxTrace);
810 wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
811 std::ostringstream os;
813 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
814 pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
815 pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
816 std::ostringstream osYSize;
817 osYSize << iDefaultYSize;
818 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
819 pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
820 pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
822 std::ostringstream osHammingParam;
823 osHammingParam << dDefaultHammingParam;
824 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
825 pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
826 pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
828 if (theApp->getAdvancedOptions()) {
829 std::ostringstream osZeropad;
830 osZeropad << iDefaultZeropad;
831 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
832 pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
833 pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
835 pGridSizer->Add (pTextGridSizer);
837 #if HAVE_FREQ_PREINTERP
838 std::ostringstream osInterpParam;
839 osInterpParam << iDefaultInterpParam;
840 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
841 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
842 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
845 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
847 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
849 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
850 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
851 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
852 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
853 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
854 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
855 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
857 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
858 pButtonOk->SetDefault();
860 SetAutoLayout (true);
861 SetSizer (pTopSizer);
863 pTopSizer->Fit (this);
864 pTopSizer->SetSizeHints (this);
867 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
873 DialogGetReconstructionParameters::getXSize ()
875 wxString strCtrl = m_pTextCtrlXSize->GetValue();
876 unsigned long lValue;
877 if (strCtrl.ToULong (&lValue))
880 return (m_iDefaultXSize);
884 DialogGetReconstructionParameters::getYSize ()
886 wxString strCtrl = m_pTextCtrlYSize->GetValue();
887 unsigned long lValue;
888 if (strCtrl.ToULong (&lValue))
891 return (m_iDefaultYSize);
895 DialogGetReconstructionParameters::getZeropad ()
897 if (theApp->getAdvancedOptions()) {
898 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
899 unsigned long lValue;
900 if (strCtrl.ToULong (&lValue))
903 return (m_iDefaultZeropad);
910 DialogGetReconstructionParameters::getInterpParam ()
912 #if HAVE_FREQ_PREINTERP
913 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
914 unsigned long lValue;
915 if (strCtrl.ToULong (&lValue))
918 return (m_iDefaultInterpParam);
925 DialogGetReconstructionParameters::getFilterParam ()
927 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
929 if (strCtrl.ToDouble (&dValue))
932 return (m_dDefaultFilterParam);
936 DialogGetReconstructionParameters::getFilterName ()
938 return m_pRadioBoxFilter->getSelectionStringValue();
942 DialogGetReconstructionParameters::getFilterMethodName ()
944 return m_pRadioBoxFilterMethod->getSelectionStringValue();
948 DialogGetReconstructionParameters::getInterpName ()
950 return m_pRadioBoxInterp->getSelectionStringValue();
954 DialogGetReconstructionParameters::getTrace ()
957 if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
958 iTrace = Trace::TRACE_PLOT;
963 DialogGetReconstructionParameters::getBackprojectName ()
965 if (theApp->getAdvancedOptions()) {
966 return m_pRadioBoxBackproject->getSelectionStringValue();
972 DialogGetReconstructionParameters::getFilterGenerationName ()
974 if (theApp->getAdvancedOptions()) {
975 return m_pRadioBoxFilterGeneration->getSelectionStringValue();
977 if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
978 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
981 return "inverse-fourier";
986 /////////////////////////////////////////////////////////////////////
987 // CLASS IDENTIFICATION
989 // DialogGetFilterParameters
990 /////////////////////////////////////////////////////////////////////
994 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
995 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
997 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
999 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1000 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1002 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1004 m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1005 m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1006 pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1008 m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1009 m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1010 pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1012 std::ostringstream os;
1013 os << iDefaultXSize;
1014 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1015 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1016 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1018 std::ostringstream osYSize;
1019 osYSize << iDefaultYSize;
1020 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1021 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1022 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1024 std::ostringstream osFilterParam;
1025 osFilterParam << dDefaultFilterParam;
1026 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1027 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1028 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1030 std::ostringstream osBandwidth;
1031 osBandwidth << dDefaultBandwidth;
1032 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1033 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1034 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1036 std::ostringstream osInputScale;
1037 osInputScale << dDefaultInputScale;
1038 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1039 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1040 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1042 std::ostringstream osOutputScale;
1043 osOutputScale << dDefaultOutputScale;
1044 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1045 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1046 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1048 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1050 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1052 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1053 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1054 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1055 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1056 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1057 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1058 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1060 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1061 pButtonOk->SetDefault();
1063 SetAutoLayout (true);
1064 SetSizer (pTopSizer);
1065 pTopSizer->Layout();
1066 pTopSizer->Fit (this);
1067 pTopSizer->SetSizeHints (this);
1070 DialogGetFilterParameters::~DialogGetFilterParameters ()
1076 DialogGetFilterParameters::getXSize ()
1078 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1079 unsigned long lValue;
1080 if (strCtrl.ToULong (&lValue))
1083 return (m_iDefaultXSize);
1087 DialogGetFilterParameters::getYSize ()
1089 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1090 unsigned long lValue;
1091 if (strCtrl.ToULong (&lValue))
1094 return (m_iDefaultYSize);
1098 DialogGetFilterParameters::getBandwidth ()
1100 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1102 if (strCtrl.ToDouble (&dValue))
1105 return (m_dDefaultBandwidth);
1109 DialogGetFilterParameters::getFilterParam ()
1111 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1113 if (strCtrl.ToDouble (&dValue))
1116 return (m_dDefaultFilterParam);
1120 DialogGetFilterParameters::getInputScale ()
1122 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1124 if (strCtrl.ToDouble (&dValue))
1127 return (m_dDefaultInputScale);
1131 DialogGetFilterParameters::getOutputScale ()
1133 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1135 if (strCtrl.ToDouble (&dValue))
1138 return (m_dDefaultOutputScale);
1142 DialogGetFilterParameters::getFilterName ()
1144 return m_pRadioBoxFilter->getSelectionStringValue();
1148 DialogGetFilterParameters::getDomainName ()
1150 return m_pRadioBoxDomain->getSelectionStringValue();
1154 ///////////////////////////////////////////////////////////////////////
1155 // CLASS IMPLEMENTATION
1156 // DialogExportParameters
1157 ///////////////////////////////////////////////////////////////////////
1159 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1160 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1162 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1164 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1166 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1168 m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1169 m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1170 pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1172 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1174 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1175 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1176 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1177 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1178 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1179 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1180 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1182 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1183 pButtonOk->SetDefault();
1185 SetAutoLayout (true);
1186 SetSizer (pTopSizer);
1187 pTopSizer->Fit (this);
1188 pTopSizer->SetSizeHints (this);
1192 DialogExportParameters::getFormatName()
1194 return m_pRadioBoxFormat->getSelectionStringValue();
1198 /////////////////////////////////////////////////////////////////////
1199 // CLASS DiaglogGetXYSize Implementation
1200 /////////////////////////////////////////////////////////////////////
1202 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1203 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1205 m_iDefaultXSize = iDefaultXSize;
1206 m_iDefaultYSize = iDefaultYSize;
1208 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1210 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1212 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1214 std::ostringstream os;
1215 os << iDefaultXSize;
1216 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1217 std::ostringstream osYSize;
1218 osYSize << iDefaultYSize;
1219 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1221 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1222 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1223 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1224 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1225 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1226 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1228 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1230 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1231 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1232 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1233 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1234 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1236 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1237 pButtonOk->SetDefault();
1239 SetAutoLayout (true);
1240 SetSizer (pTopSizer);
1241 pTopSizer->Fit (this);
1242 pTopSizer->SetSizeHints (this);
1245 DialogGetXYSize::~DialogGetXYSize ()
1250 DialogGetXYSize::getXSize ()
1252 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1254 if (strCtrl.ToLong (&lValue))
1257 return (m_iDefaultXSize);
1261 DialogGetXYSize::getYSize ()
1263 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1265 if (strCtrl.ToLong (&lValue))
1268 return (m_iDefaultYSize);
1273 /////////////////////////////////////////////////////////////////////
1274 // CLASS IDENTIFICATION
1276 // DialogGetConvertPolarParameters
1277 /////////////////////////////////////////////////////////////////////
1279 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1280 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1281 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1283 m_iDefaultXSize = iDefaultXSize;
1284 m_iDefaultYSize = iDefaultYSize;
1285 m_iDefaultZeropad = iDefaultZeropad;
1287 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1289 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1291 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1293 std::ostringstream os;
1294 os << iDefaultXSize;
1295 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1296 std::ostringstream osYSize;
1297 osYSize << iDefaultYSize;
1298 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1300 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1302 m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1303 m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1304 pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1306 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1307 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1308 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1309 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1310 if (iDefaultZeropad >= 0) {
1311 std::ostringstream osZeropad;
1312 osZeropad << iDefaultZeropad;
1313 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1314 pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1315 pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1318 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1320 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1322 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1323 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1324 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1325 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1326 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1327 CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1328 pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1330 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1331 pButtonOk->SetDefault();
1332 SetAutoLayout (true);
1333 SetSizer (pTopSizer);
1334 pTopSizer->Layout();
1335 pTopSizer->Fit (this);
1336 pTopSizer->SetSizeHints (this);
1340 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1346 DialogGetConvertPolarParameters::getXSize ()
1348 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1349 unsigned long lValue;
1350 if (strCtrl.ToULong (&lValue))
1353 return (m_iDefaultXSize);
1357 DialogGetConvertPolarParameters::getYSize ()
1359 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1360 unsigned long lValue;
1361 if (strCtrl.ToULong (&lValue))
1364 return (m_iDefaultYSize);
1368 DialogGetConvertPolarParameters::getZeropad ()
1370 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1371 unsigned long lValue;
1372 if (strCtrl.ToULong (&lValue))
1375 return (m_iDefaultZeropad);
1379 DialogGetConvertPolarParameters::getInterpolationName ()
1381 return m_pRadioBoxInterpolation->getSelectionStringValue();