X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fprocsignal.cpp;h=67641fd52f5b306fde9469c25845c107bb749c07;hb=7f8f356151b0c8db0dbbf1c1896cc22630d6c774;hp=86501abc043b5571d8f87b81afd8aeb52aa7bd59;hpb=516c8b2394cea4e5e5382cd163537c9983269960;p=ctsim.git diff --git a/libctsim/procsignal.cpp b/libctsim/procsignal.cpp index 86501ab..67641fd 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.16 2001/01/12 04:28:37 kevin Exp $ +** $Id: procsignal.cpp,v 1.19 2001/01/12 16:41:56 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 @@ -27,6 +27,10 @@ #include "ct.h" +#ifdef HAVE_WXWINDOWS +#include "../src/dlgezplot.h" +#endif + // FilterMethod ID/Names const int ProcessSignal::FILTER_METHOD_INVALID = -1; const int ProcessSignal::FILTER_METHOD_CONVOLUTION = 0; @@ -351,19 +355,19 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, nSpatialPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL); filter.copyFilterData (adSpatialFilter, 0, nSpatialPoints); -#ifdef HAVE_SGP - EZPlot* pEZPlot = NULL; - if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot = new EZPlot; - pEZPlot->ezset ("title Spatial Filter: Natural Order"); - pEZPlot->ezset ("ylength 0.50"); - pEZPlot->ezset ("yporigin 0.00"); - pEZPlot->addCurve (adSpatialFilter, nSpatialPoints); - pEZPlot->plot (pSGP); - delete pEZPlot; +#if defined(HAVE_WXWINDOWS) && defined(DEBUG) + EZPlotDialog pEZPlotDlg = NULL; + 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); } #endif +// #define PRE_JAN_2001 1 +#ifdef PRE_JAN_2001 if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { for (i = 0; i < m_nFilterPoints; i++) adSpatialFilter[i] *= 0.5; @@ -384,29 +388,51 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw m_adFilter = new double [m_nFilterPoints]; std::complex* acInverseFilter = new std::complex [m_nFilterPoints]; -#define PRE_JAN_2001 1 -#ifdef PRE_JAN_2001 finiteFourierTransform (adSpatialFilter, acInverseFilter, m_nFilterPoints, BACKWARD); delete adSpatialFilter; for (i = 0; i < m_nFilterPoints; i++) m_adFilter[i] = std::abs (acInverseFilter[i]) * m_dSignalInc; delete acInverseFilter; #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]); delete acInverseFilter; + + 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; + } + } #endif -#ifdef HAVE_SGP - if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { - pEZPlot->ezset ("title Spatial Filter: Inverse"); - 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) + 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; } #endif }