From 9776c9a12ba53419d34563a5ec57c90e3d6798f4 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 22 Feb 2001 18:22:40 +0000 Subject: [PATCH] r573: no message --- include/backprojectors.h | 18 +-- include/filter.h | 18 +-- include/procsignal.h | 18 +-- include/projections.h | 10 +- libctsim/backprojectors.cpp | 10 +- libctsim/filter.cpp | 10 +- libctsim/procsignal.cpp | 10 +- libctsim/projections.cpp | 6 +- msvc/ctsim.dsw | 12 ++ msvc/ctsim/ctsim.dsp | 24 ++++ msvc/ctsim/ctsim.plg | 90 +------------ src/backgroundmgr.cpp | 42 +++++-- src/backgroundmgr.h | 18 ++- src/dialogs.cpp | 6 +- src/dialogs.h | 10 +- src/threadrecon.cpp | 244 ++++++++++++++++++++---------------- src/threadrecon.h | 20 +-- 17 files changed, 296 insertions(+), 270 deletions(-) diff --git a/include/backprojectors.h b/include/backprojectors.h index 8fbb06b..bd30b9c 100644 --- a/include/backprojectors.h +++ b/include/backprojectors.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: backprojectors.h,v 1.21 2001/02/11 04:56:37 kevin Exp $ +** $Id: backprojectors.h,v 1.22 2001/02/22 18:22:40 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 @@ -69,15 +69,15 @@ class Backprojector const std::string& failMessage() const {return m_failMessage;} static const int getBackprojectCount() {return s_iBackprojectCount;} - static const char** getBackprojectNameArray() {return s_aszBackprojectName;} - static const char** getBackprojectTitleArray() {return s_aszBackprojectTitle;} + static const char* const* getBackprojectNameArray() {return s_aszBackprojectName;} + static const char* const* getBackprojectTitleArray() {return s_aszBackprojectTitle;} static int convertBackprojectNameToID (const char* const bprojName); static const char* convertBackprojectIDToName (const int bprojID); static const char* convertBackprojectIDToTitle (const int bprojID); static const int getInterpCount() {return s_iInterpCount;} - static const char** getInterpNameArray() {return s_aszInterpName;} - static const char** getInterpTitleArray() {return s_aszInterpTitle;} + static const char* const * getInterpNameArray() {return s_aszInterpName;} + static const char* const * getInterpTitleArray() {return s_aszInterpTitle;} static int convertInterpNameToID (const char* const interpName); static const char* convertInterpIDToName (const int interpID); static const char* convertInterpIDToTitle (const int interpID); @@ -92,12 +92,12 @@ class Backprojector bool m_fail; std::string m_failMessage; - static const char* s_aszBackprojectName[]; - static const char* s_aszBackprojectTitle[]; + static const char* const s_aszBackprojectName[]; + static const char* const s_aszBackprojectTitle[]; static const int s_iBackprojectCount; - static const char* s_aszInterpName[]; - static const char* s_aszInterpTitle[]; + static const char* const s_aszInterpName[]; + static const char* const s_aszInterpTitle[]; static const int s_iInterpCount; bool initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor); diff --git a/include/filter.h b/include/filter.h index 8aa4018..d8444a6 100644 --- a/include/filter.h +++ b/include/filter.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: filter.h,v 1.26 2001/02/16 00:28:41 kevin Exp $ +** $Id: filter.h,v 1.27 2001/02/22 18:22:40 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 @@ -107,15 +107,15 @@ class SignalFilter { static const int getFilterCount() {return s_iFilterCount;} static const int getReconstructFilterCount() { return s_iReconstructFilterCount; } - static const char** getFilterNameArray() {return s_aszFilterName;} - static const char** getFilterTitleArray() {return s_aszFilterTitle;} + static const char* const* getFilterNameArray() {return s_aszFilterName;} + static const char* const* getFilterTitleArray() {return s_aszFilterTitle;} static int convertFilterNameToID (const char* const filterName); static const char* convertFilterIDToName (const int idFilter); static const char* convertFilterIDToTitle (const int idFilter); static const int getDomainCount() {return s_iDomainCount;} - static const char** getDomainNameArray() {return s_aszDomainName;} - static const char** getDomainTitleArray() {return s_aszDomainTitle;} + static const char* const* getDomainNameArray() {return s_aszDomainName;} + static const char* const* getDomainTitleArray() {return s_aszDomainTitle;} static int convertDomainNameToID (const char* const domainName); static const char* convertDomainIDToName (const int idDomain); static const char* convertDomainIDToTitle (const int idDomain); @@ -143,12 +143,12 @@ class SignalFilter { bool m_fail; std::string m_failMessage; - static const char* s_aszFilterName[]; - static const char* s_aszFilterTitle[]; + static const char* const s_aszFilterName[]; + static const char* const s_aszFilterTitle[]; static const int s_iFilterCount; static const int s_iReconstructFilterCount; - static const char* s_aszDomainName[]; - static const char* s_aszDomainTitle[]; + static const char* const s_aszDomainName[]; + static const char* const s_aszDomainTitle[]; static const int s_iDomainCount; static int N_INTEGRAL; diff --git a/include/procsignal.h b/include/procsignal.h index 798bfc9..3448bae 100644 --- a/include/procsignal.h +++ b/include/procsignal.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: procsignal.h,v 1.13 2001/01/28 19:10:18 kevin Exp $ +** $Id: procsignal.h,v 1.14 2001/02/22 18:22:40 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 @@ -87,15 +87,15 @@ class ProcessSignal { const int idFilterGeneration() const { return m_idFilterGeneration;} static const int getFilterGenerationCount() {return s_iFilterGenerationCount;} - static const char** getFilterGenerationNameArray() {return s_aszFilterGenerationName;} - static const char** getFilterGenerationTitleArray() {return s_aszFilterGenerationTitle;} + static const char* const* getFilterGenerationNameArray() {return s_aszFilterGenerationName;} + static const char* const* getFilterGenerationTitleArray() {return s_aszFilterGenerationTitle;} static int convertFilterGenerationNameToID (const char* const fgName); static const char* convertFilterGenerationIDToName (const int idFG); static const char* convertFilterGenerationIDToTitle (const int idFG); static const int getFilterMethodCount() {return s_iFilterMethodCount;} - static const char** getFilterMethodNameArray() {return s_aszFilterMethodName;} - static const char** getFilterMethodTitleArray() {return s_aszFilterMethodTitle;} + static const char* const* getFilterMethodNameArray() {return s_aszFilterMethodName;} + static const char* const* getFilterMethodTitleArray() {return s_aszFilterMethodTitle;} static int convertFilterMethodNameToID (const char* const filterMethodName); static const char* convertFilterMethodIDToName (const int idFilterMethod); static const char* convertFilterMethodIDToTitle (const int idFilterMethod); @@ -139,11 +139,11 @@ class ProcessSignal { bool m_fail; std::string m_failMessage; - static const char* s_aszFilterMethodName[]; - static const char* s_aszFilterMethodTitle[]; + static const char* const s_aszFilterMethodName[]; + static const char* const s_aszFilterMethodTitle[]; static const int s_iFilterMethodCount; - static const char* s_aszFilterGenerationName[]; - static const char* s_aszFilterGenerationTitle[]; + static const char* const s_aszFilterGenerationName[]; + static const char* const s_aszFilterGenerationTitle[]; static const int s_iFilterGenerationCount; #ifdef HAVE_FFTW diff --git a/include/projections.h b/include/projections.h index 35325df..787f325 100644 --- a/include/projections.h +++ b/include/projections.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: projections.h,v 1.24 2001/02/20 17:44:14 kevin Exp $ +** $Id: projections.h,v 1.25 2001/02/22 18:22:40 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -54,8 +54,8 @@ class Projections ~Projections (); static const int getInterpCount() {return s_iInterpCount;} - static const char** getInterpNameArray() {return s_aszInterpName;} - static const char** getInterpTitleArray() {return s_aszInterpTitle;} + static const char* const* getInterpNameArray() {return s_aszInterpName;} + static const char* const* getInterpTitleArray() {return s_aszInterpTitle;} static int convertInterpNameToID (const char* const interpName); static const char* convertInterpIDToName (const int interpID); static const char* convertInterpIDToTitle (const int interpID); @@ -144,8 +144,8 @@ class Projections const static kuint16 m_signature; - static const char* s_aszInterpName[]; - static const char* s_aszInterpTitle[]; + static const char* const s_aszInterpName[]; + static const char* const s_aszInterpTitle[]; static const int s_iInterpCount; bool headerWrite (fnetorderstream& fs); diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index c7a8f27..ebfe2a4 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.26 2001/02/11 04:56:37 kevin Exp $ +** $Id: backprojectors.cpp,v 1.27 2001/02/22 18:22:40 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 @@ -32,7 +32,7 @@ const int Backprojector::BPROJ_TABLE = 1; const int Backprojector::BPROJ_DIFF = 2; const int Backprojector::BPROJ_IDIFF = 3; -const char* Backprojector::s_aszBackprojectName[] = +const char* const Backprojector::s_aszBackprojectName[] = { {"trig"}, {"table"}, @@ -40,7 +40,7 @@ const char* Backprojector::s_aszBackprojectName[] = {"idiff"}, }; -const char* Backprojector::s_aszBackprojectTitle[] = +const char* const Backprojector::s_aszBackprojectTitle[] = { {"Direct Trigometric"}, {"Trigometric Table"}, @@ -62,7 +62,7 @@ const int Backprojector::INTERP_2BSPLINE = 6; const int Backprojector::INTERP_3BSPLINE = 7; #endif -const char* Backprojector::s_aszInterpName[] = +const char* const Backprojector::s_aszInterpName[] = { {"nearest"}, {"linear"}, @@ -78,7 +78,7 @@ const char* Backprojector::s_aszInterpName[] = #endif }; -const char* Backprojector::s_aszInterpTitle[] = +const char* const Backprojector::s_aszInterpTitle[] = { {"Nearest"}, {"Linear"}, diff --git a/libctsim/filter.cpp b/libctsim/filter.cpp index 85e07e0..f864786 100644 --- a/libctsim/filter.cpp +++ b/libctsim/filter.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2000 Kevin Rosenberg ** -** $Id: filter.cpp,v 1.37 2001/02/16 00:28:41 kevin Exp $ +** $Id: filter.cpp,v 1.38 2001/02/22 18:22:40 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 @@ -45,7 +45,7 @@ const int SignalFilter::FILTER_TRIANGLE = 11; const int SignalFilter::s_iReconstructFilterCount = 4; -const char* SignalFilter::s_aszFilterName[] = { +const char* const SignalFilter::s_aszFilterName[] = { {"abs_bandlimit"}, {"abs_hamming"}, {"abs_hanning"}, @@ -60,7 +60,7 @@ const char* SignalFilter::s_aszFilterName[] = { {"triangle"}, }; -const char* SignalFilter::s_aszFilterTitle[] = { +const char* const SignalFilter::s_aszFilterTitle[] = { {"Abs(w) * Bandlimit"}, {"Abs(w) * Hamming"}, {"Abs(w) * Hanning"}, @@ -82,12 +82,12 @@ const int SignalFilter::DOMAIN_INVALID = -1; const int SignalFilter::DOMAIN_FREQUENCY = 0; const int SignalFilter::DOMAIN_SPATIAL = 1; -const char* SignalFilter::s_aszDomainName[] = { +const char* const SignalFilter::s_aszDomainName[] = { {"frequency"}, {"spatial"}, }; -const char* SignalFilter::s_aszDomainTitle[] = { +const char* const SignalFilter::s_aszDomainTitle[] = { {"Frequency"}, {"Spatial"}, }; diff --git a/libctsim/procsignal.cpp b/libctsim/procsignal.cpp index 707ee38..b5c6678 100644 --- a/libctsim/procsignal.cpp +++ b/libctsim/procsignal.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: procsignal.cpp,v 1.25 2001/02/11 04:56:37 kevin Exp $ +** $Id: procsignal.cpp,v 1.26 2001/02/22 18:22:40 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 @@ -41,7 +41,7 @@ const int ProcessSignal::FILTER_METHOD_FFT = 3; const int ProcessSignal::FILTER_METHOD_FFTW = 4; const int ProcessSignal::FILTER_METHOD_RFFTW =5 ; #endif -const char* ProcessSignal::s_aszFilterMethodName[] = { +const char* const ProcessSignal::s_aszFilterMethodName[] = { {"convolution"}, {"fourier"}, {"fouier-table"}, @@ -51,7 +51,7 @@ const char* ProcessSignal::s_aszFilterMethodName[] = { {"rfftw"}, #endif }; -const char* ProcessSignal::s_aszFilterMethodTitle[] = { +const char* const ProcessSignal::s_aszFilterMethodTitle[] = { {"Convolution"}, {"Fourier"}, {"Fouier Trigometric Table"}, @@ -67,11 +67,11 @@ const int ProcessSignal::s_iFilterMethodCount = sizeof(s_aszFilterMethodName) / const int ProcessSignal::FILTER_GENERATION_INVALID = -1; const int ProcessSignal::FILTER_GENERATION_DIRECT = 0; const int ProcessSignal::FILTER_GENERATION_INVERSE_FOURIER = 1; -const char* ProcessSignal::s_aszFilterGenerationName[] = { +const char* const ProcessSignal::s_aszFilterGenerationName[] = { {"direct"}, {"inverse-fourier"}, }; -const char* ProcessSignal::s_aszFilterGenerationTitle[] = { +const char* const ProcessSignal::s_aszFilterGenerationTitle[] = { {"Direct"}, {"Inverse Fourier"}, }; diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index d80579e..e9e053d 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.48 2001/02/20 17:44:14 kevin Exp $ +** $Id: projections.cpp,v 1.49 2001/02/22 18:22:40 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 @@ -33,14 +33,14 @@ const int Projections::POLAR_INTERP_NEAREST = 0; const int Projections::POLAR_INTERP_BILINEAR = 1; const int Projections::POLAR_INTERP_BICUBIC = 2; -const char* Projections::s_aszInterpName[] = +const char* const Projections::s_aszInterpName[] = { {"nearest"}, {"bilinear"}, // {"bicubic"}, }; -const char* Projections::s_aszInterpTitle[] = +const char* const Projections::s_aszInterpTitle[] = { {"Nearest"}, {"Bilinear"}, diff --git a/msvc/ctsim.dsw b/msvc/ctsim.dsw index 178ee44..3d7b7ba 100644 --- a/msvc/ctsim.dsw +++ b/msvc/ctsim.dsw @@ -51,6 +51,18 @@ Package=<4> ############################################################################### +Project: "ThreadVC"=..\..\wx2.2.5\samples\thread\ThreadVC.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "ctsim"=.\ctsim\ctsim.dsp - Package Owner=<4> Package=<5> diff --git a/msvc/ctsim/ctsim.dsp b/msvc/ctsim/ctsim.dsp index 9679553..fb1cdcc 100644 --- a/msvc/ctsim/ctsim.dsp +++ b/msvc/ctsim/ctsim.dsp @@ -93,6 +93,10 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File +SOURCE=..\..\src\backgroundmgr.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\ctsim.cpp # ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # End Source File @@ -132,6 +136,14 @@ SOURCE=..\..\src\graph3dview.cpp # End Source File # Begin Source File +SOURCE=..\..\src\threadrecon.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\tips.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\views.cpp # ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # End Source File @@ -141,6 +153,10 @@ SOURCE=..\..\src\views.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File +SOURCE=..\..\src\backgroundmgr.h +# End Source File +# Begin Source File + SOURCE="..\..\src\ctsim-map.h" # End Source File # Begin Source File @@ -173,6 +189,14 @@ SOURCE=..\..\src\splash.xpm # End Source File # Begin Source File +SOURCE=..\..\src\threadrecon.h +# End Source File +# Begin Source File + +SOURCE=..\..\src\tips.h +# End Source File +# Begin Source File + SOURCE=..\..\src\views.h # End Source File # End Group diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 05c2239..7e652fc 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -3,80 +3,16 @@
 

Build Log

---------------------Configuration: libctsim - Win32 Debug-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75C.tmp" with contents -[ -/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\ctsim\libctgraphics\dlgezplot.cpp" -"C:\ctsim\libctsim\globalvars.cpp" -"C:\ctsim\libctsupport\syserror.cpp" -] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75C.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75D.tmp" with contents -[ -/nologo /out:"Debug\libctsim.lib" -.\Debug\array2dfile.obj -.\Debug\backprojectors.obj -.\Debug\clip.obj -.\Debug\consoleio.obj -.\Debug\dlgezplot.obj -.\Debug\ezplot.obj -.\Debug\ezset.obj -.\Debug\ezsupport.obj -.\Debug\filter.obj -.\Debug\fnetorderstream.obj -.\Debug\fourier.obj -.\Debug\getopt.obj -.\Debug\getopt1.obj -.\Debug\globalvars.obj -.\Debug\hashtable.obj -.\Debug\imagefile.obj -.\Debug\interpolator.obj -.\Debug\mathfuncs.obj -.\Debug\phantom.obj -.\Debug\plotfile.obj -.\Debug\pol.obj -.\Debug\procsignal.obj -.\Debug\projections.obj -.\Debug\reconstruct.obj -.\Debug\scanner.obj -.\Debug\sgp.obj -.\Debug\strfuncs.obj -.\Debug\syserror.obj -.\Debug\trace.obj -.\Debug\transformmatrix.obj -.\Debug\xform.obj -] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75D.tmp" -

Output Window

-Compiling... -dlgezplot.cpp -Skipping... (no relevant changes detected) -globalvars.cpp -syserror.cpp -Creating library... -

--------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75E.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\dialogs.cpp" -"C:\ctsim\src\docs.cpp" -"C:\ctsim\src\views.cpp" -] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75E.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75F.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84D.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\graph3dview.cpp" +"C:\ctsim\src\backgroundmgr.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75F.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP760.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84D.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84E.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\ctsim.obj @@ -100,25 +36,11 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.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\RSP760.tmp" -

Output Window

-Compiling... -ctsim.cpp -dialogs.cpp -docs.cpp -views.cpp -Compiling... -graph3dview.cpp -Linking... -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP763.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" -] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP763.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84E.tmp"

Output Window

Compiling... backgroundmgr.cpp +Linking... diff --git a/src/backgroundmgr.cpp b/src/backgroundmgr.cpp index 12d337d..32c32a6 100644 --- a/src/backgroundmgr.cpp +++ b/src/backgroundmgr.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundmgr.cpp,v 1.1 2001/02/22 15:00:20 kevin Exp $ +** $Id: backgroundmgr.cpp,v 1.2 2001/02/22 18:22:40 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 @@ -56,9 +56,7 @@ BackgroundManager::BackgroundManager () m_pCanvas = new BackgroundManagerCanvas (this); theApp->setIconForFrame (this); - Show(true); - // if (m_iNumTasks == 0) - // Show(false); + Show(false); } @@ -73,14 +71,21 @@ BackgroundManager::OnCloseWindow (wxCloseEvent& event) wxGauge* -BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits) +BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits, const char* const pszTaskName) { + wxCriticalSectionLocker locker (m_criticalSection); + int iNumTasks = m_vecpBackgroundTasks.size(); + int iTaskHeight = 20; wxSize size (50, 10); - wxPoint pos (4, 5); + wxPoint pos (4, 5 + iNumTasks * iTaskHeight); wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, pos, size); m_vecpBackgroundTasks.push_back (pTask); + m_vecpGauges.push_back (pGauge); + m_vecpNames.push_back (new std::string (pszTaskName)); m_iNumTasks++; + + Show(true); return (pGauge); } @@ -88,7 +93,30 @@ BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits) void BackgroundManager::taskDone (BackgroundTask* pTask) { - m_iNumTasks--; + wxCriticalSection doneSection; + doneSection.Enter(); + + StringContainer::iterator iName = m_vecpNames.begin(); + GaugeContainer::iterator iGauge = m_vecpGauges.begin(); + for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) { + if (*iTask == pTask) { + delete *iName; + delete *iGauge; + m_vecpBackgroundTasks.erase (iTask); + m_vecpGauges.erase (iGauge); + m_vecpNames.erase (iName); + m_iNumTasks--; + break; + } + iTask++; + iGauge++; + } + + doneSection.Leave(); + if (m_iNumTasks <= 0) + Show(false); + m_pCanvas->Refresh(); + // delete pTask; } bool diff --git a/src/backgroundmgr.h b/src/backgroundmgr.h index 7e95fae..3a91537 100644 --- a/src/backgroundmgr.h +++ b/src/backgroundmgr.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundmgr.h,v 1.1 2001/02/22 15:00:20 kevin Exp $ +** $Id: backgroundmgr.h,v 1.2 2001/02/22 18:22:40 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 @@ -59,20 +59,30 @@ class BackgroundManager : public wxMiniFrame private: DECLARE_DYNAMIC_CLASS(BackgroundManager) + wxCriticalSection m_criticalSection; BackgroundManagerCanvas* m_pCanvas; int m_iNumTasks; - std::vector m_vecpBackgroundTasks; - std::vector m_vecpGauges; + + typedef std::vector TaskContainer; + typedef std::vector GaugeContainer; + typedef std::vector StringContainer; + TaskContainer m_vecpBackgroundTasks; + GaugeContainer m_vecpGauges; + StringContainer m_vecpNames; void OnCloseWindow(wxCloseEvent& event); public: BackgroundManager (); - wxGauge* addTask (BackgroundTask* pTask, int iNumUnits); + wxGauge* addTask (BackgroundTask* pTask, int iNumUnits, const char* const pszTaskName); void taskDone (BackgroundTask* pTask); bool isCancelling (BackgroundTask* pTask); + TaskContainer& getTasks() { return m_vecpBackgroundTasks;} + GaugeContainer& getGauges() { return m_vecpGauges;} + StringContainer& getNames() { return m_vecpNames;} + DECLARE_EVENT_TABLE() }; diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 21b6f19..7b4d7d1 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: dialogs.cpp,v 1.41 2001/02/22 15:00:20 kevin Exp $ +** $Id: dialogs.cpp,v 1.42 2001/02/22 18:22:40 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 @@ -60,7 +60,7 @@ // StringValueAndTitleListBox /////////////////////////////////////////////////////////////////////// -StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]) +StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[]) : wxListBox () { wxString* psTitle = new wxString [nChoices]; @@ -79,7 +79,7 @@ StringValueAndTitleListBox::getSelectionStringValue () const return m_ppszValues[GetSelection()]; } -StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[]) +StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[]) : wxRadioBox () { wxString* psTitle = new wxString [nChoices]; diff --git a/src/dialogs.h b/src/dialogs.h index 22eccf5..4316729 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: dialogs.h,v 1.30 2001/02/22 15:00:20 kevin Exp $ +** $Id: dialogs.h,v 1.31 2001/02/22 18:22:40 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 @@ -56,24 +56,24 @@ public: class StringValueAndTitleListBox : public wxListBox { public: - StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]); + StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[]); const char* getSelectionStringValue () const; private: - const char** m_ppszValues; + const char* const* m_ppszValues; }; class StringValueAndTitleRadioBox : public wxRadioBox { public: - StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[]); + StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[]); const char* getSelectionStringValue () const; private: - const char** m_ppszValues; + const char* const* m_ppszValues; }; diff --git a/src/threadrecon.cpp b/src/threadrecon.cpp index e43299a..e53daac 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.2 2001/02/22 15:00:20 kevin Exp $ +** $Id: threadrecon.cpp,v 1.3 2001/02/22 18:22:40 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 @@ -51,34 +51,34 @@ END_EVENT_TABLE() enum { RTHREAD_UNIT_COMPLETE = -1, - RTHREAD_THREAD_DONE = -2, - RTHREAD_THREAD_CANCELLED = -3, + RTHREAD_THREAD_DONE = -2, + RTHREAD_THREAD_CANCELLED = -3, }; ThreadedReconstructor::ThreadedReconstructor (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_pDialogProgress(NULL), m_pGauge(NULL), m_bFail(false), m_iNumThreads(0), m_iImageNX(iImageNX), - m_iImageNY(iImageNY), m_strLabel(pszLabel), m_pTimer(NULL), m_bCancelled(false), m_bCancelling(false), - m_bDone(false), BackgroundTask() + 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_pDialogProgress(NULL), m_pGauge(NULL), m_bFail(false), m_iNumThreads(0), m_iImageNX(iImageNX), + m_iImageNY(iImageNY), m_strLabel(pszLabel), m_pTimer(NULL), m_bCancelled(false), m_bCancelling(false), + BackgroundTask() { m_iNumThreads = theApp->getNumberCPU(); -// ++m_iNumThreads; + // ++m_iNumThreads; m_iTotalViews = m_pProjView->GetDocument()->getProjections().nView(); int iBaseViews = m_iTotalViews / m_iNumThreads; 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); - + pszFilterName, dFilterParam, pszFilterMethod, iZeropad, pszFilterGenerationName, + pszInterpName, iInterpParam, pszBackprojectName, Trace::TRACE_NONE); + int iStartView = iProc * iBaseViews; int iNumViews = iBaseViews; if (iProc < iExtraViews) @@ -89,7 +89,7 @@ ThreadedReconstructor::ThreadedReconstructor (ProjectionFileView* pProjView, break; } } - + } @@ -98,117 +98,140 @@ ThreadedReconstructor::start() { if (m_bFail) return false; - + 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_pGauge = theApp->getBackgroundManager()->addTask (this, m_iTotalViews, m_pProjView->GetFrame()->GetTitle()); + m_iRunning = m_iNumThreads; m_iViewsDone = 0; m_pTimer = new Timer; - + // starting all threads for (int i = 0; i < m_iNumThreads; i++) m_vecpThread[i]->Run(); - - + if (m_bCancelled) return false; - + return true; } void ThreadedReconstructor::cancel() { - if (m_bCancelled) + if (isDone() || m_bCancelled) return; + m_bCancelled = true; + m_bCancelling = false; + cleanUp(); +} - wxCriticalSectionLocker locker (m_criticalSection); - +void +ThreadedReconstructor::cleanUp() +{ + wxCriticalSection cleanSection; + cleanSection.Enter(); + for (int i = 0; i < m_iNumThreads; i++) - if (m_vecpThread[i]) + if (m_vecpThread[i] && m_vecpThread[i]->IsRunning()) { + m_vecpThread[i]->Pause(); m_vecpThread[i]->Delete(); - - for (i = 0; i < m_iNumThreads; i++) - delete m_vecpReconstructor[i]; - - m_iNumThreads = 0; - m_iRunning = 0; - delete m_pDialogProgress; - delete m_pTimer; - m_pDialogProgress = NULL; - m_pProjView->GetDocument()->removeReconstructor (this); - m_bCancelled = true; - m_bDone = true; - theApp->getBackgroundManager()->taskDone (this); + } + + 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; + delete m_pDialogProgress; + delete m_pTimer; + m_pDialogProgress = NULL; + m_pGauge = NULL; + setDone(); + m_pProjView->GetDocument()->removeReconstructor (this); + theApp->getBackgroundManager()->taskDone (this); + + cleanSection.Leave(); } void ThreadedReconstructor::onDone() { - for (int i = 0; i < m_iNumThreads; i++) - delete m_vecpReconstructor[i]; + wxCriticalSection doneSection; + doneSection.Enter(); - m_pProjView->GetDocument()->removeReconstructor (this); - ImageFileDocument* pReconDoc = theApp->newImageDoc(); - if (! pReconDoc) { - sys_error (ERR_SEVERE, "Unable to create image file"); - return; - } - - ImageFile* pImageFile = getImageFile(); - pReconDoc->setImageFile (pImageFile); - if (theApp->getAskDeleteNewDocs()) - pReconDoc->Modify (true); - pReconDoc->UpdateAllViews (m_pProjView); - if (ImageFileView* rasterView = pReconDoc->getView()) { - rasterView->OnUpdate (rasterView, NULL); - rasterView->getFrame()->SetFocus(); - rasterView->getFrame()->Show(true); - } - *theApp->getLog() << m_strLabel << "\n"; - pImageFile->labelAdd (m_pProjView->GetDocument()->getProjections().getLabel()); - pImageFile->labelAdd (m_strLabel.c_str(), m_pTimer->timerEnd()); - delete m_pTimer; - - wxIdleEvent event; - theApp->OnIdle(event); - m_bDone = true; - theApp->getBackgroundManager()->taskDone (this); - // delete this; + m_pProjView->GetDocument()->removeReconstructor (this); + ImageFileDocument* pReconDoc = theApp->newImageDoc(); + if (! pReconDoc) { + sys_error (ERR_SEVERE, "Unable to create image file"); + 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()) + pReconDoc->Modify (true); + pReconDoc->UpdateAllViews (m_pProjView); + if (ImageFileView* rasterView = pReconDoc->getView()) { + rasterView->OnUpdate (rasterView, NULL); + rasterView->getFrame()->SetFocus(); + rasterView->getFrame()->Show(true); + } + *theApp->getLog() << m_strLabel << "\n"; + pImageFile->labelAdd (m_pProjView->GetDocument()->getProjections().getLabel()); + pImageFile->labelAdd (m_strLabel.c_str(), m_pTimer->timerEnd()); + + doneSection.Leave(); + cleanUp(); } void ThreadedReconstructor::OnThreadEvent (wxCommandEvent& event) { - if (m_bCancelling) { - cancel(); + if (isDone()) + return; + wxCriticalSection eventSection; + eventSection.Enter(); + if (isDone()) { + eventSection.Leave(); return; } - - wxCriticalSectionLocker locker (m_criticalSection); - + int iEventId = event.GetInt(); if (iEventId == RTHREAD_UNIT_COMPLETE) { ++m_iViewsDone; - *theApp->getLog() << "Views done: " << static_cast(m_iViewsDone) <<"\n"; - + +#ifdef DEBUG + if (theApp->getVerboseLogging()) + *theApp->getLog() << "Views done: " << static_cast(m_iViewsDone) <<"\n"; +#endif + if (m_pDialogProgress) m_bCancelling = ! m_pDialogProgress->Update (m_iViewsDone - 1); else if (m_pGauge) { - m_pGauge->SetValue (m_iViewsDone - 1); + m_pGauge->SetValue (m_iViewsDone - 1); + eventSection.Leave(); m_bCancelling = theApp->getBackgroundManager()->isCancelling(this); } - if (m_iViewsDone == m_iTotalViews) { - delete m_pDialogProgress; - m_pDialogProgress = NULL; - onDone(); - } - if (m_bCancelling) { + if (! isDone() && m_bCancelling) { + eventSection.Leave(); cancel(); return; } @@ -217,19 +240,25 @@ ThreadedReconstructor::OnThreadEvent (wxCommandEvent& event) m_iRunning--; m_vecpThread[event.GetInt()] = NULL; *theApp->getLog() << "Thread finished. Remaining threads: " << m_iRunning << "\n"; + if (m_iRunning <= 0) { + eventSection.Leave(); + onDone(); + return; + } } else *theApp->getLog() << "Got event #" << iEventId << "\n"; - + + eventSection.Leave(); } ImageFile* -ThreadedReconstructor::getImageFile() const +ThreadedReconstructor::getImageFile() { ImageFile* pImageFile = new ImageFile (m_iImageNX, m_iImageNY); pImageFile->arrayDataClear(); ImageFileArray pArray = pImageFile->getArray(); - + int i; for (i = 0; i < m_iNumThreads; i++) { ImageFileArrayConst pChildArray = m_vecpChildImageFile[i]->getArray(); @@ -237,19 +266,14 @@ ThreadedReconstructor::getImageFile() const for (int iy = 0; iy < m_iImageNY; iy++) pArray[ix][iy] += pChildArray[ix][iy]; } - - for (i = 0; i < m_iNumThreads; i++) { - delete m_vecpChildImageFile[i]; -// m_vecpChildImageFile[i] = NULL; - } - + return (pImageFile); } bool ThreadedReconstructor::testDone() { - return (m_iRunning <= 0 ? true : false); + return (m_iRunning <= 0 ? true : false); } @@ -259,35 +283,35 @@ ThreadedReconstructor::~ThreadedReconstructor() ReconstructionThread::ReconstructionThread (ThreadedReconstructor* pSupervisor, - Reconstructor* pReconstructor, int iThread, int iStartView, int iNumViews) -: m_pSupervisor(pSupervisor), m_pReconstructor(pReconstructor), - m_iStartView(iStartView), m_iNumViews(iNumViews), m_iThread(iThread), - wxThread(wxTHREAD_DETACHED) + Reconstructor* pReconstructor, int iThread, int iStartView, int iNumViews) + : m_pSupervisor(pSupervisor), m_pReconstructor(pReconstructor), + m_iStartView(iStartView), m_iNumViews(iNumViews), m_iThread(iThread), + wxThread(wxTHREAD_DETACHED) { } wxThread::ExitCode ReconstructionThread::Entry () { - wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, RECONSTRUCTION_THREAD_EVENT); - for (int iView = 0; iView < m_iNumViews; iView++) { - if (TestDestroy()) { + wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, RECONSTRUCTION_THREAD_EVENT); + for (int iView = 0; iView < m_iNumViews; iView++) { + if (TestDestroy()) { wxString msg; msg.Printf("TestDestroy TRUE at view #%d\n", iView); wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT ); event.SetString( msg ); wxPostEvent( theApp->getMainFrame(), event ); // send in a thread-safe way return reinterpret_cast(RTHREAD_THREAD_CANCELLED); - } - m_pReconstructor->reconstructView (iView + m_iStartView, 1); - eventProgress.SetInt (RTHREAD_UNIT_COMPLETE); - wxPostEvent (m_pSupervisor, eventProgress); - } - - eventProgress.SetInt (m_iThread); // Send back thread# that has finished - wxPostEvent (m_pSupervisor, eventProgress); - - return reinterpret_cast(0); + } + m_pReconstructor->reconstructView (iView + m_iStartView, 1); + eventProgress.SetInt (RTHREAD_UNIT_COMPLETE); + wxPostEvent (m_pSupervisor, eventProgress); + } + + eventProgress.SetInt (m_iThread); // Send back thread# that has finished + wxPostEvent (m_pSupervisor, eventProgress); + + return reinterpret_cast(0); } void diff --git a/src/threadrecon.h b/src/threadrecon.h index 0cb8c9a..ae6f0d2 100644 --- a/src/threadrecon.h +++ b/src/threadrecon.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: threadrecon.h,v 1.2 2001/02/22 15:00:20 kevin Exp $ +** $Id: threadrecon.h,v 1.3 2001/02/22 18:22:40 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 @@ -35,9 +35,12 @@ class BackgroundTask : public wxEvtHandler { +private: + bool m_bDone; + public: BackgroundTask() - : wxEvtHandler() + : m_bDone(false), wxEvtHandler() {} virtual ~BackgroundTask() @@ -45,6 +48,10 @@ public: virtual void cancel() = 0; virtual bool start() = 0; + virtual bool testDone() = 0; + + bool isDone() const {return m_bDone;} + void setDone() { m_bDone = true; } }; class Reconstructor; @@ -71,12 +78,11 @@ private: volatile int m_iRunning; volatile unsigned int m_iViewsDone; volatile unsigned int m_iTotalViews; - wxCriticalSection m_criticalSection; + //wxCriticalSection m_criticalSection; wxString m_strLabel; Timer* m_pTimer; bool m_bCancelled; bool m_bCancelling; - bool m_bDone; public: ThreadedReconstructor (ProjectionFileView* pProjView, @@ -91,15 +97,15 @@ public: ~ThreadedReconstructor (); void OnThreadEvent (wxCommandEvent& event); - bool testDone(); void cancel(); void onDone(); bool start(); bool fail() const {return m_bFail;} - bool getDone() const {return m_bDone;} + bool testDone(); + void cleanUp(); - ImageFile* getImageFile() const; + ImageFile* getImageFile(); DECLARE_EVENT_TABLE() }; -- 2.34.1