** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.14 2000/07/13 07:03:21 kevin Exp $
+** $Id: projections.cpp,v 1.18 2000/07/29 19:50:08 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
*/
bool
-Projections::reconstruct (ImageFile& im, const char* const filterName, double filt_param, const char* const filterMethodName, const int zeropad, const char* const interpName, int interpFactor, 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 interpFactor, const char* const backprojectName, const int trace) const
{
double detInc = m_detInc;
int n_filteredProj = m_nDet * interpFactor;
cout << "Reconstruct: filter="<<filterName<< ", interp="<<interpName<<", backproject="<<backprojectName<<endl;
#if HAVE_SGP
- SGP_ID gid;
int nVecFilter = filter.getNFilterPoints();
double plot_xaxis [nVecFilter]; // array for plotting
int i;
double f;
double filterInc = filter.getFilterIncrement();
- for (i = 0, f = filter.getFilterMin(); i < nVecFilter; i++, f += filterInc)
+ for (i = 0, f = filter.getFilterMin(); i < nVecFilter; i++, f += filterInc)
plot_xaxis[i] = f;
if (filter.getFilter()) {
- gid = ezplot (plot_xaxis, filter.getFilter(), nVecFilter);
+ SGPDriver sgpDriver ("Filter Function");
+ SGP sgp (sgpDriver);
+ EZPlot ezplot (sgp);
+
+ ezplot.ezset ("title Filter Response");
+ ezplot.addCurve (plot_xaxis, filter.getFilter(), nVecFilter);
+ ezplot.plot();
cio_put_str ("Press any key to continue");
cio_kb_getc ();
- sgp2_close (gid);
}
}
if (trace >= TRACE_TEXT) {
if (trace >= TRACE_TEXT)
printf ("Reconstructing view %d (last = %d)\n", iview, m_nView - 1);
- DetectorArray& darray = getDetectorArray (iview);
- DetectorValue* detval = darray.detValues();
+ const DetectorArray& darray = getDetectorArray (iview);
+ const DetectorValue* detval = darray.detValues();
filter.filterSignal (detval, filteredProj);
-#ifdef HAVE_SGP
- if (trace >= TRACE_PLOT) {
- ezset ("clear.");
- ezset ("xticks major 5.");
- ezset ("xlabel ");
- ezset ("ylabel ");
- ezset ("xlength .5.");
- ezset ("box.");
- ezset ("grid.");
- ezset ("ufinish yes.");
- ezplot (detval, plot_xaxis, m_nDet);
- ezset ("clear.");
- ezset ("xticks major 5.");
- ezset ("xlabel ");
- ezset ("ylabel ");
- ezset ("ustart yes.");
- ezset ("xporigin .5.");
- ezset ("xlength .5.");
- ezset ("box");
-
- ezset ("grid");
- gid = ezplot (filteredProj, plot_xaxis, n_filteredProj);
- }
-#endif //HAVE_SGP
+
#ifdef HAVE_BSPLINE_INTERP
if (interp_type == I_BSPLINE)
#ifdef HAVE_SGP
if (trace >= TRACE_PLOT) {
+ SGPDriver sgpDriverProj ("Projection");
+ SGP sgpProj (sgpDriverProj);
+ EZPlot ezplotProj (sgpProj);
+
+ ezplotProj.ezset ("clear");
+ ezplotProj.ezset ("title Filtered Projection");
+ ezplotProj.ezset ("xticks major 5.");
+ ezplotProj.ezset ("xlabel ");
+ ezplotProj.ezset ("ylabel ");
+ ezplotProj.ezset ("yporigin .5.");
+ ezplotProj.ezset ("ylength .5.");
+ ezplotProj.ezset ("box.");
+ ezplotProj.ezset ("grid.");
+ ezplotProj.addCurve (plot_xaxis, detval, m_nDet);
+ ezplotProj.plot();
+ ezplotProj.ezset ("clear");
+ ezplotProj.ezset ("xticks major 5.");
+ ezplotProj.ezset ("xlabel ");
+ ezplotProj.ezset ("ylabel ");
+ ezplotProj.ezset ("ylength .5.");
+ ezplotProj.ezset ("box");
+ ezplotProj.ezset ("grid");
+ ezplotProj.addCurve (plot_xaxis, filteredProj, n_filteredProj);
+ ezplotProj.plot();
+
+ cout << "Do you want to exit with current pic (y/n)? " << flush;
char str[256];
- printf ("Do you want to exit with current pic (y/n) -- ");
fgets(str, sizeof(str), stdin);
- sgp2_close (sgp2_get_active_win());
if (tolower(str[0]) == 'y') {
break;
}