** 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
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();
}
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();
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
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");