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-2000 Kevin Rosenberg
12 ** $Id: dialogs.cpp,v 1.13 2000/09/04 09:06:46 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"
51 #include "ctsupport.h"
56 #include "backprojectors.h"
59 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
62 wxString asTitle[nChoices];
63 for (int i = 0; i < nChoices; i++)
64 asTitle[i] = aszTitle[i];
66 Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
68 m_ppszValues = aszValue;
72 StringValueAndTitleListBox::getSelectionStringValue (void) const
74 return m_ppszValues[GetSelection()];
79 DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN)
80 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
82 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
84 pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxALL, 5);
86 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
88 m_pListBoxPhantom = new StringValueAndTitleListBox (this, Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
89 m_pListBoxPhantom->SetSelection (iDefaultPhantom);
90 pTopSizer->Add (m_pListBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
92 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
94 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
95 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
96 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
97 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
98 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
100 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
102 SetAutoLayout (true);
103 SetSizer (pTopSizer);
104 pTopSizer->Fit (this);
105 pTopSizer->SetSizeHints (this);
109 DialogGetPhantom::getPhantom(void)
111 return m_pListBoxPhantom->getSelectionStringValue();
115 DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.)
116 : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
118 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
120 pTopSizer->Add (new wxStaticText (this, -1, "Set Image Display Minimum and Maximum"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
122 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
126 m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
128 osMax << dDefaultMax;
129 m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
131 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
132 pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
133 pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
134 pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
135 pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
136 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
138 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
140 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
141 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
142 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
143 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
144 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
146 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
148 SetAutoLayout (true);
149 SetSizer (pTopSizer);
150 pTopSizer->Fit (this);
151 pTopSizer->SetSizeHints (this);
154 DialogGetImageMinMax::~DialogGetImageMinMax (void)
157 delete m_pTextCtrlMin;
158 delete m_pTextCtrlMax;
163 DialogGetImageMinMax::getMinimum (void)
165 wxString strCtrl = m_pTextCtrlMin->GetValue();
167 if (strCtrl.ToDouble (&dValue))
170 return (m_dDefaultMin);
174 DialogGetImageMinMax::getMaximum (void)
176 wxString strCtrl = m_pTextCtrlMax->GetValue();
178 if (strCtrl.ToDouble (&dValue))
181 return (m_dDefaultMax);
185 /////////////////////////////////////////////////////////////////////
186 // CLASS IDENTIFICATION
188 // DialogGetRasterParameters
189 /////////////////////////////////////////////////////////////////////
191 DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultNSamples = 1)
192 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
194 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
196 pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
198 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
202 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
203 ostringstream osYSize;
204 osYSize << iDefaultYSize;
205 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
206 ostringstream osNSamples;
207 osNSamples << iDefaultNSamples;
208 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
210 wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
211 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
212 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
213 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
214 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
215 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
216 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
217 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
219 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
221 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
222 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
223 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
224 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
225 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
227 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
229 SetAutoLayout (true);
230 SetSizer (pTopSizer);
231 pTopSizer->Fit (this);
232 pTopSizer->SetSizeHints (this);
235 DialogGetRasterParameters::~DialogGetRasterParameters (void)
241 DialogGetRasterParameters::getXSize (void)
243 wxString strCtrl = m_pTextCtrlXSize->GetValue();
244 unsigned long lValue;
245 if (strCtrl.ToULong (&lValue))
248 return (m_iDefaultXSize);
252 DialogGetRasterParameters::getYSize (void)
254 wxString strCtrl = m_pTextCtrlYSize->GetValue();
255 unsigned long lValue;
256 if (strCtrl.ToULong (&lValue))
259 return (m_iDefaultYSize);
264 DialogGetRasterParameters::getNSamples (void)
266 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
267 unsigned long lValue;
268 if (strCtrl.ToULong (&lValue))
271 return (m_iDefaultNSamples);
276 /////////////////////////////////////////////////////////////////////
277 // CLASS IDENTIFICATION
279 // DialogGetProjectionParameters
280 /////////////////////////////////////////////////////////////////////
283 DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultFieldOfView, int iDefaultGeometry, int iDefaultTrace)
284 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
286 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
288 m_dDefaultRotAngle = dDefaultRotAngle;
289 m_dDefaultFocalLength = dDefaultFocalLength;
290 m_dDefaultFieldOfView = dDefaultFieldOfView;
291 m_iDefaultNSamples = iDefaultNSamples;
292 m_iDefaultNView = iDefaultNView;
293 m_iDefaultNDet = iDefaultNDet;
294 m_iDefaultTrace = iDefaultTrace;
295 m_iDefaultGeometry = iDefaultGeometry;
297 pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
299 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
303 m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
304 ostringstream osNView;
305 osNView << iDefaultNView;
306 m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
307 ostringstream osNSamples;
308 osNSamples << iDefaultNSamples;
309 m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
310 ostringstream osRotAngle;
311 osRotAngle << dDefaultRotAngle;
312 m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
313 ostringstream osFocalLength;
314 osFocalLength << dDefaultFocalLength;
315 m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
316 ostringstream osFieldOfView;
317 osFieldOfView << dDefaultFieldOfView;
318 m_pTextCtrlFieldOfView = new wxTextCtrl (this, -1, osFieldOfView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
320 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
321 pGridSizer->Add (new wxStaticText (this, -1, "Scanner Geometry"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
322 m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
323 m_pListBoxGeometry->SetSelection (iDefaultGeometry);
325 pGridSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
327 pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
328 pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
329 pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
330 pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
331 pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
332 pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
333 pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
334 pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
335 pGridSizer->Add (new wxStaticText (this, -1, "Focal Length Ratio (phantom radius units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
336 pGridSizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
337 pGridSizer->Add (new wxStaticText (this, -1, "Field of View (phantom diameter units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
338 pGridSizer->Add (m_pTextCtrlFieldOfView, 0, wxALIGN_CENTER_VERTICAL);
340 m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
341 m_pListBoxTrace->SetSelection (iDefaultTrace);
343 pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
344 pGridSizer->Add (m_pListBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
345 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
347 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
349 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
350 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
351 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
352 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
353 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
355 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
357 SetAutoLayout (true);
358 SetSizer (pTopSizer);
359 pTopSizer->Fit (this);
360 pTopSizer->SetSizeHints (this);
363 DialogGetProjectionParameters::~DialogGetProjectionParameters (void)
369 DialogGetProjectionParameters::getNDet (void)
371 wxString strCtrl = m_pTextCtrlNDet->GetValue();
372 unsigned long lValue;
373 if (strCtrl.ToULong (&lValue))
376 return (m_iDefaultNDet);
380 DialogGetProjectionParameters::getNView (void)
382 wxString strCtrl = m_pTextCtrlNView->GetValue();
383 unsigned long lValue;
384 if (strCtrl.ToULong (&lValue))
387 return (m_iDefaultNView);
392 DialogGetProjectionParameters::getNSamples (void)
394 wxString strCtrl = m_pTextCtrlNSamples->GetValue();
395 unsigned long lValue;
396 if (strCtrl.ToULong (&lValue))
399 return (m_iDefaultNSamples);
403 DialogGetProjectionParameters::getRotAngle (void)
405 wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
407 if (strCtrl.ToDouble (&dValue))
408 return (dValue * PI);
410 return (m_dDefaultRotAngle);
414 DialogGetProjectionParameters::getFocalLengthRatio (void)
416 wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
418 if (strCtrl.ToDouble (&dValue))
421 return (m_dDefaultFocalLength);
425 DialogGetProjectionParameters::getFieldOfViewRatio (void)
427 wxString strCtrl = m_pTextCtrlFieldOfView->GetValue();
429 if (strCtrl.ToDouble (&dValue))
432 return (m_dDefaultFieldOfView);
436 DialogGetProjectionParameters::getGeometry (void)
438 return m_pListBoxGeometry->getSelectionStringValue();
442 DialogGetProjectionParameters::getTrace (void)
444 return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
449 /////////////////////////////////////////////////////////////////////
450 // CLASS IDENTIFICATION
452 // DialogGetReconstructionParameters
453 /////////////////////////////////////////////////////////////////////
456 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
457 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
459 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
461 pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
463 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
467 m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
468 ostringstream osYSize;
469 osYSize << iDefaultYSize;
470 m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
471 ostringstream osFilterParam;
472 osFilterParam << dDefaultFilterParam;
473 m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
474 ostringstream osZeropad;
475 osZeropad << iDefaultZeropad;
476 m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
477 ostringstream osInterpParam;
478 osInterpParam << iDefaultInterpParam;
479 m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
481 wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
482 pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
483 m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
484 m_pListBoxFilter->SetSelection (iDefaultFilterID);
485 pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
487 m_pListBoxFilterMethod = new StringValueAndTitleListBox (this, ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
488 m_pListBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
489 pGridSizer->Add (new wxStaticText (this, -1, "Filter Method"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
490 pGridSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
492 m_pListBoxFilterGeneration = new StringValueAndTitleListBox (this, ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
493 m_pListBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
494 pGridSizer->Add (new wxStaticText (this, -1, "Filter Generation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
495 pGridSizer->Add (m_pListBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
497 m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
498 m_pListBoxBackproject->SetSelection (iDefaultBackprojectID);
499 pGridSizer->Add (new wxStaticText (this, -1, "Backprojection"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
500 pGridSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
502 m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
503 m_pListBoxInterp->SetSelection (iDefaultInterpID);
504 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
505 pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
508 pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
509 pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
510 pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
511 pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
512 pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
513 pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
514 pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
515 pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
516 pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
517 pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
519 pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
520 static const char* aszTraceTitle[] = {"None", "Full"};
521 static const char* aszTraceName[] = {"none", "full"};
522 m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);
523 iTrace = clamp(iTrace, 0, 1);
524 m_pListBoxTrace->SetSelection (iTrace);
525 pGridSizer->Add (m_pListBoxTrace);
527 pTopSizer->Add (pGridSizer, 1, wxALL, 3);
529 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
531 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
532 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
533 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
534 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
535 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
537 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
539 SetAutoLayout (true);
540 SetSizer (pTopSizer);
542 pTopSizer->Fit (this);
543 pTopSizer->SetSizeHints (this);
546 DialogGetReconstructionParameters::~DialogGetReconstructionParameters (void)
552 DialogGetReconstructionParameters::getXSize (void)
554 wxString strCtrl = m_pTextCtrlXSize->GetValue();
555 unsigned long lValue;
556 if (strCtrl.ToULong (&lValue))
559 return (m_iDefaultXSize);
563 DialogGetReconstructionParameters::getYSize (void)
565 wxString strCtrl = m_pTextCtrlYSize->GetValue();
566 unsigned long lValue;
567 if (strCtrl.ToULong (&lValue))
570 return (m_iDefaultYSize);
574 DialogGetReconstructionParameters::getZeropad (void)
576 wxString strCtrl = m_pTextCtrlZeropad->GetValue();
577 unsigned long lValue;
578 if (strCtrl.ToULong (&lValue))
581 return (m_iDefaultZeropad);
586 DialogGetReconstructionParameters::getInterpParam (void)
588 wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
589 unsigned long lValue;
590 if (strCtrl.ToULong (&lValue))
593 return (m_iDefaultInterpParam);
597 DialogGetReconstructionParameters::getFilterParam (void)
599 wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
601 if (strCtrl.ToDouble (&dValue))
604 return (m_dDefaultFilterParam);
608 DialogGetReconstructionParameters::getFilterName (void)
610 return m_pListBoxFilter->getSelectionStringValue();
614 DialogGetReconstructionParameters::getFilterMethodName (void)
616 return m_pListBoxFilterMethod->getSelectionStringValue();
620 DialogGetReconstructionParameters::getInterpName (void)
622 return m_pListBoxInterp->getSelectionStringValue();
626 DialogGetReconstructionParameters::getTrace (void)
629 if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0)
630 iTrace = Trace::TRACE_PLOT;
635 DialogGetReconstructionParameters::getBackprojectName (void)
637 return m_pListBoxBackproject->getSelectionStringValue();
641 DialogGetReconstructionParameters::getFilterGenerationName (void)
643 return m_pListBoxFilterGeneration->getSelectionStringValue();
647 DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, const ImageFile& rIF, double dDefaultScaleFactor)
648 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rImageFile(rIF)
650 wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
652 pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
654 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
657 asTitle[0] = "Median";
661 m_pListBoxCenter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 3, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
662 m_pListBoxCenter->SetSelection (0);
663 pTopSizer->Add (m_pListBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
665 wxGridSizer *pGridSizer = new wxGridSizer (2);
666 pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
667 ostringstream osDefaultFactor;
668 osDefaultFactor << dDefaultScaleFactor;
669 m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
670 pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
671 pTopSizer->Add (pGridSizer, 1, wxALL, 10);
673 pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
675 wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
676 wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
677 wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
678 pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
679 pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
681 pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
683 SetAutoLayout (true);
684 SetSizer (pTopSizer);
685 pTopSizer->Fit (this);
686 pTopSizer->SetSizeHints (this);
690 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
692 int iCenter = m_pListBoxCenter->GetSelection();
693 double min, max, mean, mode, median, stddev;
694 m_rImageFile.statistics (min, max, mean, mode, median, stddev);
695 double dCenter = median;
698 else if (iCenter == 2)
701 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
703 if (! sStddevFactor.ToDouble (&dValue)) {
704 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
708 double dHalfWidth = dValue * stddev / 2;
709 *pMin = dCenter - dHalfWidth;
710 *pMax = dCenter + dHalfWidth;
711 *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
715 DialogAutoScaleParameters::getAutoScaleFactor ()
717 wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
719 if (! sStddevFactor.ToDouble (&dValue)) {
720 *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";