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.30 2001/02/11 21:57:08 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"
52 //#include "ctsupport.h"
53 //#include "scanner.h"
54 //#include "phantom.h"
56 //#include "backprojectors.h"
59 #include "imagefile.h"
61 #if defined(MSVC) || HAVE_SSTREAM
64 #include <sstream_subst>
68 ///////////////////////////////////////////////////////////////////////
69 // CLASS IMPLEMENTATION
70 // StringValueAndTitleListBox
71 ///////////////////////////////////////////////////////////////////////
73 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
76 wxString* psTitle = new wxString [nChoices];
77 for (int i = 0; i < nChoices; i++)
78 psTitle[i] = aszTitle[i];
80 Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
82 m_ppszValues = aszValue;
87 StringValueAndTitleListBox::getSelectionStringValue () const
89 return m_ppszValues[GetSelection()];
93 ///////////////////////////////////////////////////////////////////////
94 // CLASS IMPLEMENTATION
96 ///////////////////////////////////////////////////////////////////////
98 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
99 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
101 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
103 pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxALL, 5);
105 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
107 m_pListBoxPhantom = new StringValueAndTitleListBox (this, Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
108 m_pListBoxPhantom->SetSelection (iDefaultPhantom);
109 pTopSizer->Add (m_pListBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
111 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
113 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
114 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
115 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
116 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
117 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
119 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
121 SetAutoLayout (true);
122 SetSizer (pTopSizer);
123 pTopSizer->Fit (this);
124 pTopSizer->SetSizeHints (this);
128 DialogGetPhantom::getPhantom()
130 return m_pListBoxPhantom->getSelectionStringValue();
134 ///////////////////////////////////////////////////////////////////////
135 // CLASS IMPLEMENTATION
136 // DialogGetComparisonImage
137 ///////////////////////////////////////////////////////////////////////
139 DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
140 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
142 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
144 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
146 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
148 int iNImages = m_rVecIF.size();
149 wxString* pstrImages = new wxString [iNImages];
150 for (int i = 0; i < iNImages; i++) {
151 ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
153 pstrImages[i] = pView->getFrame()->GetTitle();
156 m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
157 delete [] pstrImages;
159 m_pListBoxImageChoices->SetSelection (0);
160 pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
162 if (bShowMakeDifference) {
163 m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
164 m_pMakeDifferenceImage->SetValue (FALSE);
165 pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
167 m_pMakeDifferenceImage = NULL;
169 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
171 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
172 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
173 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
174 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
175 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
177 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
179 SetAutoLayout (true);
180 SetSizer (pTopSizer);
181 pTopSizer->Fit (this);
182 pTopSizer->SetSizeHints (this);
186 DialogGetComparisonImage::getImageFileDocument()
188 return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
192 DialogGetComparisonImage::getMakeDifferenceImage()
194 if (m_pMakeDifferenceImage)
195 return m_pMakeDifferenceImage->GetValue();
201 /////////////////////////////////////////////////////////////////////
202 // CLASS DiaglogPreferences Implementation
203 /////////////////////////////////////////////////////////////////////
205 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle,
206 bool bAdvancedOptions, bool bAskDeleteNewDocs)
207 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
209 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
211 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
213 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
215 m_pCBAdvancedOptions = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
216 m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
218 m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
219 m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
221 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
222 pGridSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
223 pGridSizer->Add (new wxStaticText (this, -1, "Show Advanced Options"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
224 pGridSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
225 pGridSizer->Add (new wxStaticText (this, -1, "Ask Save New Documents Before Closing"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
226 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
228 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
230 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
231 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
232 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
233 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
234 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
236 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
238 SetAutoLayout (true);
239 SetSizer (pTopSizer);
240 pTopSizer->Fit (this);
241 pTopSizer->SetSizeHints (this);
244 DialogPreferences::~DialogPreferences ()
249 DialogPreferences::getAdvancedOptions ()
251 return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
255 DialogPreferences::getAskDeleteNewDocs ()
257 return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
261 /////////////////////////////////////////////////////////////////////
262 // CLASS DiaglogGetMinMax Implementation
263 /////////////////////////////////////////////////////////////////////
265 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
266 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
268 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
270 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
272 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
274 std::ostringstream os;
276 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
277 std::ostringstream osMax;
278 osMax << dDefaultMax;
279 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
281 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
282 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
283 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
284 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
285 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
286 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
288 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
290 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
291 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
292 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
293 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
294 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
296 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
298 SetAutoLayout (true);
299 SetSizer (pTopSizer);
300 pTopSizer->Fit (this);
301 pTopSizer->SetSizeHints (this);
304 DialogGetMinMax::~DialogGetMinMax ()
309 DialogGetMinMax::getMinimum ()
311 wxString strCtrl = m_pTextCtrlMin->GetValue();
313 if (strCtrl.ToDouble (&dValue))
316 return (m_dDefaultMin);
320 DialogGetMinMax::getMaximum ()
322 wxString strCtrl = m_pTextCtrlMax->GetValue();
324 if (strCtrl.ToDouble (&dValue))
327 return (m_dDefaultMax);
331 /////////////////////////////////////////////////////////////////////
332 // CLASS DialogAutoScaleParameters IMPLEMENTATION
333 /////////////////////////////////////////////////////////////////////
335 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
336 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
338 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
340 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
342 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
345 asTitle[0] = "Median";
349 m_pListBoxCenter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 3, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
350 m_pListBoxCenter->SetSelection (0);
351 pTopSizer->Add (m_pListBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
353 wxGridSizer *pGridSizer = new wxGridSizer (2);
354 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
355 std::ostringstream osDefaultFactor;
356 osDefaultFactor << dDefaultScaleFactor;
357 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
358 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
359 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
361 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
363 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
364 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
365 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
366 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
367 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
369 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
371 SetAutoLayout (true);
372 SetSizer (pTopSizer);
373 pTopSizer->Fit (this);
374 pTopSizer->SetSizeHints (this);
378 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
380 int iCenter = m_pListBoxCenter->GetSelection();
381 double dCenter = m_dMedian;
384 else if (iCenter == 2)
387 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
389 if (! sStddevFactor.ToDouble (&dValue)) {
390 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
393 double dHalfWidth = dValue * m_dStdDev / 2;
394 *pMin = dCenter - dHalfWidth;
395 *pMax = dCenter + dHalfWidth;
396 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
402 DialogAutoScaleParameters::getAutoScaleFactor ()
404 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
406 if (! sStddevFactor.ToDouble (&dValue)) {
407 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
414 /////////////////////////////////////////////////////////////////////
415 // CLASS IDENTIFICATION
417 // DialogGetRasterParameters
418 /////////////////////////////////////////////////////////////////////
420 DialogGetRasterParameters::DialogGetRasterParameters
421 (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
422 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
424 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
426 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
428 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
430 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
431 std::ostringstream os;
433 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
434 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
435 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
436 std::ostringstream osYSize;
437 osYSize << iDefaultYSize;
438 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
439 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
440 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
441 std::ostringstream osViewRatio;
442 osViewRatio << dDefaultViewRatio;
443 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
444 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
445 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
446 std::ostringstream osNSamples;
447 osNSamples << iDefaultNSamples;
448 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
449 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
450 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
452 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
454 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
456 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
457 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
458 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
459 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
460 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
462 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
464 SetAutoLayout (true);
465 SetSizer (pTopSizer);
466 pTopSizer->Fit (this);
467 pTopSizer->SetSizeHints (this);
470 DialogGetRasterParameters::~DialogGetRasterParameters ()
476 DialogGetRasterParameters::getXSize ()
478 wxString strCtrl = m_pTextCtrlXSize->GetValue();
479 unsigned long lValue;
480 if (strCtrl.ToULong (&lValue))
483 return (m_iDefaultXSize);
487 DialogGetRasterParameters::getYSize ()
489 wxString strCtrl = m_pTextCtrlYSize->GetValue();
490 unsigned long lValue;
491 if (strCtrl.ToULong (&lValue))
494 return (m_iDefaultYSize);
498 DialogGetRasterParameters::getNSamples ()
500 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
501 unsigned long lValue;
502 if (strCtrl.ToULong (&lValue))
505 return (m_iDefaultNSamples);
509 DialogGetRasterParameters::getViewRatio ()
511 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
513 if (strCtrl.ToDouble (&dValue))
516 return (m_dDefaultViewRatio);
520 /////////////////////////////////////////////////////////////////////
521 // CLASS IDENTIFICATION
523 // DialogGetProjectionParameters
524 /////////////////////////////////////////////////////////////////////
527 DialogGetProjectionParameters::DialogGetProjectionParameters
528 (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
529 double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
530 double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
531 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
533 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
535 m_dDefaultRotAngle = dDefaultRotAngle;
536 m_dDefaultFocalLength = dDefaultFocalLength;
537 m_dDefaultViewRatio = dDefaultViewRatio;
538 m_dDefaultScanRatio = dDefaultScanRatio;
539 m_iDefaultNSamples = iDefaultNSamples;
540 m_iDefaultNView = iDefaultNView;
541 m_iDefaultNDet = iDefaultNDet;
542 m_iDefaultTrace = iDefaultTrace;
543 m_iDefaultGeometry = iDefaultGeometry;
545 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
547 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
549 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
550 pGridSizer->Add (new wxStaticText (this, -1, "Scanner Geometry"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
551 m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
552 m_pListBoxGeometry->SetSelection (iDefaultGeometry);
554 pGridSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
556 std::ostringstream os;
558 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
559 pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
560 pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
561 std::ostringstream osNView;
562 osNView << iDefaultNView;
563 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
564 pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
565 pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
566 std::ostringstream osNSamples;
567 osNSamples << iDefaultNSamples;
568 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
569 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
570 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
571 if (theApp->getAdvancedOptions()) {
572 std::ostringstream osRotAngle;
573 osRotAngle << dDefaultRotAngle;
574 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
575 pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
576 pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
578 std::ostringstream osFocalLength;
579 osFocalLength << dDefaultFocalLength;
580 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
581 pGridSizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
582 pGridSizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
583 std::ostringstream osViewRatio;
584 osViewRatio << dDefaultViewRatio;
585 m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
586 pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
587 pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
588 std::ostringstream osScanRatio;
589 osScanRatio << dDefaultScanRatio;
590 m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
591 pGridSizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
592 pGridSizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
594 m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
595 m_pListBoxTrace->SetSelection (iDefaultTrace);
597 pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
598 pGridSizer->Add (m_pListBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
599 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
601 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
603 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
604 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
605 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
606 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
607 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
609 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
611 SetAutoLayout (true);
612 SetSizer (pTopSizer);
613 pTopSizer->Fit (this);
614 pTopSizer->SetSizeHints (this);
617 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
623 DialogGetProjectionParameters::getNDet ()
625 wxString strCtrl = m_pTextCtrlNDet->GetValue();
626 unsigned long lValue;
627 if (strCtrl.ToULong (&lValue))
630 return (m_iDefaultNDet);
634 DialogGetProjectionParameters::getNView ()
636 wxString strCtrl = m_pTextCtrlNView->GetValue();
637 unsigned long lValue;
638 if (strCtrl.ToULong (&lValue))
641 return (m_iDefaultNView);
646 DialogGetProjectionParameters::getNSamples ()
648 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
649 unsigned long lValue;
650 if (strCtrl.ToULong (&lValue))
653 return (m_iDefaultNSamples);
657 DialogGetProjectionParameters::getRotAngle ()
659 if (theApp->getAdvancedOptions()) {
660 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
662 if (strCtrl.ToDouble (&dValue))
663 return (dValue * PI);
665 return (m_dDefaultRotAngle);
667 if (Scanner::convertGeometryNameToID (m_pListBoxGeometry->getSelectionStringValue()) ==
668 Scanner::GEOMETRY_PARALLEL)
676 DialogGetProjectionParameters::getFocalLengthRatio ()
678 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
680 if (strCtrl.ToDouble (&dValue))
683 return (m_dDefaultFocalLength);
687 DialogGetProjectionParameters::getViewRatio ()
689 wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
691 if (strCtrl.ToDouble (&dValue))
694 return (m_dDefaultViewRatio);
698 DialogGetProjectionParameters::getScanRatio ()
700 wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
702 if (strCtrl.ToDouble (&dValue))
705 return (m_dDefaultScanRatio);
709 DialogGetProjectionParameters::getGeometry ()
711 return m_pListBoxGeometry->getSelectionStringValue();
715 DialogGetProjectionParameters::getTrace ()
717 return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
722 /////////////////////////////////////////////////////////////////////
723 // CLASS IDENTIFICATION
725 // DialogGetReconstructionParameters
726 /////////////////////////////////////////////////////////////////////
729 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
730 int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,
731 int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
732 int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
733 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
735 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
737 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
739 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
741 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (6);
742 pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
744 if (theApp->getAdvancedOptions())
745 m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
747 m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
748 m_pListBoxFilter->SetSelection (iDefaultFilterID);
749 pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
751 m_pListBoxFilterMethod = new StringValueAndTitleListBox (this, ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
752 m_pListBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
753 pGridSizer->Add (new wxStaticText (this, -1, "Filter Method"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
754 pGridSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
756 if (theApp->getAdvancedOptions()) {
757 m_pListBoxFilterGeneration = new StringValueAndTitleListBox (this, ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
758 m_pListBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
759 pGridSizer->Add (new wxStaticText (this, -1, "Filter Generation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
760 pGridSizer->Add (m_pListBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
762 m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
763 m_pListBoxBackproject->SetSelection (iDefaultBackprojectID);
764 pGridSizer->Add (new wxStaticText (this, -1, "Backprojection"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
765 pGridSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
768 m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
769 m_pListBoxInterp->SetSelection (iDefaultInterpID);
770 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
771 pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
774 pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
775 static const char* aszTraceTitle[] = {"None", "Full"};
776 static const char* aszTraceName[] = {"none", "full"};
777 m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);
778 iTrace = clamp(iTrace, 0, 1);
779 m_pListBoxTrace->SetSelection (iTrace);
780 pGridSizer->Add (m_pListBoxTrace);
782 std::ostringstream osHammingParam;
783 osHammingParam << dDefaultFilterParam;
784 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
785 pGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
786 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
787 std::ostringstream os;
789 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
790 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
791 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
792 std::ostringstream osYSize;
793 osYSize << iDefaultYSize;
794 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
795 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
796 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
798 if (theApp->getAdvancedOptions()) {
799 std::ostringstream osZeropad;
800 osZeropad << iDefaultZeropad;
801 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
802 pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
803 pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
806 #if HAVE_FREQ_PREINTERP
807 std::ostringstream osInterpParam;
808 osInterpParam << iDefaultInterpParam;
809 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
810 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
811 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
814 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
816 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
818 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
819 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
820 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
821 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
822 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
824 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
826 SetAutoLayout (true);
827 SetSizer (pTopSizer);
829 pTopSizer->Fit (this);
830 pTopSizer->SetSizeHints (this);
833 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
839 DialogGetReconstructionParameters::getXSize ()
841 wxString strCtrl = m_pTextCtrlXSize->GetValue();
842 unsigned long lValue;
843 if (strCtrl.ToULong (&lValue))
846 return (m_iDefaultXSize);
850 DialogGetReconstructionParameters::getYSize ()
852 wxString strCtrl = m_pTextCtrlYSize->GetValue();
853 unsigned long lValue;
854 if (strCtrl.ToULong (&lValue))
857 return (m_iDefaultYSize);
861 DialogGetReconstructionParameters::getZeropad ()
863 if (theApp->getAdvancedOptions()) {
864 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
865 unsigned long lValue;
866 if (strCtrl.ToULong (&lValue))
869 return (m_iDefaultZeropad);
876 DialogGetReconstructionParameters::getInterpParam ()
878 #if HAVE_FREQ_PREINTERP
879 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
880 unsigned long lValue;
881 if (strCtrl.ToULong (&lValue))
884 return (m_iDefaultInterpParam);
891 DialogGetReconstructionParameters::getFilterParam ()
893 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
895 if (strCtrl.ToDouble (&dValue))
898 return (m_dDefaultFilterParam);
902 DialogGetReconstructionParameters::getFilterName ()
904 return m_pListBoxFilter->getSelectionStringValue();
908 DialogGetReconstructionParameters::getFilterMethodName ()
910 return m_pListBoxFilterMethod->getSelectionStringValue();
914 DialogGetReconstructionParameters::getInterpName ()
916 return m_pListBoxInterp->getSelectionStringValue();
920 DialogGetReconstructionParameters::getTrace ()
923 if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0)
924 iTrace = Trace::TRACE_PLOT;
929 DialogGetReconstructionParameters::getBackprojectName ()
931 if (theApp->getAdvancedOptions()) {
932 return m_pListBoxBackproject->getSelectionStringValue();
938 DialogGetReconstructionParameters::getFilterGenerationName ()
940 if (theApp->getAdvancedOptions()) {
941 return m_pListBoxFilterGeneration->getSelectionStringValue();
943 if (ProcessSignal::convertFilterMethodNameToID(m_pListBoxFilterMethod->getSelectionStringValue())
944 == ProcessSignal::FILTER_METHOD_CONVOLUTION)
947 return "inverse-fourier";
952 /////////////////////////////////////////////////////////////////////
953 // CLASS IDENTIFICATION
955 // DialogGetFilterParameters
956 /////////////////////////////////////////////////////////////////////
960 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
961 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
963 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
965 pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
967 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
969 std::ostringstream os;
971 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
972 std::ostringstream osYSize;
973 osYSize << iDefaultYSize;
974 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
975 std::ostringstream osFilterParam;
976 osFilterParam << dDefaultFilterParam;
977 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
978 std::ostringstream osBandwidth;
979 osBandwidth << dDefaultBandwidth;
980 m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
981 std::ostringstream osInputScale;
982 osInputScale << dDefaultInputScale;
983 m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
984 std::ostringstream osOutputScale;
985 osOutputScale << dDefaultOutputScale;
986 m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
988 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
989 pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
990 m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
991 m_pListBoxFilter->SetSelection (iDefaultFilterID);
992 pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
994 m_pListBoxDomain = new StringValueAndTitleListBox (this, SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
995 m_pListBoxDomain->SetSelection (iDefaultDomainID);
996 pGridSizer->Add (new wxStaticText (this, -1, "Domain"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
997 pGridSizer->Add (m_pListBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
999 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1000 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1001 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1002 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1003 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1004 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1005 pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1006 pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1007 pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1008 pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1009 pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1010 pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1012 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1014 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1016 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1017 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1018 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1019 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1020 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1022 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1024 SetAutoLayout (true);
1025 SetSizer (pTopSizer);
1026 pTopSizer->Layout();
1027 pTopSizer->Fit (this);
1028 pTopSizer->SetSizeHints (this);
1031 DialogGetFilterParameters::~DialogGetFilterParameters ()
1037 DialogGetFilterParameters::getXSize ()
1039 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1040 unsigned long lValue;
1041 if (strCtrl.ToULong (&lValue))
1044 return (m_iDefaultXSize);
1048 DialogGetFilterParameters::getYSize ()
1050 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1051 unsigned long lValue;
1052 if (strCtrl.ToULong (&lValue))
1055 return (m_iDefaultYSize);
1059 DialogGetFilterParameters::getBandwidth ()
1061 wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1063 if (strCtrl.ToDouble (&dValue))
1066 return (m_dDefaultBandwidth);
1070 DialogGetFilterParameters::getFilterParam ()
1072 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1074 if (strCtrl.ToDouble (&dValue))
1077 return (m_dDefaultFilterParam);
1081 DialogGetFilterParameters::getInputScale ()
1083 wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1085 if (strCtrl.ToDouble (&dValue))
1088 return (m_dDefaultInputScale);
1092 DialogGetFilterParameters::getOutputScale ()
1094 wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1096 if (strCtrl.ToDouble (&dValue))
1099 return (m_dDefaultOutputScale);
1103 DialogGetFilterParameters::getFilterName ()
1105 return m_pListBoxFilter->getSelectionStringValue();
1109 DialogGetFilterParameters::getDomainName ()
1111 return m_pListBoxDomain->getSelectionStringValue();
1115 ///////////////////////////////////////////////////////////////////////
1116 // CLASS IMPLEMENTATION
1117 // DialogExportParameters
1118 ///////////////////////////////////////////////////////////////////////
1120 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1121 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1123 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1125 pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1127 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1129 m_pListBoxFormat = new StringValueAndTitleListBox (this, ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1130 m_pListBoxFormat->SetSelection (iDefaultFormatID);
1131 pTopSizer->Add (m_pListBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1133 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1135 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1136 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1137 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1138 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1139 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1141 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1143 SetAutoLayout (true);
1144 SetSizer (pTopSizer);
1145 pTopSizer->Fit (this);
1146 pTopSizer->SetSizeHints (this);
1150 DialogExportParameters::getFormatName()
1152 return m_pListBoxFormat->getSelectionStringValue();
1156 /////////////////////////////////////////////////////////////////////
1157 // CLASS DiaglogGetXYSize Implementation
1158 /////////////////////////////////////////////////////////////////////
1160 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1161 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1163 m_iDefaultXSize = iDefaultXSize;
1164 m_iDefaultYSize = iDefaultYSize;
1166 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1168 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1170 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1172 std::ostringstream os;
1173 os << iDefaultXSize;
1174 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1175 std::ostringstream osYSize;
1176 osYSize << iDefaultYSize;
1177 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1179 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1180 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1181 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1182 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1183 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1184 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1186 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1188 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1189 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1190 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1191 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1192 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1194 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1196 SetAutoLayout (true);
1197 SetSizer (pTopSizer);
1198 pTopSizer->Fit (this);
1199 pTopSizer->SetSizeHints (this);
1202 DialogGetXYSize::~DialogGetXYSize ()
1207 DialogGetXYSize::getXSize ()
1209 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1211 if (strCtrl.ToLong (&lValue))
1214 return (m_iDefaultXSize);
1218 DialogGetXYSize::getYSize ()
1220 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1222 if (strCtrl.ToLong (&lValue))
1225 return (m_iDefaultYSize);
1230 /////////////////////////////////////////////////////////////////////
1231 // CLASS IDENTIFICATION
1233 // DialogGetConvertPolarParameters
1234 /////////////////////////////////////////////////////////////////////
1236 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
1237 int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1238 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1240 m_iDefaultXSize = iDefaultXSize;
1241 m_iDefaultYSize = iDefaultYSize;
1242 m_iDefaultZeropad = iDefaultZeropad;
1244 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1246 pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1248 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1250 std::ostringstream os;
1251 os << iDefaultXSize;
1252 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1253 std::ostringstream osYSize;
1254 osYSize << iDefaultYSize;
1255 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1257 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1259 m_pListBoxInterpolation = new StringValueAndTitleListBox (this, Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1260 m_pListBoxInterpolation->SetSelection (iDefaultInterpolationID);
1261 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
1262 pGridSizer->Add (m_pListBoxInterpolation, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1264 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1265 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1266 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1267 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1268 if (iDefaultZeropad >= 0) {
1269 std::ostringstream osZeropad;
1270 osZeropad << iDefaultZeropad;
1271 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1272 pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1273 pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1276 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1278 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1280 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1281 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1282 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1283 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1284 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1286 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1288 SetAutoLayout (true);
1289 SetSizer (pTopSizer);
1290 pTopSizer->Layout();
1291 pTopSizer->Fit (this);
1292 pTopSizer->SetSizeHints (this);
1296 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1302 DialogGetConvertPolarParameters::getXSize ()
1304 wxString strCtrl = m_pTextCtrlXSize->GetValue();
1305 unsigned long lValue;
1306 if (strCtrl.ToULong (&lValue))
1309 return (m_iDefaultXSize);
1313 DialogGetConvertPolarParameters::getYSize ()
1315 wxString strCtrl = m_pTextCtrlYSize->GetValue();
1316 unsigned long lValue;
1317 if (strCtrl.ToULong (&lValue))
1320 return (m_iDefaultYSize);
1324 DialogGetConvertPolarParameters::getZeropad ()
1326 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1327 unsigned long lValue;
1328 if (strCtrl.ToULong (&lValue))
1331 return (m_iDefaultZeropad);
1335 DialogGetConvertPolarParameters::getInterpolationName ()
1337 return m_pListBoxInterpolation->getSelectionStringValue();