X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fthreadrecon.cpp;h=e8deca41e6809f065135d49d6eaa946d88d7e144;hb=de411914da8b157958e9caae917bf1edeafbb713;hp=0ec059bbcb2293be950c8731d8b29878deafe068;hpb=cd93aebb4dec4e0ae88d53f131c2320ae92d0cab;p=ctsim.git diff --git a/src/threadrecon.cpp b/src/threadrecon.cpp index 0ec059b..e8deca4 100644 --- a/src/threadrecon.cpp +++ b/src/threadrecon.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: threadrecon.cpp,v 1.20 2001/03/04 22:30:20 kevin Exp $ +** $Id: threadrecon.cpp,v 1.24 2001/03/11 15:27:30 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 @@ -54,11 +54,11 @@ ReconstructorSupervisorThread::ReconstructorSupervisorThread (ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam, - const char* pszBackprojectName, const char* const pszLabel) -: m_pProjView(pProjView), m_iNX(iNX), m_iNY(iNY), m_strFilterName(pszFilterName), m_dFilterParam(dFilterParam), + const char* pszBackprojectName, const char* const pszLabel, ReconstructionROI* pROI) +: SupervisorThread(), m_pProjView(pProjView), m_iNX(iNX), m_iNY(iNY), m_strFilterName(pszFilterName), m_dFilterParam(dFilterParam), m_strFilterMethod(pszFilterMethod), m_iZeropad(iZeropad), m_strFilterGenerationName(pszFilterGenerationName), - m_strInterpName(pszInterpName), m_iInterpParam(iInterpParam), m_strBackprojectName(pszBackprojectName), m_strLabel(pszLabel), - SupervisorThread() + m_strInterpName(pszInterpName), m_iInterpParam(iInterpParam), m_strBackprojectName(pszBackprojectName), + m_strLabel(pszLabel), m_reconROI(*pROI) { } @@ -67,7 +67,7 @@ ReconstructorSupervisorThread::Entry() { ReconstructorSupervisor reconSupervisor (this, m_pProjView, m_iNX, m_iNY, m_strFilterName.c_str(), m_dFilterParam, m_strFilterMethod.c_str(), m_iZeropad, m_strFilterGenerationName.c_str(), - m_strInterpName.c_str(), m_iInterpParam, m_strBackprojectName.c_str(), m_strLabel.c_str()); + m_strInterpName.c_str(), m_iInterpParam, m_strBackprojectName.c_str(), m_strLabel.c_str(), &m_reconROI); reconSupervisor.start(); while (! reconSupervisor.workersDone() && ! reconSupervisor.fail() && ! reconSupervisor.cancelled()) { @@ -86,11 +86,7 @@ ReconstructorSupervisorThread::Entry() reconSupervisor.onDone(); reconSupervisor.deleteWorkers(); - while (! reconSupervisor.workersDeleted()) { - Sleep(50); - } - - return reinterpret_cast(0); + return static_cast(0); } void @@ -108,13 +104,14 @@ ReconstructorSupervisorThread::OnExit() ReconstructorSupervisor::ReconstructorSupervisor (SupervisorThread* pThread, ProjectionFileView* pProjView, int iImageNX, int iImageNY, const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam, - const char* pszBackprojectName, const char* const pszLabel) - : m_pProjView(pProjView), m_pProjDoc(pProjView->GetDocument()), + const char* pszBackprojectName, const char* const pszLabel, ReconstructionROI* pROI) + : BackgroundSupervisor (pThread, pProjView->GetFrame(), pProjView->GetDocument(), "Reconstructing", pProjView->GetDocument()->getProjections().nView()), + m_pProjView(pProjView), m_pProjDoc(pProjView->GetDocument()), m_iImageNX(iImageNX), m_iImageNY(iImageNY), m_pszFilterName(pszFilterName), m_dFilterParam(dFilterParam), m_pszFilterMethod(pszFilterMethod), m_iZeropad(iZeropad), m_pszFilterGenerationName(pszFilterGenerationName), m_pszInterpName(pszInterpName), - m_iInterpParam(iInterpParam), m_pszBackprojectName(pszBackprojectName), m_pszLabel(pszLabel), - BackgroundSupervisor (pThread, pProjView->GetFrame(), pProjView->GetDocument(), "Reconstructing", pProjView->GetDocument()->getProjections().nView()) + m_iInterpParam(iInterpParam), m_pszBackprojectName(pszBackprojectName), m_pszLabel(pszLabel), + m_pReconROI(pROI) { m_vecpChildImageFile.reserve (getNumWorkers()); for (int iThread = 0; iThread < getNumWorkers(); iThread++) { @@ -137,7 +134,7 @@ ReconstructorSupervisor::createWorker (int iThread, int iStartUnit, int iNumUnit ReconstructorWorker* pThread = new ReconstructorWorker (this, iThread, iStartUnit, iNumUnits); pThread->SetParameters (m_pProjView, m_vecpChildImageFile[iThread], m_pszFilterName, m_dFilterParam, m_pszFilterMethod, m_iZeropad, m_pszFilterGenerationName, m_pszInterpName, - m_iInterpParam, m_pszBackprojectName); + m_iInterpParam, m_pszBackprojectName, m_pReconROI); return pThread; } @@ -195,7 +192,7 @@ void ReconstructorWorker::SetParameters (ProjectionFileView* pProjView, ImageFile* pImageFile, const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam, - const char* pszBackprojectName) + const char* pszBackprojectName, ReconstructionROI* pROI) { m_pProjView = pProjView; m_pImageFile = pImageFile; @@ -207,6 +204,7 @@ ReconstructorWorker::SetParameters (ProjectionFileView* pProjView, ImageFile* pI m_pszInterpName = pszInterpName; m_iInterpParam = iInterpParam; m_pszBackprojectName = pszBackprojectName; + m_pReconROI = pROI; } wxThread::ExitCode @@ -214,7 +212,8 @@ ReconstructorWorker::Entry () { Reconstructor* pReconstructor = new Reconstructor (m_pProjView->GetDocument()->getProjections(), *m_pImageFile, m_pszFilterName, m_dFilterParam, m_pszFilterMethod, m_iZeropad, - m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE); + m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE, + m_pReconROI); bool bFail = pReconstructor->fail(); std::string failMsg;