r115: *** empty log message ***
[ctsim.git] / libctsim / reconstr.cpp
index 11b9fc56bcf415c1a4a17120806d4c69455a5591..9c887800c8f32fcf7a5e5fae1c4982f1f0794836 100644 (file)
@@ -11,7 +11,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: reconstr.cpp,v 1.1 2000/06/19 02:59:34 kevin Exp $
+**  $Id: reconstr.cpp,v 1.2 2000/06/20 17:54:51 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,9 +59,8 @@ proj_reconst (ImageFile& im, Projections& proj, const FilterType filt_type, doub
   int nview = proj.nView();
   double det_inc = proj.detInc();
   double detlen = (ndet - 1) * det_inc;
-  double *vec_proj = new double [ndet];   // projection data
   int n_filtered_proj = ndet;
-  double* filtered_proj = new double [n_filtered_proj];   // convolved result
+  double filtered_proj [n_filtered_proj];   // convolved result
 
 #ifdef HAVE_BSPLINE_INTERP
   int spline_order = 0, zoom_factor = 0;
@@ -77,12 +76,12 @@ proj_reconst (ImageFile& im, Projections& proj, const FilterType filt_type, doub
   double filterBW = 1. / det_inc;
   double filterMin = -detlen;
   double filterMax = detlen;
-  double* vec_filter = filter_generate (filt_type, filterBW, filterMin, filterMax, n_vec_filter, filt_param, D_SPATIAL, 0);
+
+  SignalFilter filter (filt_type, filterBW, filterMin, filterMax, n_vec_filter, filt_param, D_SPATIAL, 0);
 
 #if HAVE_SGP
-  double *plot_xaxis = NULL;                   /* array for plotting */
   SGP_ID gid;
-  plot_xaxis = new double [n_vec_filter];
+  double plot_xaxis [n_vec_filter];                    // array for plotting 
 
   if (trace > TRACE_TEXT)  {
     int i;
@@ -91,7 +90,7 @@ proj_reconst (ImageFile& im, Projections& proj, const FilterType filt_type, doub
     for (i = 0, f = filterMin; i < n_vec_filter; i++, f += filterInc)
       plot_xaxis[i] = f;
       
-    gid = ezplot (plot_xaxis, vec_filter, n_vec_filter);
+    gid = ezplot (plot_xaxis, filter.getFilter(), n_vec_filter);
     cio_put_str ("Press any key to continue");
     cio_kb_getc ();
     sgp2_close (gid);
@@ -111,10 +110,7 @@ proj_reconst (ImageFile& im, Projections& proj, const FilterType filt_type, doub
     DetectorValue* detval = darray.detValues();
 
     for (int j = 0; j < ndet; j++)
-      vec_proj[j] = detval[j];
-      
-    for (int j = 0; j < ndet; j++)
-      filtered_proj[j] = convolve (vec_proj, vec_filter, det_inc, j, ndet, FUNC_BOTH);
+      filtered_proj[j] = filter.convolve (detval, det_inc, j, ndet, FUNC_BOTH);
 
 #ifdef HAVE_SGP
     if (trace >= TRACE_PLOT)  {
@@ -126,7 +122,7 @@ proj_reconst (ImageFile& im, Projections& proj, const FilterType filt_type, doub
       ezset  ("box.");
       ezset  ("grid.");
       ezset  ("ufinish yes.");
-      ezplot (vec_proj, plot_xaxis, proj.nDet());
+      ezplot (detval, plot_xaxis, proj.nDet());
       ezset  ("clear.");
       ezset  ("xticks major 5.");
       ezset  ("xlabel ");
@@ -168,13 +164,6 @@ proj_reconst (ImageFile& im, Projections& proj, const FilterType filt_type, doub
   }
 
   delete bj;
-  delete vec_proj;
-  delete filtered_proj;
-  delete vec_filter;
-
-#ifdef HAVE_SGP
-  delete plot_xaxis;
-#endif
 
   return (im);
 }