From 99e0682c24409926fb1afd867db88a4803c734e7 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 28 Mar 2001 16:44:41 +0000 Subject: [PATCH] r644: no message --- src/views.cpp | 62 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/src/views.cpp b/src/views.cpp index 4de349e..631f481 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.140 2001/03/21 21:45:31 kevin Exp $ +** $Id: views.cpp,v 1.141 2001/03/28 16:44: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 @@ -791,15 +791,13 @@ void ImageFileView::OnMagnitude (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); - if (rIF.isComplex()) { - rIF.magnitude (rIF); - rIF.labelAdd ("Magnitude of complex-image"); - m_bMinSpecified = false; - m_bMaxSpecified = false; - if (theApp->getAskDeleteNewDocs()) - GetDocument()->Modify (true); - GetDocument()->UpdateAllViews (this); - } + rIF.magnitude (rIF); + rIF.labelAdd ("Magnitude"); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); + GetDocument()->UpdateAllViews (this); GetDocument()->Activate(); } @@ -1069,12 +1067,10 @@ ImageFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) m_pFilterMenu->Enable(IFMENU_FILTER_REAL, true); m_pFilterMenu->Enable(IFMENU_FILTER_IMAGINARY, true); m_pFilterMenu->Enable(IFMENU_FILTER_PHASE, true); - m_pFilterMenu->Enable(IFMENU_FILTER_MAGNITUDE, true); } else { m_pFilterMenu->Enable(IFMENU_FILTER_REAL, false); m_pFilterMenu->Enable(IFMENU_FILTER_IMAGINARY, false); m_pFilterMenu->Enable(IFMENU_FILTER_PHASE, false); - m_pFilterMenu->Enable(IFMENU_FILTER_MAGNITUDE, false); } ImageFileArrayConst v = rIF.getArray(); int nx = rIF.nx(); @@ -2770,7 +2766,46 @@ ProjectionFileView::OnConvertParallel (wxCommandEvent& event) void ProjectionFileView::OnReconstructFourier (wxCommandEvent& event) { - wxMessageBox ("Fourier Reconstruction is not yet supported", "Unimplemented function"); + Projections& rProj = GetDocument()->getProjections(); + DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Fourier Reconstruction", m_iDefaultPolarNX, m_iDefaultPolarNY, + m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad); + if (dialogPolar.ShowModal() == wxID_OK) { + wxProgressDialog dlgProgress (wxString("Reconstruction Fourier"), wxString("Reconstruction Progress"), 1, getFrameForChild(), wxPD_APP_MODAL); + wxString strInterpolation (dialogPolar.getInterpolationName()); + m_iDefaultPolarNX = dialogPolar.getXSize(); + m_iDefaultPolarNY = dialogPolar.getYSize(); + m_iDefaultPolarZeropad = dialogPolar.getZeropad(); + ImageFile* pIF = new ImageFile (m_iDefaultPolarNX, m_iDefaultPolarNY); + + m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str()); + if (! rProj.convertFFTPolar (*pIF, m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad)) { + delete pIF; + *theApp->getLog() << "Error converting to polar\n"; + return; + } + pIF->ifft(*pIF); + pIF->magnitude(*pIF); + Fourier::shuffleFourierToNaturalOrder (*pIF); + + ImageFileDocument* pPolarDoc = theApp->newImageDoc(); + if (! pPolarDoc) { + sys_error (ERR_SEVERE, "Unable to create image file"); + return; + } + pPolarDoc->setImageFile (pIF); + pIF->labelAdd (rProj.getLabel().getLabelString().c_str(), rProj.calcTime()); + std::ostringstream os; + os << "Reconstruct Fourier " << GetFrame()->GetTitle().c_str() << ": xSize=" + << m_iDefaultPolarNX << ", ySize=" << m_iDefaultPolarNY << ", interpolation=" + << strInterpolation.c_str() << ", zeropad=" << m_iDefaultPolarZeropad; + *theApp->getLog() << os.str().c_str() << "\n"; + pIF->labelAdd (os.str().c_str()); + if (theApp->getAskDeleteNewDocs()) + pPolarDoc->Modify (true); + pPolarDoc->getView()->getFrame()->Show(true); + pPolarDoc->UpdateAllViews (); + pPolarDoc->Activate(); + } } void @@ -2995,7 +3030,6 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) 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); wxMenu *help_menu = new wxMenu; help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1"); -- 2.34.1