From ed576a069b0ba9de2e9153707012eba620ac606e Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Fri, 12 Jan 2001 21:53:27 +0000 Subject: [PATCH] r385: no message --- include/filter.h | 10 +- libctgraphics/sgp.cpp | 4 +- libctsim/procsignal.cpp | 251 +++++++++++++++++++++++----------------- msvc/ctsim/ctsim.plg | 12 +- src/dlgezplot.cpp | 133 ++++++++++----------- src/dlgezplot.h | 50 +++++--- src/views.cpp | 9 +- 7 files changed, 260 insertions(+), 209 deletions(-) diff --git a/include/filter.h b/include/filter.h index ca6e67b..7b696b2 100644 --- a/include/filter.h +++ b/include/filter.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: filter.h,v 1.22 2000/12/16 06:12:47 kevin Exp $ +** $Id: filter.h,v 1.23 2001/01/12 21:53:27 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 @@ -116,6 +116,12 @@ class SignalFilter { static const char* convertDomainIDToName (const int idDomain); static const char* convertDomainIDToTitle (const int idDomain); + static double sinc (double x) + { return (fabs(x) > F_EPSILON ? (sin (x) / x) : 1.0); } + + static double sinc (double x, double mult) + { return (fabs(x) > F_EPSILON ? (sin (x * mult) / x) : 1.0); } + private: int m_nFilterPoints; double m_dBandwidth; @@ -152,8 +158,6 @@ class SignalFilter { double spatialResponseAnalytic (double x) const; double frequencyResponse (double u) const; - static double sinc (double x, double mult) - { return (fabs(x) > F_EPSILON ? (sin (x * mult) / x) : 1.0); } static double integral_abscos (double u, double w) { return (fabs (u) > F_EPSILON ? (cos (u * w) - 1) / (u * u) + w / u * sin (u * w) : (w * w / 2)); } }; diff --git a/libctgraphics/sgp.cpp b/libctgraphics/sgp.cpp index 263101f..ec6b89d 100644 --- a/libctgraphics/sgp.cpp +++ b/libctgraphics/sgp.cpp @@ -7,7 +7,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sgp.cpp,v 1.26 2001/01/04 21:28:41 kevin Exp $ +** $Id: sgp.cpp,v 1.27 2001/01/12 21:53:27 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 @@ -139,7 +139,7 @@ SGP::~SGP() { #if HAVE_WXWINDOWS if (m_driver.isWX()) { - m_driver.idWX()->SetFont (wxNullFont); + // m_driver.idWX()->SetFont (wxNullFont); delete m_pFont; } #endif diff --git a/libctsim/procsignal.cpp b/libctsim/procsignal.cpp index 67641fd..b717f80 100644 --- a/libctsim/procsignal.cpp +++ b/libctsim/procsignal.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: procsignal.cpp,v 1.19 2001/01/12 16:41:56 kevin Exp $ +** $Id: procsignal.cpp,v 1.20 2001/01/12 21:53:27 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 @@ -82,10 +82,10 @@ const int ProcessSignal::s_iFilterGenerationCount = sizeof(s_aszFilterGeneration // ProcessSignal // ProcessSignal::ProcessSignal (const char* szFilterName, const char* szFilterMethodName, double dBandwidth, - double dSignalIncrement, int nSignalPoints, double dFilterParam, const char* szDomainName, - const char* szFilterGenerationName, int iZeropad, int iPreinterpolationFactor, int iTraceLevel, - int iGeometry, double dFocalLength, SGP* pSGP) -: m_adFourierCosTable(NULL), m_adFourierSinTable(NULL), m_adFilter(NULL), m_fail(false) + double dSignalIncrement, int nSignalPoints, double dFilterParam, const char* szDomainName, + const char* szFilterGenerationName, int iZeropad, int iPreinterpolationFactor, int iTraceLevel, + int iGeometry, double dFocalLength, SGP* pSGP) + : m_adFourierCosTable(NULL), m_adFourierSinTable(NULL), m_adFilter(NULL), m_fail(false) { m_idFilterMethod = convertFilterMethodNameToID (szFilterMethodName); if (m_idFilterMethod == FILTER_METHOD_INVALID) { @@ -117,15 +117,15 @@ ProcessSignal::ProcessSignal (const char* szFilterName, const char* szFilterMeth } init (m_idFilter, m_idFilterMethod, dBandwidth, dSignalIncrement, nSignalPoints, dFilterParam, m_idDomain, - m_idFilterGeneration, iZeropad, iPreinterpolationFactor, iTraceLevel, iGeometry, dFocalLength, pSGP); + m_idFilterGeneration, iZeropad, iPreinterpolationFactor, iTraceLevel, iGeometry, dFocalLength, pSGP); } void ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandwidth, double dSignalIncrement, - int nSignalPoints, double dFilterParam, const int idDomain, const int idFilterGeneration, - const int iZeropad, const int iPreinterpolationFactor, int iTraceLevel, int iGeometry, - double dFocalLength, SGP* pSGP) + int nSignalPoints, double dFilterParam, const int idDomain, const int idFilterGeneration, + const int iZeropad, const int iPreinterpolationFactor, int iTraceLevel, int iGeometry, + double dFocalLength, SGP* pSGP) { int i; m_idFilter = idFilter; @@ -191,46 +191,41 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw m_adFilter = new double[ m_nFilterPoints ]; double* adFrequencyFilter = new double [m_nFilterPoints]; filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints); -#ifdef HAVE_SGP - EZPlot* pEZPlot = NULL; - if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot = new EZPlot (); - pEZPlot->ezset ("title Filter Response: Natural Order"); - pEZPlot->ezset ("ylength 0.25"); - pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints); - pEZPlot->plot (pSGP); +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + EZPlotDialog* pEZPlotDlg = NULL; + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Filter Response: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (adFrequencyFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif Fourier::shuffleNaturalToFourierOrder (adFrequencyFilter, m_nFilterPoints); #ifdef HAVE_SGP - if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot->ezset ("title Filter Response: Fourier Order"); - pEZPlot->ezset ("ylength 0.25"); - pEZPlot->ezset ("yporigin 0.25"); - pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints); - pEZPlot->plot (pSGP); + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Filter Response: Fourier Order"); + dlgEZPlot.getEZPlot()->addCurve (adFrequencyFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, FORWARD); delete adFrequencyFilter; -#ifdef HAVE_SGP - if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order"); - pEZPlot->ezset ("ylength 0.25"); - pEZPlot->ezset ("yporigin 0.50"); - pEZPlot->addCurve (m_adFilter, m_nFilterPoints); - pEZPlot->plot (pSGP); +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Inverse Fourier Frequency: Fourier Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif Fourier::shuffleFourierToNaturalOrder (m_adFilter, m_nFilterPoints); -#ifdef HAVE_SGP - if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot->ezset ("title Inverse Fourier Frequency: Natural Order"); - pEZPlot->ezset ("ylength 0.25"); - pEZPlot->ezset ("yporigin 0.75"); - pEZPlot->addCurve (m_adFilter, m_nFilterPoints); - pEZPlot->plot (pSGP); - delete pEZPlot; +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Inverse Fourier Frequency: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif for (i = 0; i < m_nFilterPoints; i++) { @@ -243,14 +238,18 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) { for (i = 0; i < m_nFilterPoints; i++) { int iDetFromZero = i - ((m_nFilterPoints - 1) / 2); - double sinScale = sin (iDetFromZero * m_dSignalInc); - if (fabs(sinScale) < 1E-7) - sinScale = 1; - else - sinScale = (iDetFromZero * m_dSignalInc) / sinScale; + double sinScale = 1 / SignalFilter::sinc (iDetFromZero * m_dSignalInc); double dScale = 0.5 * sinScale * sinScale; m_adFilter[i] *= dScale; } +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Scaled Inverse Fourier Frequency: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); + } +#endif } // if (geometry) } // if (spatial filtering) @@ -266,9 +265,9 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw nextPowerOf2++; nextPowerOf2 += (m_iZeropad - 1); m_nFilterPoints = 1 << nextPowerOf2; -#ifdef DEBUG +#if defined(DEBUG) || defined(_DEBUG) if (m_traceLevel >= Trace::TRACE_CONSOLE) - std::cout << "nFilterPoints = " << m_nFilterPoints << endl; + sys_error (ERR_TRACE, "nFilterPoints = %d", m_nFilterPoints); #endif } m_nOutputPoints = m_nFilterPoints * m_iPreinterpolationFactor; @@ -285,52 +284,54 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw } SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, - m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY); + m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY); m_adFilter = new double [m_nFilterPoints]; filter.copyFilterData (m_adFilter, 0, m_nFilterPoints); - // This doesn't work! - // Need to add filtering for divergent geometries & Frequency/Direct filtering - // Jan 2001: Direct seems to work for equilinear and equiangular - // however, inverse_fourier doesn't work for equiangular on all versions of CTSim tested +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Frequency Filter: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); + } +#endif + // This doesn't work: Need to add filtering for divergent geometries & Frequency/Direct filtering + // Jan 2001: Direct seems to work for equilinear and equiangular + // however, inverse_fourier doesn't work for equiangular on all versions of CTSim tested + // Scaling is done with data in frequency space, natural order if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { for (i = 0; i < m_nFilterPoints; i++) m_adFilter[i] *= 0.5; } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) { for (i = 0; i < m_nFilterPoints; i++) { int iDetFromZero = i - ((m_nFilterPoints - 1) / 2); - double sinScale = sin (iDetFromZero * m_dSignalInc); - if (fabs(sinScale) < 1E-7) - sinScale = 1; - else - sinScale = (iDetFromZero * m_dSignalInc) / sinScale; + double sinScale = 1 / SignalFilter::sinc (iDetFromZero * m_dSignalInc); double dScale = 0.5 * sinScale * sinScale; m_adFilter[i] *= dScale; } } -#ifdef HAVE_SGP - EZPlot* pEZPlot = NULL; - if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot = new EZPlot; - pEZPlot->ezset ("title Filter Filter: Natural Order"); - pEZPlot->ezset ("ylength 0.50"); - pEZPlot->ezset ("yporigin 0.00"); - pEZPlot->addCurve (m_adFilter, m_nFilterPoints); - pEZPlot->plot (pSGP); +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Filter Geometry Scaled: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif Fourier::shuffleNaturalToFourierOrder (m_adFilter, m_nFilterPoints); -#ifdef HAVE_SGP - if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot->ezset ("title Filter Filter: Fourier Order"); - pEZPlot->ezset ("ylength 0.50"); - pEZPlot->ezset ("yporigin 0.50"); - pEZPlot->addCurve (m_adFilter, m_nFilterPoints); - pEZPlot->plot (pSGP); - delete pEZPlot; +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Filter Geometry Scaled: Fourier Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif + + // FILTERING: FREQUENCY - INVERSE FOURIER + } else if (m_idFilterGeneration == FILTER_GENERATION_INVERSE_FOURIER) { // calculate number of filter points with zeropadding int nSpatialPoints = 2 * (m_nSignalPoints - 1) + 1; @@ -347,33 +348,31 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw m_nFilterPoints = 1 << nextPowerOf2; } m_nOutputPoints = m_nFilterPoints * m_iPreinterpolationFactor; -#ifdef DEBUG +#if defined(DEBUG) || defined(_DEBUG) if (m_traceLevel >= Trace::TRACE_CONSOLE) - std::cout << "nFilterPoints = " << m_nFilterPoints << endl; + sys_error (ERR_TRACE, "nFilterPoints = %d", m_nFilterPoints); #endif double* adSpatialFilter = new double [m_nFilterPoints]; SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, nSpatialPoints, m_dBandwidth, - m_dFilterParam, SignalFilter::DOMAIN_SPATIAL); + m_dFilterParam, SignalFilter::DOMAIN_SPATIAL); filter.copyFilterData (adSpatialFilter, 0, nSpatialPoints); -#if defined(HAVE_WXWINDOWS) && defined(DEBUG) - EZPlotDialog pEZPlotDlg = NULL; +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) if (g_bRunningWXWindows && m_traceLevel > 0) { - pEZPlotDlg = new EZPlotDialog; - pEZPlot->getEZPlot()->ezset ("title Spatial Filter: Natural Order"); - pEZPlot->getEZPlot()->ezset ("ylength 0.50"); - pEZPlot->getEZPlot()->ezset ("yporigin 0.00"); - pEZPlot->getEZPlot()->addCurve (adSpatialFilter, nSpatialPoints); + EZPlotDialog dlgEZPlot;; + dlgEZPlot.getEZPlot()->ezset ("title Spatial Filter: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (adSpatialFilter, nSpatialPoints); + dlgEZPlot.ShowModal(); } #endif - -// #define PRE_JAN_2001 1 + +#define PRE_JAN_2001 1 #ifdef PRE_JAN_2001 if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { - for (i = 0; i < m_nFilterPoints; i++) + for (i = 0; i < nSpatialPoints; i++) adSpatialFilter[i] *= 0.5; } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) { - for (i = 0; i < m_nFilterPoints; i++) { - int iDetFromZero = i - ((m_nFilterPoints - 1) / 2); + for (i = 0; i < nSpatialPoints; i++) { + int iDetFromZero = i - ((nSpatialPoints - 1) / 2); double sinScale = sin (iDetFromZero * m_dSignalInc); if (fabs(sinScale) < 1E-7) sinScale = 1; @@ -383,6 +382,14 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw adSpatialFilter[i] *= dScale; } } +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot;; + dlgEZPlot.getEZPlot()->ezset ("title Scaled Spatial Filter: Natural Order"); + dlgEZPlot.getEZPlot()->addCurve (adSpatialFilter, nSpatialPoints); + dlgEZPlot.ShowModal(); + } +#endif for (i = nSpatialPoints; i < m_nFilterPoints; i++) adSpatialFilter[i] = 0; @@ -393,46 +400,74 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw for (i = 0; i < m_nFilterPoints; i++) m_adFilter[i] = std::abs (acInverseFilter[i]) * m_dSignalInc; delete acInverseFilter; +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Fourier Scaled Spatial Filter: Fourier Order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); + } +#endif + #else for (i = nSpatialPoints; i < m_nFilterPoints; i++) adSpatialFilter[i] = 0; - -// for (i = 0; i < m_nFilterPoints; i++) -// adSpatialFilter[i] /= m_dSignalInc; - + std::complex* acInverseFilter = new std::complex [m_nFilterPoints]; finiteFourierTransform (adSpatialFilter, acInverseFilter, m_nFilterPoints, FORWARD); delete adSpatialFilter; m_adFilter = new double [m_nFilterPoints]; for (i = 0; i < m_nFilterPoints; i++) - m_adFilter[i] = std::abs(acInverseFilter[i]); + m_adFilter[i] = std::abs(acInverseFilter[i]); delete acInverseFilter; - + +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Inverse Spatial Filter: Fourier order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); + } +#endif + Fourier::shuffleFourierToNaturalOrder(m_adFilter, m_nFilterPoints); +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Inverse Spatial Filter: Natural order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); + } +#endif if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { for (i = 0; i < m_nFilterPoints; i++) m_adFilter[i] *= 0.5; } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) { for (i = 0; i < m_nFilterPoints; i++) { int iDetFromZero = i - ((m_nFilterPoints - 1) / 2); - double sinScale = sin (iDetFromZero * m_dSignalInc); - if (fabs(sinScale) < 1E-7) - sinScale = 1; - else - sinScale = (iDetFromZero * m_dSignalInc) / sinScale; - double dScale = 0.5 * sinScale * sinScale; - m_adFilter[i] *= dScale; + if (abs(iDetFromZero) < m_nSignalPoints) { + double sinScale = 1 / SignalFilter::sinc (iDetFromZero * m_dSignalInc); + double dScale = 0.5 * sinScale * sinScale; + m_adFilter[i] *= dScale; + } } } +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Scaled Inverse Spatial Filter: Natural order"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); + } +#endif + Fourier::shuffleNaturalToFourierOrder(m_adFilter, m_nFilterPoints); #endif -#if defined(HAVE_WXWINDOWS) && defined(DEBUG) - if (g_bRunningWXWindows && pEZPlotDlg && m_traceLevel > 0) { - pEZPlotDlg->getEZPlot()->ezset ("title Spatial Filter: Inverse"); - pEZPlotDlg->getEZPlot()->ezset ("ylength 0.50"); - pEZPlotDlg->getEZPlot()->ezset ("yporigin 0.50"); - pEZPlotDlg->getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); - pEZPlotDlg->ShowModal(); - delete pEZPlotDlg; +#if defined(HAVE_WXWINDOWS) && (defined(DEBUG) || defined(_DEBUG)) + if (g_bRunningWXWindows && m_traceLevel > 0) { + EZPlotDialog dlgEZPlot; + dlgEZPlot.getEZPlot()->ezset ("title Spatial Filter Inverse Post Geometry Filtering"); + dlgEZPlot.getEZPlot()->addCurve (m_adFilter, m_nFilterPoints); + dlgEZPlot.ShowModal(); } #endif } diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index f9202b0..a652a60 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,13 +6,13 @@ --------------------Configuration: libctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3C.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1A1.tmp" with contents [ /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\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__" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "C:\ctsim\libctsim\procsignal.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3C.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1A1.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1A2.tmp" with contents [ /nologo /out:"Debug\libctsim.lib" .\Debug\array2dfile.obj @@ -44,7 +44,7 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D.tmp" with content .\Debug\transformmatrix.obj .\Debug\xform.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1A2.tmp"

Output Window

Compiling... procsignal.cpp @@ -53,7 +53,7 @@ Creating library... --------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3E.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1A3.tmp" with contents [ comctl32.lib winmm.lib rpcrt4.lib ws2_32.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 ../libctsim/Debug/libctsim.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 ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" .\Debug\ctsim.obj @@ -69,7 +69,7 @@ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib w "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib" \wx2\lib\wxd.lib ] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3E.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1A3.tmp"

Output Window

Linking... diff --git a/src/dlgezplot.cpp b/src/dlgezplot.cpp index acebadb..bdb8cb7 100644 --- a/src/dlgezplot.cpp +++ b/src/dlgezplot.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: dlgezplot.cpp,v 1.1 2001/01/12 16:41:56 kevin Exp $ +** $Id: dlgezplot.cpp,v 1.2 2001/01/12 21:53:27 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 @@ -49,95 +49,98 @@ #include "wx/timer.h" #endif -#include "dlgezplot.h" #include "ct.h" +#include "ctsim.h" +#include "dlgezplot.h" static const int LAYOUT_X_MARGIN = 4; static const int LAYOUT_Y_MARGIN = 4; -BEGIN_EVENT_TABLE(EZPlotDialog, wxDialog) -EVT_BUTTON(wxID_CANCEL, EZPlotDialog::OnCancel) -EVT_CLOSE(EZPlotDialog::OnClose) -EVT_PAINT(EZPlotDialog::OnPaint) +BEGIN_EVENT_TABLE(EZPlotControl, wxPanel) +EVT_PAINT(EZPlotControl::OnPaint) END_EVENT_TABLE() -IMPLEMENT_CLASS(EZPlotDialog, wxDialog) +IMPLEMENT_CLASS(EZPlotControl, wxPanel) -EZPlotDialog::EZPlotDialog (wxWindow *parent) -: wxDialog(parent, -1, wxString("EZPlot"), wxDefaultPosition, wxDefaultSize, wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE), - m_pEZPlot(0), m_pSGPDriver(0), m_pSGP(0), m_pDC(0) +EZPlotControl::EZPlotControl (wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, + const wxValidator& validator, const wxString& name) + : m_pEZPlot(0), m_pSGPDriver(0), m_pSGP(0), m_pDC(0) { - m_parentTop = parent; - while ( m_parentTop && m_parentTop->GetParent() ) - m_parentTop = m_parentTop->GetParent(); - - wxLayoutConstraints* c = new wxLayoutConstraints; - c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); - c->bottom.SameAs(this, wxBottom, 2*LAYOUT_Y_MARGIN); - - wxSize sizeBtn = wxButton::GetDefaultSize(); - c->width.Absolute(sizeBtn.x); - c->height.Absolute(sizeBtn.y); - - SetAutoLayout(TRUE); - Layout(); - - wxSize sizeDlg (500,500); - if (sizeDlg.x != sizeDlg.y) { - sizeDlg.x = max(sizeDlg.x,sizeDlg.y); - sizeDlg.y = max(sizeDlg.x,sizeDlg.y); - } - - m_iClientX = sizeDlg.x; - m_iClientY = sizeDlg.y; - SetClientSize(sizeDlg); - - Centre(wxCENTER_FRAME | wxBOTH); - - if ( m_parentTop ) - m_parentTop->Enable(FALSE); - - Show(TRUE); - Enable(TRUE); // enable this window - - m_pDC = dynamic_cast (new wxClientDC (this)); - int x, y; - this->GetClientSize(&x, &y); - m_pSGPDriver = new SGPDriver (m_pDC, x, y); - m_pSGP = new SGP (*m_pSGPDriver); - m_pSGP->setTextPointSize(10); - m_pEZPlot = new EZPlot; - -#ifdef __WXMAC__ - MacUpdateImmediately(); -#endif -} + Create(parent, id, pos, size, style, name); + + SetSize (GetBestSize()); + m_pEZPlot = new EZPlot; +} -void EZPlotDialog::OnClose(wxCloseEvent& event) +wxSize +EZPlotControl::GetBestSize () const { + return wxSize (500,500); +} + +EZPlotControl::~EZPlotControl() +{ + delete m_pEZPlot; + delete m_pSGP; + delete m_pSGPDriver; + delete m_pDC; } void -EZPlotDialog::OnPaint (wxPaintEvent& event) +EZPlotControl::OnPaint (wxPaintEvent& event) { - m_pEZPlot->plot (m_pSGP); + wxPaintDC dc(this); + GetClientSize (&m_iClientX, &m_iClientY); + m_pSGPDriver = new SGPDriver (&dc, m_iClientX, m_iClientY); + m_pSGP = new SGP (*m_pSGPDriver); + m_pSGP->setTextPointSize(10); + if (m_pEZPlot && m_pSGP) { + m_pSGP->eraseWindow(); + m_pEZPlot->plot (m_pSGP); + } } +EZPlotDialog::EZPlotDialog (wxWindow *parent) +: wxDialog((parent ? parent : theApp->getMainFrame()), -1, wxString("EZPlot"), wxDefaultPosition, wxDefaultSize, wxDIALOG_MODAL), + m_parentTop(0) +{ + if (! parent) + parent = theApp->getMainFrame(); + + m_parentTop = parent; + while ( m_parentTop && m_parentTop->GetParent() ) + m_parentTop = m_parentTop->GetParent(); + + wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); + + pTopSizer->Add (m_pEZPlotCtrl = new EZPlotControl (this), 0, wxALIGN_CENTER | wxALL, 5); + + wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL); + wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay"); + wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel"); + pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10); + pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10); + + pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER); + + SetAutoLayout (true); + SetSizer (pTopSizer); + pTopSizer->Fit (this); + pTopSizer->SetSizeHints (this); +} + + + ///////////////////////////////////////////////////// // destruction EZPlotDialog::~EZPlotDialog() { - if ( m_parentTop ) - m_parentTop->Enable(TRUE); - - delete m_pEZPlot; - delete m_pSGP; - delete m_pSGPDriver; - delete m_pDC; + if ( m_parentTop ) + m_parentTop->Enable(TRUE); } diff --git a/src/dlgezplot.h b/src/dlgezplot.h index efba49a..0ab8806 100644 --- a/src/dlgezplot.h +++ b/src/dlgezplot.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: dlgezplot.h,v 1.1 2001/01/12 16:41:56 kevin Exp $ +** $Id: dlgezplot.h,v 1.2 2001/01/12 21:53:27 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 @@ -37,20 +37,17 @@ #include "wx/dcmemory.h" class wxButton; -class wxStaticText; -class Projections; class SGP; class SGPDriver; class EZPlot; -class EZPlotDialog : public wxDialog -{ -private: - DECLARE_DYNAMIC_CLASS(EZPlotDialog) - DECLARE_EVENT_TABLE() - EZPlot* m_pEZPlot; - wxWindow *m_parentTop; // parent top level window (may be NULL) +class EZPlotControl : public wxPanel +{ +private: + DECLARE_DYNAMIC_CLASS (EZPlotControl) + DECLARE_EVENT_TABLE () + EZPlot* m_pEZPlot; int m_iClientX; // size of client window int m_iClientY; @@ -58,19 +55,38 @@ private: SGP* m_pSGP; wxDC* m_pDC; +public: + EZPlotControl (wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSTATIC_BORDER, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = "EZPlotCtrl"); + + virtual ~EZPlotControl(); + + virtual wxSize GetBestSize() const; + + EZPlot* getEZPlot() + { return m_pEZPlot; } + + void OnPaint(wxPaintEvent& event); +}; + + +class EZPlotDialog : public wxDialog +{ +private: + wxWindow *m_parentTop; // parent top level window (may be NULL) + EZPlotControl* m_pEZPlotCtrl; + public: EZPlotDialog (wxWindow *parent = NULL); ~EZPlotDialog(); - /* Perform projection on view number - return true if ABORT button has not been pressed - */ EZPlot* getEZPlot () - { return m_pEZPlot; } - - void OnClose(wxCloseEvent& event); - void OnPaint(wxPaintEvent& event); + { if (m_pEZPlotCtrl) return m_pEZPlotCtrl->getEZPlot(); else return NULL; } }; #endif diff --git a/src/views.cpp b/src/views.cpp index 85860d0..f8efe44 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.cpp,v 1.59 2001/01/12 16:41:56 kevin Exp $ +** $Id: views.cpp,v 1.60 2001/01/12 21:53:27 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 @@ -2147,13 +2147,6 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) const Projections& rProj = GetDocument()->getProjections(); imageFile.setArraySize (m_iDefaultNX, m_iDefaultNY); - if (m_iDefaultFilterMethod != ProcessSignal::FILTER_METHOD_CONVOLUTION && - m_iDefaultFilterGeneration == ProcessSignal::FILTER_GENERATION_INVERSE_FOURIER && - rProj.geometry() == Scanner::GEOMETRY_EQUIANGULAR) { - wxMessageBox ("Sorry!\nCurrently, frequency-based filtering with inverse_fourier filter generation is not supported equiangular geometry.\nAborting command.", "Not Supported", wxOK | wxICON_WARNING, m_frame); - // return; - } - Reconstructor* pReconstruct = new Reconstructor (rProj, imageFile, 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; -- 2.34.1