X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=db6431411cff6a435d78a2dfb31a9407a7a1f95b;hb=a2a9671aff06827cec6d6b80234b90128d337e40;hp=3a071b478bceb2f25761068260791512d3f32ca7;hpb=931ea35fdc3a7e463602644e6938730556bf92a7;p=ctsim.git diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index 3a071b4..db64314 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.7 2000/06/29 12:39:46 kevin Exp $ +** $Id: projections.cpp,v 1.12 2000/07/06 08:30:30 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 @@ -487,13 +487,12 @@ Projections::printScanInfo (void) const */ bool -Projections::reconstruct (ImageFile& im, const char* const filterName, double filt_param, const char* const filterMethodName, const char* const interpName, int interp_param, const char* const backprojectName, const int trace) +Projections::reconstruct (ImageFile& im, const char* const filterName, double filt_param, const char* const filterMethodName, const int zeropad, const char* const interpName, int interp_param, const char* const backprojectName, const int trace) { int nview = m_nView; - double det_inc = m_detInc; - double detlen = (m_nDet - 1) * det_inc; - int n_filtered_proj = m_nDet; - double filtered_proj [n_filtered_proj]; // convolved result + double detInc = m_detInc; + int n_filteredProj = m_nDet; + double filteredProj [n_filteredProj]; // filtered projections #ifdef HAVE_BSPLINE_INTERP int spline_order = 0, zoom_factor = 0; @@ -501,16 +500,14 @@ Projections::reconstruct (ImageFile& im, const char* const filterName, double fi zoom_factor = interp_param; spline_order = 3; zoom_factor = 3; - n_filtered_proj = (m_nDet - 1) * (zoom_factor + 1) + 1; + n_filteredProj = (m_nDet - 1) * (zoom_factor + 1) + 1; } #endif - int n_vec_filter = 2 * m_nDet - 1; - double filterBW = 1. / det_inc; - double filterMin = -detlen; - double filterMax = detlen; + double filterBW = 1. / detInc; + SignalFilter filter (filterName, filterMethodName, filterBW, m_detInc, m_nDet, filt_param, "spatial", zeropad); + filter.setTraceLevel(trace); - SignalFilter filter (filterName, filterBW, filterMin, filterMax, n_vec_filter, filt_param, "spatial", 0); if (filter.fail()) { sys_error (ERR_SEVERE, "%s [Projections::reconstruct]", filter.failMessage().c_str()); return false; @@ -521,22 +518,25 @@ Projections::reconstruct (ImageFile& im, const char* const filterName, double fi #if HAVE_SGP SGP_ID gid; - double plot_xaxis [n_vec_filter]; // array for plotting + int nVecFilter = filter.getNFilterPoints(); + double plot_xaxis [nVecFilter]; // array for plotting - if (trace > TRACE_TEXT) { + if (trace > TRACE_TEXT && nVecFilter > 0) { int i; double f; - double filterInc = (filterMax - filterMin) / (n_vec_filter - 1); - for (i = 0, f = filterMin; i < n_vec_filter; i++, f += filterInc) + double filterInc = filter.getFilterIncrement(); + for (i = 0, f = filter.getFilterMin(); i < nVecFilter; i++, f += filterInc) plot_xaxis[i] = f; - - gid = ezplot (plot_xaxis, filter.getFilter(), n_vec_filter); - cio_put_str ("Press any key to continue"); - cio_kb_getc (); - sgp2_close (gid); + + if (filter.getFilter()) { + gid = ezplot (plot_xaxis, filter.getFilter(), nVecFilter); + cio_put_str ("Press any key to continue"); + cio_kb_getc (); + sgp2_close (gid); + } } if (trace >= TRACE_TEXT) { - printf ("nview=%d, ndet=%d, det_start=%.4f, det_inc=%.4f\n", m_nView, m_nDet, m_detStart, m_detInc); + printf ("nview=%d, ndet=%d, det_start=%.4f, detInc=%.4f\n", m_nView, m_nDet, m_detStart, m_detInc); } #endif //HAVE_SGP @@ -553,8 +553,7 @@ Projections::reconstruct (ImageFile& im, const char* const filterName, double fi DetectorArray& darray = getDetectorArray (iview); DetectorValue* detval = darray.detValues(); - for (int j = 0; j < m_nDet; j++) - filtered_proj[j] = filter.convolve (detval, det_inc, j, m_nDet); + filter.filterSignal (detval, filteredProj); #ifdef HAVE_SGP if (trace >= TRACE_PLOT) { @@ -576,23 +575,23 @@ Projections::reconstruct (ImageFile& im, const char* const filterName, double fi ezset ("xlength .5."); ezset ("box"); ezset ("grid"); - gid = ezplot (filtered_proj, plot_xaxis, m_nDet); + gid = ezplot (filteredProj, plot_xaxis, m_nDet); } #endif //HAVE_SGP #ifdef HAVE_BSPLINE_INTERP if (interp_type == I_BSPLINE) - bspline (m_nDet, zoom_factor, spline_order, filtered_proj, filtered_proj); + bspline (m_nDet, zoom_factor, spline_order, filteredProj, filteredProj); #ifdef HAVE_SGP if (trace >= TRACE_PLOT && interp_type == I_BSPLINE) { - bspline (m_nDet, zoom_factor, spline_order, filtered_proj, filtered_proj); - ezplot_1d (filtered_proj, n_filtered_proj); + bspline (m_nDet, zoom_factor, spline_order, filteredProj, filteredProj); + ezplot_1d (filteredProj, n_filteredProj); } #endif #endif - bj.BackprojectView (filtered_proj, darray.viewAngle()); + bj.BackprojectView (filteredProj, darray.viewAngle()); #ifdef HAVE_SGP if (trace >= TRACE_PLOT) {