r520: no message
[ctsim.git] / libctsim / procsignal.cpp
index b717f8037e104bebc5a453e4571249e5f81173e3..707ee382b96dbc75412ad35115a00c9950dc3830 100644 (file)
@@ -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.25 2001/02/11 04:56:37 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
@@ -44,7 +44,7 @@ const int ProcessSignal::FILTER_METHOD_RFFTW =5 ;
 const char* ProcessSignal::s_aszFilterMethodName[] = {
   {"convolution"},
   {"fourier"},
-  {"fouier_table"},
+  {"fouier-table"},
   {"fft"},
 #if HAVE_FFTW
   {"fftw"},
@@ -69,7 +69,7 @@ const int ProcessSignal::FILTER_GENERATION_DIRECT = 0;
 const int ProcessSignal::FILTER_GENERATION_INVERSE_FOURIER = 1;
 const char* ProcessSignal::s_aszFilterGenerationName[] = {
   {"direct"},
-  {"inverse_fourier"},
+  {"inverse-fourier"},
 };
 const char* ProcessSignal::s_aszFilterGenerationTitle[] = {
   {"Direct"},
@@ -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<double>* acInverseFilter = new std::complex<double> [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
     }
   }