X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=8b40f35744b2fd2039288dfa165e1e3d2c4401a7;hp=dfce19050dd228534721978c7f8a1abca95674d3;hb=4433641931aa27fd6a2b5ecd0102e6c5bbbccc46;hpb=9ff5b5165b2c8871bd4b29ccd5ca794638414615 diff --git a/src/views.cpp b/src/views.cpp index dfce190..8b40f35 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: views.cpp,v 1.136 2001/03/13 04:44:25 kevin Exp $ +** $Id: views.cpp,v 1.137 2001/03/13 08:24:41 kevin Exp $ ** ** 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 @@ -2378,6 +2378,7 @@ IMPLEMENT_DYNAMIC_CLASS(ProjectionFileView, wxView) BEGIN_EVENT_TABLE(ProjectionFileView, wxView) EVT_MENU(PJMENU_FILE_PROPERTIES, ProjectionFileView::OnProperties) EVT_MENU(PJMENU_RECONSTRUCT_FBP, ProjectionFileView::OnReconstructFBP) +EVT_MENU(PJMENU_RECONSTRUCT_FBP_REBIN, ProjectionFileView::OnReconstructFBPRebin) EVT_MENU(PJMENU_RECONSTRUCT_FOURIER, ProjectionFileView::OnReconstructFourier) EVT_MENU(PJMENU_CONVERT_POLAR, ProjectionFileView::OnConvertPolar) EVT_MENU(PJMENU_CONVERT_FFT_POLAR, ProjectionFileView::OnConvertFFTPolar) @@ -2599,10 +2600,23 @@ ProjectionFileView::OnReconstructFourier (wxCommandEvent& event) wxMessageBox ("Fourier Reconstruction is not yet supported", "Unimplemented function"); } +void +ProjectionFileView::OnReconstructFBPRebin (wxCommandEvent& event) +{ + Projections& rProj = GetDocument()->getProjections(); + doReconstructFBP (rProj, true); +} + void ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) { - const Projections& rProj = GetDocument()->getProjections(); + Projections& rProj = GetDocument()->getProjections(); + doReconstructFBP (rProj, false); +} + +void +ProjectionFileView::doReconstructFBP (const Projections& rProj, bool bRebinToParallel) +{ ReconstructionROI defaultROI; defaultROI.m_dXMin = -rProj.phmLen() / 2; defaultROI.m_dXMax = defaultROI.m_dXMin + rProj.phmLen(); @@ -2641,14 +2655,17 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) std::ostringstream os; os << "Reconstruct " << rProj.getFilename() << ": xSize=" << m_iDefaultNX << ", ySize=" << m_iDefaultNY << ", Filter=" << optFilterName.c_str() << ", FilterParam=" << m_dDefaultFilterParam << ", FilterMethod=" << optFilterMethodName.c_str() << ", FilterGeneration=" << optFilterGenerationName.c_str() << ", Zeropad=" << m_iDefaultZeropad << ", Interpolation=" << optInterpName.c_str() << ", InterpolationParam=" << m_iDefaultInterpParam << ", Backprojection=" << optBackprojectName.c_str(); - + if (bRebinToParallel) + os << "; Interpolate to Parallel"; + Timer timerRecon; ImageFile* pImageFile = NULL; if (m_iDefaultTrace > Trace::TRACE_CONSOLE) { pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY); Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(), m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), - optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, &defaultROI); + optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, + &defaultROI, bRebinToParallel); ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstructor, rProj, *pImageFile, m_iDefaultTrace, getFrameForChild()); for (int iView = 0; iView < rProj.nView(); iView++) { @@ -2671,10 +2688,10 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) } else { #if HAVE_WXTHREADS if (theApp->getUseBackgroundTasks()) { - ReconstructorSupervisorThread* pReconstructor = new ReconstructorSupervisorThread (this, - m_iDefaultNX, m_iDefaultNY, optFilterName.c_str(), - m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), - optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), os.str().c_str(), &defaultROI); + ReconstructorSupervisorThread* pReconstructor = new ReconstructorSupervisorThread (this, m_iDefaultNX, + m_iDefaultNY, optFilterName.c_str(), m_dDefaultFilterParam, optFilterMethodName.c_str(), + m_iDefaultZeropad, optFilterGenerationName.c_str(), optInterpName.c_str(), m_iDefaultInterpParam, + optBackprojectName.c_str(), os.str().c_str(), &defaultROI, bRebinToParallel); if (pReconstructor->Create() != wxTHREAD_NO_ERROR) { sys_error (ERR_SEVERE, "Error creating reconstructor thread"); delete pReconstructor; @@ -2687,11 +2704,12 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) #endif { pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY); + wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, getFrameForChild(), wxPD_CAN_ABORT ); Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(), m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), - optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, &defaultROI); + optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, + &defaultROI, bRebinToParallel); - wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, getFrameForChild(), wxPD_CAN_ABORT ); for (int iView = 0; iView < rProj.nView(); iView++) { pReconstructor->reconstructView (iView, 1); if (! dlgProgress.Update (iView + 1)) { @@ -2800,6 +2818,7 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) wxMenu *reconstruct_menu = new wxMenu; reconstruct_menu->Append (PJMENU_RECONSTRUCT_FBP, "&Filtered Backprojection...\tCtrl-R", "Reconstruct image using filtered backprojection"); + reconstruct_menu->Append (PJMENU_RECONSTRUCT_FBP_REBIN, "Filtered &Backprojection (Rebin to Parallel)...\tCtrl-B", "Reconstruct image using filtered backprojection"); reconstruct_menu->Append (PJMENU_RECONSTRUCT_FOURIER, "&Fourier...\tCtrl-E", "Reconstruct image using inverse Fourier"); reconstruct_menu->Enable (PJMENU_RECONSTRUCT_FOURIER, false); @@ -2821,14 +2840,15 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) subframe->SetMenuBar(menu_bar); subframe->Centre(wxBOTH); - wxAcceleratorEntry accelEntries[6]; + wxAcceleratorEntry accelEntries[7]; accelEntries[0].Set (wxACCEL_CTRL, static_cast('L'), PJMENU_CONVERT_POLAR); accelEntries[1].Set (wxACCEL_CTRL, static_cast('M'), PJMENU_CONVERT_FFT_POLAR); accelEntries[2].Set (wxACCEL_CTRL, static_cast('R'), PJMENU_RECONSTRUCT_FBP); - accelEntries[3].Set (wxACCEL_CTRL, static_cast('E'), PJMENU_RECONSTRUCT_FOURIER); - accelEntries[4].Set (wxACCEL_CTRL, static_cast('I'), PJMENU_FILE_PROPERTIES); - accelEntries[5].Set (wxACCEL_CTRL, static_cast('T'), PJMENU_PLOT_TTHETA_SAMPLING); - wxAcceleratorTable accelTable (6, accelEntries); + accelEntries[3].Set (wxACCEL_CTRL, static_cast('B'), PJMENU_RECONSTRUCT_FBP_REBIN); + accelEntries[4].Set (wxACCEL_CTRL, static_cast('E'), PJMENU_RECONSTRUCT_FOURIER); + accelEntries[5].Set (wxACCEL_CTRL, static_cast('I'), PJMENU_FILE_PROPERTIES); + accelEntries[6].Set (wxACCEL_CTRL, static_cast('T'), PJMENU_PLOT_TTHETA_SAMPLING); + wxAcceleratorTable accelTable (7, accelEntries); subframe->SetAcceleratorTable (accelTable); return subframe;