- delete pReconstructor;
- ImageFileDocument* pReconDoc = theApp->newImageDoc();
- if (! pReconDoc) {
- sys_error (ERR_SEVERE, "Unable to create image file");
- return;
- }
- pReconDoc->setImageFile (pImageFile);
- if (theApp->getAskDeleteNewDocs())
- pReconDoc->Modify (true);
- pReconDoc->UpdateAllViews (this);
- if (ImageFileView* rasterView = pReconDoc->getView()) {
- rasterView->OnUpdate (rasterView, NULL);
- rasterView->getFrame()->SetFocus();
- rasterView->getFrame()->Show(true);
- }
- *theApp->getLog() << os.str().c_str() << "\n";
- pImageFile->labelAdd (rProj.getLabel());
- pImageFile->labelAdd (os.str().c_str(), timerRecon.timerEnd());
-#endif
- }
- }
- }
-#else
- wxMessageBox ("Fourier Reconstruction is not yet supported", "Unimplemented function");
-#endif
-}
-
-void
-ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
-{
- DialogGetReconstructionParameters dialogReconstruction (getFrameForChild(), m_iDefaultNX, m_iDefaultNY,
- m_iDefaultFilter, m_dDefaultFilterParam, m_iDefaultFilterMethod, m_iDefaultFilterGeneration,
- m_iDefaultZeropad, m_iDefaultInterpolation, m_iDefaultInterpParam, m_iDefaultBackprojector,
- m_iDefaultTrace);
-
- int retVal = dialogReconstruction.ShowModal();
- if (retVal == wxID_OK) {
- m_iDefaultNX = dialogReconstruction.getXSize();
- m_iDefaultNY = dialogReconstruction.getYSize();
- wxString optFilterName = dialogReconstruction.getFilterName();
- m_iDefaultFilter = SignalFilter::convertFilterNameToID (optFilterName.c_str());
- m_dDefaultFilterParam = dialogReconstruction.getFilterParam();
- wxString optFilterMethodName = dialogReconstruction.getFilterMethodName();
- m_iDefaultFilterMethod = ProcessSignal::convertFilterMethodNameToID(optFilterMethodName.c_str());
- m_iDefaultZeropad = dialogReconstruction.getZeropad();
- wxString optFilterGenerationName = dialogReconstruction.getFilterGenerationName();
- m_iDefaultFilterGeneration = ProcessSignal::convertFilterGenerationNameToID (optFilterGenerationName.c_str());
- wxString optInterpName = dialogReconstruction.getInterpName();
- m_iDefaultInterpolation = Backprojector::convertInterpNameToID (optInterpName.c_str());
- m_iDefaultInterpParam = dialogReconstruction.getInterpParam();
- 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);
-
- 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, true)) {
- delete pDlgReconstruct;
+ *theApp->getLog() << os.str().c_str() << "\n";
+ pImageFile->labelAdd (rProj.getLabel());
+ pImageFile->labelAdd (os.str().c_str(), timerRecon.timerEnd());
+
+ } else {
+ if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) {
+ ThreadedReconstructor* pReconstructor = new ThreadedReconstructor (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());
+ if (! pReconstructor->start()) {