X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fdialogs.cpp;h=df9354dee2bfe0fed68a96a93f8b41dba1b21083;hp=57dc3f73a42d8ec1db7407e83cfbcef7b3ef1dac;hb=8a7697ce57b56cdc43698cd1241ad98d49f9b5ac;hpb=08c1ec110dc7936c2bbd1c619bd2cf3618c6b4cc diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 57dc3f7..df9354d 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: dialogs.cpp,v 1.51 2001/03/11 17:55:29 kevin Exp $ +** $Id$ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -25,10 +25,6 @@ ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -#ifdef __GNUG__ -// #pragma implementation -#endif - #include "wx/wxprec.h" #ifndef WX_PRECOMP @@ -47,6 +43,7 @@ #include "docs.h" #include "views.h" #include "imagefile.h" +#include "projections.h" #if defined(MSVC) || HAVE_SSTREAM #include @@ -142,6 +139,64 @@ DialogGetPhantom::getPhantom() } +/////////////////////////////////////////////////////////////////////// +// CLASS IMPLEMENTATION +// DialogGetThetaRange +/////////////////////////////////////////////////////////////////////// + +DialogGetThetaRange::DialogGetThetaRange (wxWindow* pParent, int iDefaultThetaRange) +: wxDialog (pParent, -1, _T("Select Phantom"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +{ + wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); + + pTopSizer->Add (new wxStaticText (this, -1, "Select Theta Range"), 0, wxCENTER | wxALL, 5); + + pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); + + wxString asTitle[] = {"Unconstrained", "Normalized to 2pi", "Fold to pi"}; + + m_pRadioBoxThetaRange = new wxRadioBox (this, -1, _T("Theta Range"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS); + if (iDefaultThetaRange == ParallelRaysums::THETA_RANGE_UNCONSTRAINED) + m_pRadioBoxThetaRange->SetSelection (0); + else if (iDefaultThetaRange == ParallelRaysums::THETA_RANGE_NORMALIZE_TO_TWOPI) + m_pRadioBoxThetaRange->SetSelection (1); + else if (iDefaultThetaRange == ParallelRaysums::THETA_RANGE_FOLD_TO_PI) + m_pRadioBoxThetaRange->SetSelection (2); + + pTopSizer->Add (m_pRadioBoxThetaRange, 0, wxALL | wxALIGN_CENTER); + + pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); + + wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL); + wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay"); + pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10); + wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel"); + pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10); + CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_THETA_RANGE); + pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10); + + pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER); + pButtonOk->SetDefault(); + + SetAutoLayout (true); + SetSizer (pTopSizer); + pTopSizer->Fit (this); + pTopSizer->SetSizeHints (this); +} + +int +DialogGetThetaRange::getThetaRange() +{ + int iSelection = m_pRadioBoxThetaRange->GetSelection(); + if (iSelection == 0) + return ParallelRaysums::THETA_RANGE_UNCONSTRAINED; + else if (iSelection == 1) + return ParallelRaysums::THETA_RANGE_NORMALIZE_TO_TWOPI; + else + return ParallelRaysums::THETA_RANGE_FOLD_TO_PI; +} + + /////////////////////////////////////////////////////////////////////// // CLASS IMPLEMENTATION // DialogGetComparisonImage @@ -242,7 +297,7 @@ DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTi m_pCBStartupTips->SetValue (bStartupTips); pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL); -#ifdef HAVE_WXTHREADS +#if HAVE_WXTHREADS && MSVC m_pCBUseBackgroundTasks = new wxCheckBox (this, -1, "Put Tasks in Background", wxDefaultPosition, wxSize(250, 25), 0); m_pCBUseBackgroundTasks->SetValue (bUseBackgroundTasks); pTopSizer->Add (m_pCBUseBackgroundTasks, 0, wxALIGN_CENTER_VERTICAL); @@ -298,7 +353,7 @@ DialogPreferences::getStartupTips () bool DialogPreferences::getUseBackgroundTasks () { -#ifdef HAVE_WXTHREADS +#if HAVE_WXTHREADS && MSVC return static_cast(m_pCBUseBackgroundTasks->GetValue()); #else return false; @@ -471,11 +526,11 @@ DialogAutoScaleParameters::getAutoScaleFactor () DialogGetRasterParameters::DialogGetRasterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio) -: wxDialog (pParent, -1, _T("Set Rasterization Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, _T("Rasterization Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); - pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); + pTopSizer->Add (new wxStaticText (this, -1, "Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); @@ -580,10 +635,10 @@ DialogGetRasterParameters::getViewRatio () DialogGetProjectionParameters::DialogGetProjectionParameters - (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, + (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultOffsetView, int iDefaultNSamples, double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultCenterDetectorLength, double dDefaultViewRatio, double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace) -: wxDialog (pParent, -1, _T("Set Projection Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, _T("Projection Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); @@ -598,7 +653,7 @@ DialogGetProjectionParameters::DialogGetProjectionParameters m_iDefaultTrace = iDefaultTrace; m_iDefaultGeometry = iDefaultGeometry; - pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); + pTopSizer->Add (new wxStaticText (this, -1, "Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); @@ -660,6 +715,13 @@ DialogGetProjectionParameters::DialogGetProjectionParameters m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL); + + std::ostringstream osOffsetView; + osOffsetView << iDefaultOffsetView; + m_pTextCtrlOffsetView = new wxTextCtrl (this, -1, osOffsetView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); + pText2Sizer->Add (new wxStaticText (this, -1, "Gantry offset in units of 'views' "), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + pText2Sizer->Add (m_pTextCtrlOffsetView, 0, wxALIGN_CENTER_VERTICAL); + } pGridSizer->Add (pText2Sizer); @@ -713,6 +775,20 @@ DialogGetProjectionParameters::getNView () return (m_iDefaultNView); } +unsigned int +DialogGetProjectionParameters::getOffsetView () +{ + if (theApp->getAdvancedOptions()) { + wxString strCtrl = m_pTextCtrlOffsetView->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultOffsetView); + } + else + return 0; +} unsigned int DialogGetProjectionParameters::getNSamples () @@ -817,7 +893,7 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace, ReconstructionROI* pDefaultROI) -: wxDialog (pParent, -1, _T("Set Reconstruction Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, _T("Reconstruction Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); @@ -831,7 +907,7 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* m_dDefaultRoiYMin = pDefaultROI->m_dYMin; m_dDefaultRoiYMax = pDefaultROI->m_dYMax; - pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); + pTopSizer->Add (new wxStaticText (this, -1, "Filtered Backprojection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); wxFlexGridSizer* pGridSizer = NULL; @@ -1131,11 +1207,11 @@ DialogGetReconstructionParameters::getROI (ReconstructionROI* pROI) DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale) -: wxDialog (pParent, -1, _T("Set Filter Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, _T("Filter Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); - pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); + pTopSizer->Add (new wxStaticText (this, -1, "Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2); @@ -1462,7 +1538,7 @@ DialogGetXYSize::getYSize () ///////////////////////////////////////////////////////////////////// DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, - int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad) + int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad, int iHelpID) : wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { m_iDefaultXSize = iDefaultXSize; @@ -1491,15 +1567,13 @@ DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pPar m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); -#ifdef DEBUG - if (iDefaultZeropad >= 0) { + if (m_iDefaultZeropad >= 0) { std::ostringstream osZeropad; osZeropad << iDefaultZeropad; m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); } -#endif pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL); @@ -1512,7 +1586,7 @@ DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pPar pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10); wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel"); pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10); - CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR); + CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, iHelpID); pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10); pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER); @@ -1555,16 +1629,15 @@ DialogGetConvertPolarParameters::getYSize () unsigned int DialogGetConvertPolarParameters::getZeropad () { -#ifdef DEBUG - wxString strCtrl = m_pTextCtrlZeropad->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultZeropad); -#else - return 0; -#endif + if (m_iDefaultZeropad >= 0) { + wxString strCtrl = m_pTextCtrlZeropad->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultZeropad); + } else + return 0; } const char*