** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.107 2001/02/19 20:23:17 kevin Exp $
+** $Id: views.cpp,v 1.110 2001/02/20 18:10:45 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
m_iDefaultNDet = 367;
m_iDefaultNView = 320;
#endif
- m_iDefaultNSample = 1;
+ m_iDefaultNSample = 2;
m_dDefaultRotation = 1;
m_dDefaultFocalLength = 2;
m_dDefaultViewRatio = 1;
return;
}
pProj->initFromScanner (theScanner);
- m_dDefaultRotation /= PI; // convert back to PI units
+ m_dDefaultRotation /= TWOPI; // convert back to fraction of a circle
Timer timer;
if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
m_iDefaultPolarNX = dialogPolar.getXSize();
m_iDefaultPolarNY = dialogPolar.getYSize();
ImageFileDocument* pPolarDoc = theApp->newImageDoc();
- ImageFile& rIF = pPolarDoc->getImageFile();
+ ImageFile* pIF = new ImageFile (m_iDefaultPolarNX, m_iDefaultPolarNY);
+ m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str());
+ if (! rProj.convertPolar (*pIF, m_iDefaultPolarInterpolation)) {
+ delete pIF;
+ *theApp->getLog() << "Error converting to Polar\n";
+ return;
+ }
+ pPolarDoc = theApp->newImageDoc ();
if (! pPolarDoc) {
sys_error (ERR_SEVERE, "Unable to create image file");
return;
}
- rIF.setArraySize (m_iDefaultPolarNX, m_iDefaultPolarNY);
- m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str());
- rProj.convertPolar (rIF, m_iDefaultPolarInterpolation);
- rIF.labelAdd (rProj.getLabel().getLabelString().c_str(), rProj.calcTime());
+ pPolarDoc->setImageFile (pIF);
+ pIF->labelAdd (rProj.getLabel().getLabelString().c_str(), rProj.calcTime());
std::ostringstream os;
os << "Convert projection file " << GetFrame()->GetTitle().c_str() << " to polar image: xSize="
<< m_iDefaultPolarNX << ", ySize=" << m_iDefaultPolarNY << ", interpolation="
<< strInterpolation.c_str();
*theApp->getLog() << os.str().c_str() << "\n";
- rIF.labelAdd (os.str().c_str());
+ pIF->labelAdd (os.str().c_str());
if (theApp->getAskDeleteNewDocs())
pPolarDoc->Modify (true);
pPolarDoc->UpdateAllViews ();
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;
+ }
ImageFileDocument* pPolarDoc = theApp->newImageDoc();
- ImageFile& rIF = pPolarDoc->getImageFile();
if (! pPolarDoc) {
sys_error (ERR_SEVERE, "Unable to create image file");
return;
}
- rIF.setArraySize (m_iDefaultPolarNX, m_iDefaultPolarNY);
- m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str());
- rProj.convertFFTPolar (rIF, m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad);
- rIF.labelAdd (rProj.getLabel().getLabelString().c_str(), rProj.calcTime());
+ pPolarDoc->setImageFile (pIF);
+ pIF->labelAdd (rProj.getLabel().getLabelString().c_str(), rProj.calcTime());
std::ostringstream os;
os << "Convert projection file " << GetFrame()->GetTitle().c_str() << " to FFT polar image: xSize="
<< m_iDefaultPolarNX << ", ySize=" << m_iDefaultPolarNY << ", interpolation="
<< strInterpolation.c_str() << ", zeropad=" << m_iDefaultPolarZeropad;
*theApp->getLog() << os.str().c_str() << "\n";
- rIF.labelAdd (os.str().c_str());
+ pIF->labelAdd (os.str().c_str());
if (theApp->getAskDeleteNewDocs())
pPolarDoc->Modify (true);
pPolarDoc->UpdateAllViews ();
wxString optBackprojectName = dialogReconstruction.getBackprojectName();
m_iDefaultBackprojector = Backprojector::convertBackprojectNameToID (optBackprojectName.c_str());
m_iDefaultTrace = dialogReconstruction.getTrace();
+
if (m_iDefaultNX > 0 && m_iDefaultNY > 0) {
const Projections& rProj = GetDocument()->getProjections();
-
ImageFile* pImageFile = new ImageFile;
pImageFile->setArraySize (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);
+ 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);
Timer timerRecon;
if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstructor, rProj, *pImageFile, m_iDefaultTrace, getFrameForChild());
for (int iView = 0; iView < rProj.nView(); iView++) {
::wxYield();
- if (pDlgReconstruct->isCancelled() || ! pDlgReconstruct->reconstructView (iView)) {
+ if (pDlgReconstruct->isCancelled() || ! pDlgReconstruct->reconstructView (iView, true)) {
delete pDlgReconstruct;
delete pReconstructor;
delete pImageFile;
return;
}
::wxYield();
+ ::wxYield();
while (pDlgReconstruct->isPaused()) {
::wxYield();
::wxUsleep(50);
delete pDlgReconstruct;
} else {
wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, getFrameForChild(), wxPD_CAN_ABORT);
- for (int i = 0; i < rProj.nView(); i++) {
- pReconstructor->reconstructView (i, 1);
- if (! dlgProgress.Update (i + 1)) {
+ for (int iView = 0; iView < rProj.nView(); iView++) {
+ pReconstructor->reconstructView (iView, 1);
+ if (! dlgProgress.Update (iView + 1)) {
delete pReconstructor;
delete pImageFile;
return;