X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fprocsignal.cpp;h=b5c6678c2d6c0c605032d2d3d219353d4d521a84;hp=b717f8037e104bebc5a453e4571249e5f81173e3;hb=9776c9a12ba53419d34563a5ec57c90e3d6798f4;hpb=ed576a069b0ba9de2e9153707012eba620ac606e diff --git a/libctsim/procsignal.cpp b/libctsim/procsignal.cpp index b717f80..b5c6678 100644 --- a/libctsim/procsignal.cpp +++ b/libctsim/procsignal.cpp @@ -7,9 +7,9 @@ ** Date Started: Aug 1984 ** ** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg +** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: procsignal.cpp,v 1.20 2001/01/12 21:53:27 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 @@ -28,7 +28,7 @@ #include "ct.h" #ifdef HAVE_WXWINDOWS -#include "../src/dlgezplot.h" +#include "dlgezplot.h" #endif // FilterMethod ID/Names @@ -41,17 +41,17 @@ 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"}, + {"fouier-table"}, {"fft"}, #if HAVE_FFTW {"fftw"}, {"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"}, + {"inverse-fourier"}, }; -const char* ProcessSignal::s_aszFilterGenerationTitle[] = { +const char* const ProcessSignal::s_aszFilterGenerationTitle[] = { {"Direct"}, {"Inverse Fourier"}, }; @@ -192,7 +192,6 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw double* adFrequencyFilter = new double [m_nFilterPoints]; filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints); #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"); @@ -297,10 +296,9 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw } #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 + // This works fairly well. I'm not sure why since scaling for geometries is done on + // frequency filter rather than spatial filter as it should be. + // It gives values slightly off than freq/inverse filtering if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { for (i = 0; i < m_nFilterPoints; i++) m_adFilter[i] *= 0.5; @@ -365,8 +363,6 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw } #endif -#define PRE_JAN_2001 1 -#ifdef PRE_JAN_2001 if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { for (i = 0; i < nSpatialPoints; i++) adSpatialFilter[i] *= 0.5; @@ -408,68 +404,6 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw dlgEZPlot.ShowModal(); } #endif - -#else - for (i = nSpatialPoints; i < m_nFilterPoints; i++) - adSpatialFilter[i] = 0; - - 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 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); - 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) || 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 } }