--------------------Configuration: ctsim - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP28E.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2E5.tmp" with contents
[
/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.4\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"C:\ctsim\src\backgroundmgr.cpp"
"C:\ctsim\src\threadrecon.cpp"
"C:\ctsim\src\backgroundsupr.cpp"
]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP28E.tmp"
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP28F.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2E5.tmp"
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2E6.tmp" with contents
[
/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.4\" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"C:\ctsim\src\ctsim.cpp"
"C:\ctsim\src\docs.cpp"
"C:\ctsim\src\views.cpp"
]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP28F.tmp"
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP290.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2E6.tmp"
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2E7.tmp" with contents
[
winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib"
.\Debug\backgroundmgr.obj
.\Debug\views.obj
.\Debug\ctsim.res
.\Debug\backgroundsupr.obj
+.\Debug\threadproj.obj
\ctsim\msvc\libctsim\Debug\libctsim.lib
"\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib"
"\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"
\wx2.2.5\lib\zlibd.lib
\wx2.2.5\lib\tiffd.lib
]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP290.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2E7.tmp"
<h3>Output Window</h3>
Compiling...
threadrecon.cpp
graph3dview.cpp
backgroundsupr.cpp
Compiling...
+views.cpp
Skipping... (no relevant changes detected)
ctsim.cpp
dialogs.cpp
docs.cpp
-views.cpp
Linking...
bin_PROGRAMS=ctsim
-ctsim_SOURCES=ctsim.cpp docs.cpp views.cpp dialogs.cpp ctsim.h docs.h views.h dialogs.h dlgprojections.cpp dlgprojections.h dlgreconstruct.cpp dlgreconstruct.h graph3dview.cpp graph3dview.h ctsim-map.h ctsim.xpm splash.xpm tips.cpp tips.h threadrecon.cpp threadrecon.h backgroundmgr.cpp backgroundmgr.h
+ctsim_SOURCES=ctsim.cpp docs.cpp views.cpp dialogs.cpp ctsim.h docs.h views.h dialogs.h dlgprojections.cpp dlgprojections.h dlgreconstruct.cpp dlgreconstruct.h graph3dview.cpp graph3dview.h ctsim-map.h ctsim.xpm splash.xpm tips.cpp tips.h threadrecon.cpp threadrecon.h backgroundmgr.cpp backgroundmgr.h backgroundsupr.cpp backgroundsupr.h threadproj.cpp threadproj.h
ctsim_DEPENDENCIES=../libctgraphics/libctgraphics.a ../libctsupport/libctsupport.a ../libctsim/libctsim.a ../include/ct.h
ctsim_LDADD=-L../libctgraphics -L../libctsupport -L../libctsim @ctlibs@
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundmgr.cpp,v 1.7 2001/02/25 07:36:26 kevin Exp $
+** $Id: backgroundmgr.cpp,v 1.8 2001/02/25 10:52:55 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_sizeLabel.Set (140, 20);
m_sizeBorder.Set (4, 4);
m_sizeCellSpacing.Set (3, 3);
- m_sizeButton.Set (70, 20);
+ //m_sizeButton.Set (70, 20);
+ m_sizeButton.Set (0, 0);
m_sizeCell.Set (m_sizeGauge.x + m_sizeLabel.x + m_sizeCellSpacing.x + m_sizeButton.x, 25);
wxPoint posButton (m_sizeBorder.x + m_sizeGauge.x + m_sizeLabel.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, posGauge, m_sizeGauge);
wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, pszTaskName, posLabel, m_sizeLabel);
- wxButton* pCancelButton = new wxButton (m_pCanvas, iFirstUnusedPos, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT);
+// wxButton* pCancelButton = new wxButton (m_pCanvas, iFirstUnusedPos, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT);
m_vecpBackgroundTasks.push_back (pTask);
m_vecpGauges.push_back (pGauge);
m_vecpNames.push_back (new std::string (pszTaskName));
m_vecpPositions.push_back (iFirstUnusedPos);
m_vecpLabels.push_back (pLabel);
- m_vecpCancelButtons.push_back (pCancelButton);
+ //m_vecpCancelButtons.push_back (pCancelButton);
m_iNumTasks++;
resizeWindow();
GaugeContainer::iterator iGauge = m_vecpGauges.begin();
PositionContainer::iterator iPosition = m_vecpPositions.begin();
LabelContainer::iterator iLabel = m_vecpLabels.begin();
- ButtonContainer::iterator iCancelButton = m_vecpCancelButtons.begin();
+ //ButtonContainer::iterator iCancelButton = m_vecpCancelButtons.begin();
for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
if (*iTask == pTask) {
delete *iName;
delete *iGauge;
delete *iLabel;
- delete *iCancelButton;
+ //delete *iCancelButton;
m_vecpBackgroundTasks.erase (iTask);
m_vecpGauges.erase (iGauge);
m_vecpNames.erase (iName);
m_vecpPositions.erase (iPosition);
m_vecpLabels.erase (iLabel);
- m_vecpCancelButtons.erase (iCancelButton);
+ //m_vecpCancelButtons.erase (iCancelButton);
m_iNumTasks--;
break;
}
iGauge++;
iPosition++;
iLabel++;
- iCancelButton++;
+ //iCancelButton++;
}
resizeWindow();
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundmgr.h,v 1.6 2001/02/25 07:36:26 kevin Exp $
+** $Id: backgroundmgr.h,v 1.7 2001/02/25 10:52:55 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
#if CTSIM_MDI
//class BackgroundManager : public wxMDIChildFrame
-//#else
-class BackgroundManager : public wxMiniFrame
#endif
+class BackgroundManager : public wxMiniFrame
{
private:
DECLARE_DYNAMIC_CLASS(BackgroundManager)
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: ctsim.cpp,v 1.88 2001/02/22 15:00:20 kevin Exp $
+** $Id: ctsim.cpp,v 1.89 2001/02/25 10:52:55 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
#endif
#endif
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.88 2001/02/22 15:00:20 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.89 2001/02/25 10:52:55 kevin Exp $";
struct option CTSimApp::ctsimOptions[] =
{
rIF.setArraySize (m_iDefaultFilterXSize, m_iDefaultFilterYSize);
rIF.filterResponse (strDomain.c_str(), m_dDefaultFilterBandwidth, strFilter.c_str(), m_dDefaultFilterParam, m_dDefaultFilterInputScale, m_dDefaultFilterOutputScale);
rIF.labelAdd (os.str().c_str());
- pFilterDoc->Modify (true);
+ if (theApp->getAskDeleteNewDocs())
+ pFilterDoc->Modify (true);
pFilterDoc->UpdateAllViews();
pFilterDoc->GetFirstView()->OnUpdate (NULL, NULL);
pFilterDoc->getView()->getFrame()->SetClientSize(m_iDefaultFilterXSize, m_iDefaultFilterYSize);
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: docs.cpp,v 1.28 2001/02/25 06:32:12 kevin Exp $
+** $Id: docs.cpp,v 1.29 2001/02/25 10:52:55 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
return true;
}
-// ProjectionFileDocument
+// BackgroundProcessingDocument - Base Class
-IMPLEMENT_DYNAMIC_CLASS(ProjectionFileDocument, wxDocument)
-BEGIN_EVENT_TABLE(ProjectionFileDocument, wxDocument)
-EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_ADD, ProjectionFileDocument::OnAddBackground)
-EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_REMOVE, ProjectionFileDocument::OnRemoveBackground)
+IMPLEMENT_DYNAMIC_CLASS(BackgroundProcessingDocument, wxDocument)
+BEGIN_EVENT_TABLE(BackgroundProcessingDocument, wxDocument)
+EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_ADD, BackgroundProcessingDocument::OnAddBackground)
+EVT_MENU(BackgroundSupervisor::MSG_BACKGROUND_SUPERVISOR_REMOVE, BackgroundProcessingDocument::OnRemoveBackground)
END_EVENT_TABLE()
-bool
-ProjectionFileDocument::OnSaveDocument(const wxString& filename)
-{
- if (! m_pProjectionFile->write (filename.c_str())) {
- *theApp->getLog() << "Unable to write projection file " << filename << "\n";
- return false;
- }
- if (theApp->getVerboseLogging())
- *theApp->getLog() << "Wrote projection file " << filename << "\n";
- Modify(false);
- return true;
-}
-
-ProjectionFileDocument::~ProjectionFileDocument()
-{
- m_criticalSection.Enter();
- for (BackgroundContainer::iterator i = m_vecpBackgroundSupervisors.begin();
- i != m_vecpBackgroundSupervisors.end(); i++)
- BackgroundSupervisor::cancelSupervisor(*i);
- m_criticalSection.Leave();
-
- while (m_vecpBackgroundSupervisors.size() > 0) {
- ::wxUsleep(50);
- ::wxYield();
- }
-
- delete m_pProjectionFile;
-}
-
void
-ProjectionFileDocument::OnAddBackground (wxCommandEvent& event)
+BackgroundProcessingDocument::OnAddBackground (wxCommandEvent& event)
{
BackgroundSupervisor* pSupervisor = reinterpret_cast<BackgroundSupervisor*>(event.GetClientData());
wxASSERT (pSupervisor != NULL);
}
void
-ProjectionFileDocument::OnRemoveBackground (wxCommandEvent& event)
+BackgroundProcessingDocument::OnRemoveBackground (wxCommandEvent& event)
{
BackgroundSupervisor* pSupervisor = reinterpret_cast<BackgroundSupervisor*>(event.GetClientData());
wxASSERT (pSupervisor != NULL);
m_criticalSection.Leave();
if (! bFound)
- sys_error (ERR_SEVERE, "Could not find background task [ProjectionFileDocument::removeBackgroundTask");
+ sys_error (ERR_SEVERE, "Could not find background task [OnRemoveBackground]");
wxCommandEvent ackEvent (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_DOCUMENT_ACK_REMOVE);
wxPostEvent (pSupervisor, ackEvent);
}
+void
+BackgroundProcessingDocument::cancelRunningTasks()
+{
+ m_criticalSection.Enter();
+ for (BackgroundContainer::iterator i = m_vecpBackgroundSupervisors.begin();
+ i != m_vecpBackgroundSupervisors.end(); i++)
+ BackgroundSupervisor::cancelSupervisor(*i);
+ m_criticalSection.Leave();
+
+ while (m_vecpBackgroundSupervisors.size() > 0) {
+ ::wxUsleep(50);
+ ::wxYield();
+ }
+}
+
+
+// ProjectionFileDocument
+
+IMPLEMENT_DYNAMIC_CLASS(ProjectionFileDocument, BackgroundProcessingTask)
+
+bool
+ProjectionFileDocument::OnSaveDocument(const wxString& filename)
+{
+ if (! m_pProjectionFile->write (filename.c_str())) {
+ *theApp->getLog() << "Unable to write projection file " << filename << "\n";
+ return false;
+ }
+ if (theApp->getVerboseLogging())
+ *theApp->getLog() << "Wrote projection file " << filename << "\n";
+ Modify(false);
+ return true;
+}
+
+ProjectionFileDocument::~ProjectionFileDocument()
+{
+ cancelRunningTasks();
+
+ delete m_pProjectionFile;
+}
+
bool
ProjectionFileDocument::OnOpenDocument(const wxString& filename)
{
// PhantomFileDocument
-IMPLEMENT_DYNAMIC_CLASS(PhantomFileDocument, wxDocument)
+IMPLEMENT_DYNAMIC_CLASS(PhantomFileDocument, BackgroundProcessingTask)
bool
PhantomFileDocument::OnOpenDocument(const wxString& filename)
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: docs.h,v 1.24 2001/02/23 21:58:31 kevin Exp $
+** $Id: docs.h,v 1.25 2001/02/25 10:52:55 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
void setBadFileOpen() { m_bBadFileOpen = true; }
};
+class BackgroundProcessingDocument : public wxDocument
+{
+private:
+ DECLARE_DYNAMIC_CLASS(BackgroundProcessingDocument)
+ typedef BackgroundSupervisor BackgroundObject;
+ typedef std::vector<BackgroundObject*> BackgroundContainer;
+ BackgroundContainer m_vecpBackgroundSupervisors;
+ wxCriticalSection m_criticalSection;
+
+public:
+ BackgroundProcessingDocument()
+ : wxDocument()
+ {}
+
+ void cancelRunningTasks();
+ void OnAddBackground (wxCommandEvent& event);
+ void OnRemoveBackground (wxCommandEvent& event);
-class ProjectionFileDocument: public wxDocument
+ DECLARE_EVENT_TABLE()
+};
+
+class ProjectionFileDocument: public BackgroundProcessingDocument
{
private:
DECLARE_DYNAMIC_CLASS(ProjectionFileDocument)
Projections* m_pProjectionFile;
bool m_bBadFileOpen;
- typedef BackgroundSupervisor BackgroundObject;
- typedef std::vector<BackgroundObject*> BackgroundContainer ;
- BackgroundContainer m_vecpBackgroundSupervisors;
- wxCriticalSection m_criticalSection;
public:
virtual bool OnSaveDocument (const wxString& filename);
ProjectionFileView* getView() const;
bool getBadFileOpen() const { return m_bBadFileOpen; }
void setBadFileOpen() { m_bBadFileOpen = true; }
-
- void OnAddBackground (wxCommandEvent& event);
- void OnRemoveBackground (wxCommandEvent& event);
-
- DECLARE_EVENT_TABLE()
};
-class PhantomFileDocument: public wxDocument
+class PhantomFileDocument: public BackgroundProcessingDocument
{
private:
DECLARE_DYNAMIC_CLASS(PhantomFileDocument)
--- /dev/null
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+** Name: threadproj.cpp
+** Purpose: Threaded projection class
+** Programmer: Kevin Rosenberg
+** Date Started: February 2001
+**
+** This is part of the CTSim program
+** Copyright (C) 1983-2001 Kevin Rosenberg
+**
+** $Id: threadproj.cpp,v 1.1 2001/02/25 10:52:55 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
+** published by the Free Software Foundation.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+******************************************************************************/
+
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "ct.h"
+#include "ctsim.h"
+#include "docs.h"
+#include "views.h"
+#include "threadproj.h"
+#include "backgroundmgr.h"
+#include "backgroundsupr.h"
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// Class ProjectorSupervisorThread -- Thread for Background Supervisor
+//
+/////////////////////////////////////////////////////////////////////
+
+ProjectorSupervisorThread::ProjectorSupervisorThread (PhantomFileView* pProjView, int iNDet, int iNView,
+ const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dViewRatio,
+ double dScanRatio, const char* const pszLabel)
+: m_pPhantomView(pProjView), m_iNDet(iNDet), m_iNView(iNView), m_strGeometry(pszGeometry),
+ m_iNSample(iNSample), m_dRotation(dRotation), m_dFocalLength(dFocalLength), m_dViewRatio(dViewRatio),
+ m_dScanRatio(dScanRatio), m_strLabel(pszLabel),
+ SupervisorThread()
+{
+}
+
+wxThread::ExitCode
+ProjectorSupervisorThread::Entry()
+{
+ ProjectorSupervisor projSupervisor (m_pPhantomView, m_iNDet, m_iNView,
+ m_strGeometry.c_str(), m_iNSample, m_dRotation, m_dFocalLength, m_dViewRatio, m_dScanRatio, m_strLabel.c_str());
+
+ projSupervisor.start();
+ while (! projSupervisor.isDone() && ! projSupervisor.fail()) {
+ Sleep(50);
+ Yield();
+ }
+ if (projSupervisor.fail())
+ {
+ wxString msg ("Error starting Projector supervisor: ");
+ msg += projSupervisor.getFailMessage().c_str();
+ msg += "\n";
+ wxCommandEvent eventLog (wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
+ eventLog.SetString( msg );
+ wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event
+ }
+
+ while (! projSupervisor.workersDeleted()) {
+ Sleep(50);
+ projSupervisor.ProcessPendingEvents();
+ }
+
+ return reinterpret_cast<wxThread::ExitCode>(0);
+}
+
+void
+ProjectorSupervisorThread::OnExit()
+{
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// Class ProjectorSupervisor -- A Background Supervisor
+//
+/////////////////////////////////////////////////////////////////////
+
+ProjectorSupervisor::ProjectorSupervisor (PhantomFileView* pPhantomView, int iNDet, int iNView,
+ const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dViewRatio,
+ double dScanRatio, const char* const pszLabel)
+ : m_pPhantomView(pPhantomView), m_pPhantomDoc(pPhantomView->GetDocument()),
+ m_iNDet(iNDet), m_iNView(iNView),
+ m_pszGeometry(pszGeometry), m_iNSample(iNSample), m_dRotation(dRotation), m_dFocalLength(dFocalLength),
+ m_dViewRatio(dViewRatio), m_dScanRatio(dScanRatio), m_pszLabel(pszLabel),
+ BackgroundSupervisor (pPhantomView->GetFrame(), pPhantomView->GetDocument(), "Projecting", iNView)
+{
+ m_vecpChildProjections.reserve (getNumWorkers());
+ for (unsigned int iThread = 0; iThread < getNumWorkers(); iThread++) {
+ m_vecpChildProjections[iThread] = new Projections (m_iNDet, m_iNView);
+ }
+
+}
+
+ProjectorSupervisor::~ProjectorSupervisor()
+{
+ for (int i = 0; i < getNumWorkers(); i++) {
+ delete m_vecpChildProjections[i];
+ m_vecpChildProjections[i] = NULL;
+ }
+}
+
+BackgroundWorkerThread*
+ProjectorSupervisor::createWorker (int iThread, int iStartUnit, int iNumUnits)
+{
+ ProjectorWorker* pThread = new ProjectorWorker (this, iThread, iStartUnit, iNumUnits);
+ pThread->SetParameters (m_pPhantomView, m_vecpChildProjections[iThread], m_iNDet, m_iNView,
+ m_pszGeometry, m_iNSample, m_dRotation, m_dFocalLength, m_dViewRatio, m_dScanRatio);
+
+ return pThread;
+}
+
+void
+ProjectorSupervisor::onDone()
+{
+ wxCriticalSection doneSection;
+ wxCriticalSectionLocker critsect (doneSection);
+
+ ProjectionFileDocument* pProjDoc = theApp->newProjectionDoc();
+ if (! pProjDoc) {
+ sys_error (ERR_SEVERE, "Unable to create projection file");
+ return;
+ }
+
+ Projections* pProjections = getProjections();
+ pProjDoc->setProjections (pProjections);
+ if (theApp->getAskDeleteNewDocs())
+ pProjDoc->Modify (true);
+ pProjDoc->UpdateAllViews (NULL);
+ if (ProjectionFileView* projView = pProjDoc->getView()) {
+ projView->OnUpdate (projView, NULL);
+ projView->getFrame()->SetFocus();
+ projView->getFrame()->Show(true);
+ }
+ *theApp->getLog() << m_pszLabel << "\n";
+ pProjections->setRemark (m_pszLabel);
+ pProjections->setCalcTime (getTimerEnd());
+
+ setDone();
+}
+
+
+Projections*
+ProjectorSupervisor::getProjections()
+{
+ Projections* pProjections = new Projections (m_iNDet, m_iNView);
+#if 0
+ ImageFileArray pArray = pImageFile->getArray();
+
+ int i;
+ for (i = 0; i < getNumWorkers(); i++) {
+ ImageFileArrayConst pChildArray = m_vecpChildImageFile[i]->getArray();
+ for (int ix = 0; ix < m_iImageNX; ix++)
+ for (int iy = 0; iy < m_iImageNY; iy++)
+ pArray[ix][iy] += pChildArray[ix][iy];
+ }
+#endif
+ return (pProjections);
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// Class ProjectorWorker -- A worker thread
+//
+/////////////////////////////////////////////////////////////////////
+
+void
+ProjectorWorker::SetParameters (PhantomFileView* pPhantomView, Projections* pProjections, int iNDet, int iView,
+ const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dViewRatio,
+ double dScanRatio)
+{
+ m_pPhantomView = pPhantomView;
+ m_pProjections = pProjections;
+ m_pszGeometry = pszGeometry;
+ m_iNSample = iNSample;
+ m_dFocalLength = dFocalLength;
+ m_dViewRatio = dViewRatio;
+ m_dScanRatio = dScanRatio;
+}
+
+wxThread::ExitCode
+ProjectorWorker::Entry ()
+{
+ const Phantom& rPhantom = m_pPhantomView->GetDocument()->getPhantom();
+ Scanner* pScanner = new Scanner (rPhantom, m_pszGeometry, m_iNDet,
+ m_iNView, m_iNSample, m_dRotation, m_dFocalLength, m_dViewRatio, m_dScanRatio);
+
+ bool bFail = pScanner->fail();
+ wxString failMsg;
+ if (bFail) {
+ failMsg = "Unable to make Projector: ";
+ failMsg += pScanner->failMessage().c_str();
+ wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
+ event.SetString( failMsg );
+ wxPostEvent( theApp->getMainFrame(), event );
+ }
+ else
+ {
+ wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_UNIT_TICK);
+ for (int iUnit = 0; iUnit < m_iNumUnits; iUnit++) {
+ if (TestDestroy()) {
+#ifdef DEBUG
+ if (theApp->getVerboseLogging()) {
+ wxString msg;
+ msg.Printf("Worker thread: Received destroy message at work unit #%d\n", iUnit);
+ wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
+ event.SetString( msg );
+ wxPostEvent( theApp->getMainFrame(), event );
+ }
+#endif
+ break;
+ }
+ pScanner->collectProjections (*m_pProjections, rPhantom, iUnit + m_iStartUnit, 1, true, Trace::TRACE_NONE);
+ wxPostEvent (m_pSupervisor, eventProgress);
+ }
+ }
+ delete pScanner;
+
+ if (bFail) {
+ wxCommandEvent eventFail (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_FAIL);
+ eventFail.SetInt (m_iThread); // Send back thread# that has finished
+ eventFail.SetString (failMsg);
+ wxPostEvent (m_pSupervisor, eventFail);
+ } else {
+ wxCommandEvent eventDone (wxEVT_COMMAND_MENU_SELECTED, BackgroundSupervisor::MSG_WORKER_THREAD_DONE);
+ eventDone.SetInt (m_iThread); // Send back thread# that has finished
+ wxPostEvent (m_pSupervisor, eventDone);
+ }
+
+ while (! TestDestroy())
+ Sleep(100);
+
+ return reinterpret_cast<wxThread::ExitCode>(0);
+}
+
+void
+ProjectorWorker::OnExit ()
+{
+}
--- /dev/null
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+** Name: threadproj.h
+** Purpose: Header file for thread reconstructions
+** Programmer: Kevin Rosenberg
+** Date Started: February 2001
+**
+** This is part of the CTSim program
+** Copyright (C) 1983-2001 Kevin Rosenberg
+**
+** $Id: threadproj.h,v 1.1 2001/02/25 10:52:55 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
+** published by the Free Software Foundation.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+******************************************************************************/
+
+#ifndef _THREADPROJ_H
+#define _THREADPROJ_H
+
+#include <vector>
+#include <wx/thread.h>
+#include <wx/progdlg.h>
+#include "timer.h"
+#include "backgroundsupr.h"
+
+
+class Reconstructor;
+class ImageFile;
+class PhantomFileDocument;
+class ProjectorWorker;
+class ProjectionFileView;
+
+class ProjectorSupervisorThread : public SupervisorThread {
+private:
+ PhantomFileView* m_pPhantomView;
+ const int m_iNDet;
+ const int m_iNView;
+ const std::string m_strGeometry;
+ const int m_iNSample;
+ const double m_dRotation;
+ const double m_dFocalLength;
+ const double m_dViewRatio;
+ const double m_dScanRatio;
+ const std::string m_strLabel;
+
+public:
+ ProjectorSupervisorThread(PhantomFileView* pProjView, int iNDet, int iNView,
+ const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dViewRatio,
+ double dScanRatio, const char* const pszLabel);
+
+ virtual wxThread::ExitCode Entry();
+
+ virtual void OnExit();
+};
+
+
+
+class ProjectorSupervisor : public BackgroundSupervisor {
+private:
+
+ std::vector<Projections*> m_vecpChildProjections;
+ PhantomFileDocument* m_pPhantomDoc;
+ PhantomFileView* m_pPhantomView;
+
+ const int m_iNDet;
+ const int m_iNView;
+ const char* const m_pszGeometry;
+ const int m_iNSample;
+ const double m_dRotation;
+ const double m_dFocalLength;
+ const double m_dViewRatio;
+ const double m_dScanRatio;
+ const char* const m_pszLabel;
+
+
+public:
+ ProjectorSupervisor (PhantomFileView* pProjView, int iNDet, int iNView,
+ const char* pszGeometry, int iNSample, double dRotation, double dFocalLength, double dViewRatio,
+ double dScanRatio, const char* const pszLabel);
+
+ virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
+
+ virtual ~ProjectorSupervisor ();
+
+ void onDone();
+
+ Projections* getProjections();
+
+};
+
+
+
+
+class ProjectorWorker : public BackgroundWorkerThread {
+private:
+ PhantomFileView* m_pPhantomView;
+ Projections* m_pProjections;
+ int m_iNDet;
+ int m_iNView;
+ const char* m_pszGeometry;
+ int m_iNSample;
+ double m_dRotation;
+ double m_dFocalLength;
+ double m_dViewRatio;
+ double m_dScanRatio;
+
+
+public:
+ ProjectorWorker (ProjectorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
+ : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
+ {}
+
+ void SetParameters (PhantomFileView* pPhantomFile, Projections* pProjections, int iNDet, int iView,
+ const char* const pszGeometry, int iNSample, double dRotation, double dFocalLength, double dViewRatio,
+ double dScanRatio);
+
+ virtual wxThread::ExitCode Entry(); // thread execution starts here
+
+ virtual void OnExit();
+};
+
+
+#endif
+
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadrecon.cpp,v 1.11 2001/02/25 08:43:03 kevin Exp $
+** $Id: threadrecon.cpp,v 1.12 2001/02/25 10:52:55 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
//
/////////////////////////////////////////////////////////////////////
+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,
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadrecon.h,v 1.8 2001/02/25 06:32:12 kevin Exp $
+** $Id: threadrecon.h,v 1.9 2001/02/25 10:52:55 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
: BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
{}
- SetParameters (ProjectionFileView* pProjFile, ImageFile* pImageFile,
+ void SetParameters (ProjectionFileView* pProjFile, ImageFile* pImageFile,
const char* const pszFilterName, double dFilterParam, const char* const pszFilterMethod,
int iZeropad, const char* const pszFilterGenerationName, const char* const pszInterpName, int iInterpParam,
const char* pszBackprojectName);
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.117 2001/02/25 06:32:12 kevin Exp $
+** $Id: views.cpp,v 1.118 2001/02/25 10:52:55 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
wxMessageBox (msg, "Error");
return;
}
+ std::ostringstream os;
+ os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet
+ << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample
+ << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength
+ << ", ViewRatio=" << m_dDefaultViewRatio << ", ScanRatio=" << m_dDefaultScanRatio
+ << ", Geometry=" << sGeometry.c_str() << ", FanBeamAngle=" <<
+ convertRadiansToDegrees (theScanner.fanBeamAngle());
pProj->initFromScanner (theScanner);
m_dDefaultRotation /= TWOPI; // convert back to fraction of a circle
}
}
- std::ostringstream os;
- os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet
- << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample
- << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength
- << ", ViewRatio=" << m_dDefaultViewRatio << ", ScanRatio=" << m_dDefaultScanRatio
- << ", Geometry=" << sGeometry.c_str() << ", FanBeamAngle=" <<
- convertRadiansToDegrees (theScanner.fanBeamAngle());
- pProj->setCalcTime (timer.timerEnd());
pProj->setRemark (os.str());
+ pProj->setCalcTime (timer.timerEnd());
*theApp->getLog() << os.str().c_str() << "\n";
::wxYield();