** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadrecon.cpp,v 1.3 2001/02/22 18:22:40 kevin Exp $
+** $Id: threadrecon.cpp,v 1.5 2001/02/23 03:28:26 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
int iExtraViews = m_iTotalViews % m_iNumThreads;
m_vecpChildImageFile.reserve (m_iNumThreads);
- m_vecpReconstructor.reserve (m_iNumThreads);
m_vecpThread.reserve (m_iNumThreads);
for (unsigned int iProc = 0; iProc < m_iNumThreads; iProc++) {
m_vecpChildImageFile[iProc] = new ImageFile (iImageNX, iImageNY);
- m_vecpReconstructor[iProc] = new Reconstructor (m_pProjView->GetDocument()->getProjections(), *m_vecpChildImageFile[iProc],
- pszFilterName, dFilterParam, pszFilterMethod, iZeropad, pszFilterGenerationName,
- pszInterpName, iInterpParam, pszBackprojectName, Trace::TRACE_NONE);
int iStartView = iProc * iBaseViews;
int iNumViews = iBaseViews;
if (iProc < iExtraViews)
++iNumViews;
- m_vecpThread[iProc] = new ReconstructionThread (this, m_vecpReconstructor[iProc], iProc, iStartView, iNumViews);
+ m_vecpThread[iProc] = new ReconstructionThread (this, pProjView, m_vecpChildImageFile[iProc], iProc, iStartView, iNumViews,
+ pszFilterName, dFilterParam, pszFilterMethod, iZeropad, pszFilterGenerationName, pszInterpName, iInterpParam, pszBackprojectName);
if (m_vecpThread[iProc]->Create () != wxTHREAD_NO_ERROR) {
m_bFail = true;
break;
m_pProjView->GetDocument()->addReconstructor (this);
if (! theApp->getUseBackgroundTasks())
m_pDialogProgress = new wxProgressDialog (_T("Filtered Backprojection"), _T("Reconstruction Progress"), m_iTotalViews, m_pProjView->getFrame(), wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
- else
- m_pGauge = theApp->getBackgroundManager()->addTask (this, m_iTotalViews, m_pProjView->GetFrame()->GetTitle());
+ else {
+ std::string strLabel ("Reconstructing ");
+ strLabel += m_pProjView->GetFrame()->GetTitle();
+ m_pGauge = theApp->getBackgroundManager()->addTask (this, m_iTotalViews, strLabel.c_str());
+ }
m_iRunning = m_iNumThreads;
m_iViewsDone = 0;
for (i = 0; i < m_iNumThreads; i++) {
delete m_vecpChildImageFile[i];
m_vecpChildImageFile[i] = NULL;
- }
- for (i = 0; i < m_iNumThreads; i++) {
- delete m_vecpReconstructor[i];
- m_vecpReconstructor[i] = NULL;
- }
-
+ }
m_iNumThreads = 0;
m_iRunning = 0;
{
wxCriticalSection doneSection;
doneSection.Enter();
-
+
m_pProjView->GetDocument()->removeReconstructor (this);
ImageFileDocument* pReconDoc = theApp->newImageDoc();
if (! pReconDoc) {
doneSection.Leave();
return;
}
-
- for (int i = 0; i < m_iNumThreads; i++) {
- delete m_vecpReconstructor[i];
- m_vecpReconstructor[i] = NULL;
- }
-
+
ImageFile* pImageFile = getImageFile();
pReconDoc->setImageFile (pImageFile);
if (theApp->getAskDeleteNewDocs())
}
-ReconstructionThread::ReconstructionThread (ThreadedReconstructor* pSupervisor,
- Reconstructor* pReconstructor, int iThread, int iStartView, int iNumViews)
- : m_pSupervisor(pSupervisor), m_pReconstructor(pReconstructor),
+ReconstructionThread::ReconstructionThread
+(ThreadedReconstructor* pSupervisor, ProjectionFileView* pProjView, ImageFile* pImageFile, int iThread, int iStartView, int iNumViews,
+ const char* pszFilterName, double dFilterParam, const char* pszFilterMethod,
+ int iZeropad, const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam,
+ const char* pszBackprojectName)
+ : m_pSupervisor(pSupervisor),
m_iStartView(iStartView), m_iNumViews(iNumViews), m_iThread(iThread),
wxThread(wxTHREAD_DETACHED)
{
+ m_pReconstructor = new Reconstructor (pProjView->GetDocument()->getProjections(),
+ *pImageFile, pszFilterName, dFilterParam, pszFilterMethod, iZeropad, pszFilterGenerationName,
+ pszInterpName, iInterpParam, pszBackprojectName, Trace::TRACE_NONE);
}
wxThread::ExitCode
ReconstructionThread::Entry ()
{
wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, RECONSTRUCTION_THREAD_EVENT);
+
for (int iView = 0; iView < m_iNumViews; iView++) {
if (TestDestroy()) {
wxString msg;
eventProgress.SetInt (RTHREAD_UNIT_COMPLETE);
wxPostEvent (m_pSupervisor, eventProgress);
}
+ m_pReconstructor->postProcessing();
eventProgress.SetInt (m_iThread); // Send back thread# that has finished
wxPostEvent (m_pSupervisor, eventProgress);
void
ReconstructionThread::OnExit ()
{
+ delete m_pReconstructor;
}