TODO
Read PlotFile's.
- Add help button onto dialog's for reconstruction & projections.
- Consider use of wxWindows help file classes.
-
- Consider changing POL to to read tag tokens.
-
- Consider being able to write Phantom files as text and view as
- text in ctsim.
3.0alpha1 - Released 12/30/00
* ctsim: Added row and column plot comparisons between two image
files.
+ * ctsim: Added "Process" menu to image file display with math
+ functions. Added 2-dimensional inverse Fourier to math functions.
+
* mathfuncs.cpp: Reworked statistics algorithm to share between
imagefile and plotfile classes.
if1.cpp and if2.cpp to imagefile.cpp
* if1: Updated to handle error conditions, such as sqrt of a
- negative number.
+ negative number. Converted to use new ImageFile math functions.
* if2: Updated to output plot files and use new ImageFile class
math functions
individual curves. Improved display of labels and ticks. Updated
to use POL class member variable. Updated to more C++ conventions.
- * pol: converted to C++ class
+ * pol: converted to C++ class. Extracted HashTable to separate
+ class.
* sgp: Added linestyle settings
-Convert pol to C++ object.
+Add help button onto dialog's for reconstruction & projections.
+Consider use of wxWindows help file classes.
+
+Consider changing POL to to read tag tokens.
+
+Consider being able to write Phantom files as text and view as
+text in ctsim.
FFT filtering requires FFTW library. Add a basic FFT routine.
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ctsupport.h,v 1.17 2000/12/27 20:09:19 kevin Exp $
+** $Id: ctsupport.h,v 1.18 2000/12/29 15:45:06 kevin Exp $
**
**
** This program is free software; you can redistribute it and/or modify
/* syserror.cpp */
void sys_error(int severity, const char *msg, ...);
-void sys_verror(int severity, const char *msg, va_list arg);
+void sys_verror (std::string& strOutput, int severity, const char *msg, va_list arg);
void sys_error_level(int severity);
// Math Section
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezplot.h,v 1.22 2000/12/27 03:16:02 kevin Exp $
+** $Id: ezplot.h,v 1.23 2000/12/29 15:45:06 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
void make_numfmt(char *fmtstr, int *fldwid, int *nfrac, double min, double max, int nint);
int axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp);
- SGP& rSGP;
+ SGP* m_pSGP;
POL m_pol;\r
void clearCurves ();
{ return ygn_min + (y - ygw_min) * m_yWorldScale; }
public:
- EZPlot (SGP& sgp);
+ EZPlot ();
~EZPlot ();
bool ezset (const std::string& command);\r
void addCurve (const double* y, int n);
void addCurve (const float* y, int n);
- void plot ();
+ void plot (SGP* pSGP);
};
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: imagefile.h,v 1.23 2000/12/22 04:18:00 kevin Exp $
+** $Id: imagefile.h,v 1.24 2000/12/29 15:45:06 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
void filterResponse (const char* const domainName, double bw, const char* const filterName, double filt_param);
void statistics (double& min, double& max, double& mean, double& mode, double& median, double& stddev) const;
-
void getMinMax (double& min, double& max) const;
-
void printStatistics (std::ostream& os) const;
-
bool comparativeStatistics (const ImageFile& imComp, double& d, double& r, double& e) const;
-
bool printComparativeStatistics (const ImageFile& imComp, std::ostream& os) const;
\r
- bool subtractImages (const ImageFile& rRHS, ImageFile& result) const;\r
-
+ bool subtractImages (const ImageFile& rRHS, ImageFile& result) const;
bool addImages (const ImageFile& rRHS, ImageFile& result) const;\r
-\r
bool multiplyImages (const ImageFile& rRHS, ImageFile& result) const;\r
-\r
bool divideImages (const ImageFile& rRHS, ImageFile& result) const;\r
\r
+ bool invertPixelValues (ImageFile& result) const;\r
+ bool sqrt (ImageFile& result) const;\r
+ bool square (ImageFile& result) const;\r
+ bool log (ImageFile& result) const;\r
+ bool exp (ImageFile& result) const;\r
+ bool FFTMagnitude (ImageFile& result) const;\r
+ bool FFTPhase (ImageFile& result) const;\r
+\r
int display (void) const;
-
int displayScaling (const int scaleFactor, ImageFileValue pmin, ImageFileValue pmax) const;
#if HAVE_PNG
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: pol.h,v 1.8 2000/12/27 20:09:19 kevin Exp $
+** $Id: pol.h,v 1.9 2000/12/29 15:45:06 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
#define __H_POL
\r
#include "hashtable.h"\r
-\r
+#include <stack>\r
class POL {
PC_DUMP,\r
};\r
\r
+ enum {\r
+ INPUT_STREAM = 1,\r
+ INPUT_FILE,\r
+ INPUT_STRING,\r
+ };\r
+\r
+ int m_iInputType;\r
+ std::istream* m_pInputStream;\r
+ FILE* m_pInputFile;\r
+ char* m_pszInputString;\r
+\r
enum {\r
MAXFILE = 8,\r
};\r
char inputline[MAXLINE]; /* current input line */\r
int lineptr; /* current position in inputline */\r
\r
- enum {\r
- BUFSIZE = 100,\r
- };\r
- int bp; // pointer to next free position \r
- int buf[BUFSIZE]; // pushed back input characters \r
- \r
+ std::stack<int> m_stackPushBackInput;\r
+\r
bool skipSingleToken (char term[]);\r
int tok (struct token_st *token);\r
void dumptok (struct token_st *token);\r
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: procsignal.h,v 1.8 2000/12/16 06:12:47 kevin Exp $
+** $Id: procsignal.h,v 1.9 2000/12/29 15:45:06 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
static const int FILTER_GENERATION_INVALID;
static const int FILTER_GENERATION_DIRECT;
static const int FILTER_GENERATION_INVERSE_FOURIER;
+\r
+ enum {\r
+ FORWARD = -1,\r
+ BACKWARD = 1,\r
+ };\r
ProcessSignal (const char* szFilterName, const char* szFilterMethodName,double bw, double signalIncrement, int n, double param, const char* szDomainName, const char* szFilterGenerationName, const int zeropad = 0, const int preinterpolationFactor = 1, const int iTraceLevel = Trace::TRACE_NONE, int iGeometry = Scanner::GEOMETRY_PARALLEL, double dFocalLength = 1., SGP* pSGP = NULL);
static void finiteFourierTransform (const std::complex<double> input[], double output[], const int n, const int direction);
- static void shuffleNaturalToFourierOrder (double* pdVector, const int n);
-
- static void shuffleFourierToNaturalOrder (double* pdVector, const int n);
+ static void shuffleNaturalToFourierOrder (double* pdVector, const int n);\r
+ static void shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n);\r
+ static void shuffleFourierToNaturalOrder (double* pdVector, const int n);\r
+ static void shuffleFourierToNaturalOrder (std::complex<double>* pdVector, const int n);\r
private:
std::string m_nameFilterMethod;
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezplot.cpp,v 1.25 2000/12/27 20:09:19 kevin Exp $
+** $Id: ezplot.cpp,v 1.26 2000/12/29 15:45:06 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
}
-EZPlot::EZPlot (SGP& sgp)
-: rSGP (sgp)
+EZPlot::EZPlot ()
{
initKeywords();\r
m_pol.addSkipWord ("please");\r
void
EZPlot::initPlotSettings ()
{
- charheight = rSGP.getCharHeight();
- charwidth = rSGP.getCharWidth();
-\r
m_iCurrentCurve = -1;\r
+ m_pSGP = NULL;\r
c_xlabel = "";
c_ylabel = "";
*/
void
-EZPlot::plot ()
+EZPlot::plot (SGP* pSGP)
{\r
if (m_vecCurves.size() <= 0)
return;
-
- rSGP.setWindow (0., 0., 1., 1.);
+ \r
+ m_pSGP = pSGP;\r
+
+ m_pSGP->setWindow (0., 0., 1., 1.);
if (s_textsize == TRUE)
- rSGP.setTextPointSize (v_textsize);\r
- charheight = rSGP.getCharHeight();
- charwidth = rSGP.getCharWidth();
+ m_pSGP->setTextPointSize (v_textsize);\r
+ charheight = m_pSGP->getCharHeight();
+ charwidth = m_pSGP->getCharWidth();
const EZPlotCurve& firstCurve = *m_vecCurves[0];\r
double xmin = firstCurve.x[0]; // extent of curves in world coord
title_row = ya_max;;\r
if (c_title.length() > 0)
ya_max -= 2 * charheight;\r
+ else\r
+ ya_max -= 0.7 * charheight; // allow room for yaxis ticklabel\r
// calculate legend box boundaries
int max_leg = 0; // longest legend in characters
yl_min = yl_max - leg_height;
- rSGP.setColor (clr_legend);
- rSGP.drawRect (xl_min, yl_min, xl_max, yl_max);
+ m_pSGP->setColor (clr_legend);
+ m_pSGP->drawRect (xl_min, yl_min, xl_max, yl_max);
int iLegend = 0; // current legend position \r
for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
double xmax = xl_max - 1.0 * charwidth;
double y = yl_max - (2.0 + iLegend * 3) * charheight;
- rSGP.moveAbs (xmin, y + 0.5 * charheight);\r
- rSGP.drawText (pstrLegend->c_str());
- rSGP.setColor (getColor (iCurve));\r
+ m_pSGP->moveAbs (xmin, y + 0.5 * charheight);\r
+ m_pSGP->drawText (pstrLegend->c_str());
+ m_pSGP->setColor (getColor (iCurve));\r
int iLS = getLinestyle (iCurve);
if (iLS != SGP::LS_NOLINE) {
- rSGP.setLineStyle (iLS);
- rSGP.moveAbs (xmin, y);
- rSGP.lineAbs (xmax, y);
+ m_pSGP->setLineStyle (iLS);
+ m_pSGP->moveAbs (xmin, y);
+ m_pSGP->lineAbs (xmax, y);
}\r
int iSymbol = getSymbol (iCurve);
if (iSymbol > 0) {
double xinc = (xmax - xmin) / (5 - 1);
- rSGP.setLineStyle (SGP::LS_SOLID);
+ m_pSGP->setLineStyle (SGP::LS_SOLID);
for (int j = 0; j < 5; j++) {
- rSGP.moveAbs (xmin + j * xinc, y);
+ m_pSGP->moveAbs (xmin + j * xinc, y);
symbol(iSymbol, 0.5 * charwidth, 0.5 * charheight);
}
}
// Y-Label
if (c_ylabel.length() > 0) {\r
- rSGP.setTextAngle (HALFPI);\r
- rSGP.setTextSize (1.5 * charheight);\r
+ m_pSGP->setTextAngle (HALFPI);\r
+ m_pSGP->setTextSize (1.5 * charheight);\r
double xExtent, yExtent;\r
- rSGP.getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
- rSGP.setTextSize (charheight);\r
+ m_pSGP->getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
+ m_pSGP->setTextSize (charheight);\r
xa_min += xExtent;\r
- rSGP.setTextAngle (0.0);\r
+ m_pSGP->setTextAngle (0.0);\r
}
ylbl_col = xp_min;
// PLOT CURVES
- rSGP.setLineStyle (SGP::LS_SOLID);
+ m_pSGP->setLineStyle (SGP::LS_SOLID);
drawAxes();
// size of symbol in NDC
for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
const EZPlotCurve* const pCurve = m_vecCurves [iCurve];
\r
- rSGP.setColor (getColor (iCurve));\r
+ m_pSGP->setColor (getColor (iCurve));\r
int iSym = getSymbol (iCurve);\r
int iLS = getLinestyle (iCurve);\r
\r
if (iLS != SGP::LS_NOLINE) {
- rSGP.setLineStyle (iLS);
+ m_pSGP->setLineStyle (iLS);
double x1 = convertWorldToNDC_X (pCurve->x[0]);
double y1 = convertWorldToNDC_Y (pCurve->y[0]);\r
for (int i = 1; i < pCurve->m_iPointCount; i++) {
double x2Clip = x2;\r
double y2Clip = y2;\r
if (clip_rect (x1, y1, x2Clip, y2Clip, clipRect)) {\r
- rSGP.moveAbs (x1, y1);\r
- rSGP.lineAbs (x2Clip, y2Clip);\r
+ m_pSGP->moveAbs (x1, y1);\r
+ m_pSGP->lineAbs (x2Clip, y2Clip);\r
}\r
x1 = x2;\r
y1 = y2;\r
}
if (iSym > 0) {\r
int iSymFreq = getSymbolFreq (iCurve);
- rSGP.setLineStyle (SGP::LS_SOLID);
+ m_pSGP->setLineStyle (SGP::LS_SOLID);
double x = convertWorldToNDC_X (pCurve->x[0]);
double y = convertWorldToNDC_Y (pCurve->y[0]);
- rSGP.moveAbs (x, y);
+ m_pSGP->moveAbs (x, y);
symbol (iSym, symwidth, symheight);
for (int i = 1; i < pCurve->m_iPointCount; i++)
if (i % iSymFreq == 0 || i == pCurve->m_iPointCount - 1) {
x = convertWorldToNDC_X (pCurve->x[i]);
y = convertWorldToNDC_Y (pCurve->y[i]);\r
if (y >= ygn_min && y <= ygn_max) {
- rSGP.moveAbs (x, y);
+ m_pSGP->moveAbs (x, y);
symbol (iSym, symwidth, symheight);\r
}
}
char str[256];
char *numstr;
- rSGP.setTextSize (charheight);
- rSGP.setTextColor (1, -1);
+ m_pSGP->setTextSize (charheight);
+ m_pSGP->setTextColor (1, -1);
if (o_xticks == ABOVE)
xticklen = 0.5 * charheight;
if (c_title.length() > 0) {
double wText, hText;
- rSGP.setTextSize (charheight * 2.0);
- rSGP.getTextExtent (c_title.c_str(), &wText, &hText);
- rSGP.moveAbs (xa_min + (xa_max-xa_min)/2 - wText/2, title_row);
- rSGP.setTextColor (clr_title, -1);
- rSGP.drawText (c_title);
- rSGP.setTextSize (charheight);
+ m_pSGP->setTextSize (charheight * 2.0);
+ m_pSGP->getTextExtent (c_title.c_str(), &wText, &hText);
+ m_pSGP->moveAbs (xa_min + (xa_max-xa_min)/2 - wText/2, title_row);
+ m_pSGP->setTextColor (clr_title, -1);
+ m_pSGP->drawText (c_title);
+ m_pSGP->setTextSize (charheight);
}
if (o_grid == TRUE || o_box == TRUE) {
- rSGP.setColor (clr_axis);
- rSGP.moveAbs (xa_min, ya_min);
- rSGP.lineAbs (xa_max, ya_min);
- rSGP.lineAbs (xa_max, ya_max);
- rSGP.lineAbs (xa_min, ya_max);
- rSGP.lineAbs (xa_min, ya_min);
+ m_pSGP->setColor (clr_axis);
+ m_pSGP->moveAbs (xa_min, ya_min);
+ m_pSGP->lineAbs (xa_max, ya_min);
+ m_pSGP->lineAbs (xa_max, ya_max);
+ m_pSGP->lineAbs (xa_min, ya_max);
+ m_pSGP->lineAbs (xa_min, ya_min);
}
// calculate position of axes
if (o_xaxis == LINEAR) {
// draw axis line
- rSGP.setColor (clr_axis);
+ m_pSGP->setColor (clr_axis);
if (o_tag && !o_grid && !o_box && s_xcross) {
- rSGP.moveAbs (xa_min, xaxispos - charheight);
- rSGP.lineAbs (xa_min, xaxispos + charheight);
+ m_pSGP->moveAbs (xa_min, xaxispos - charheight);
+ m_pSGP->lineAbs (xa_min, xaxispos + charheight);
}
- rSGP.moveAbs (xa_min, xaxispos);
- rSGP.lineAbs (xa_max, xaxispos);
+ m_pSGP->moveAbs (xa_min, xaxispos);
+ m_pSGP->lineAbs (xa_max, xaxispos);
if (o_tag && !o_grid && !o_box) {
- rSGP.moveAbs (xa_max, xaxispos - charheight);
- rSGP.lineAbs (xa_max, xaxispos + charheight);
+ m_pSGP->moveAbs (xa_max, xaxispos - charheight);
+ m_pSGP->lineAbs (xa_max, xaxispos + charheight);
}
if (o_grid == TRUE) {
- rSGP.setColor (clr_grid);
+ m_pSGP->setColor (clr_grid);
for (i = 0; i <= x_nint; i++) {
- rSGP.moveAbs (xt_min + xn_tickinc * i, ya_max);
- rSGP.lineAbs (xt_min + xn_tickinc * i, ya_min);
+ m_pSGP->moveAbs (xt_min + xn_tickinc * i, ya_max);
+ m_pSGP->lineAbs (xt_min + xn_tickinc * i, ya_min);
}
}
- rSGP.setTextSize (charheight * 1.5);
- rSGP.setTextColor (clr_label, -1);\r
+ m_pSGP->setTextSize (charheight * 1.5);
+ m_pSGP->setTextColor (clr_label, -1);\r
double wText, hText;\r
- rSGP.getTextExtent (c_xlabel.c_str(), &wText, &hText);
- rSGP.moveAbs (xa_min + (xa_max-xa_min)/2 - wText / 2, xlbl_row + charheight * 1.5);\r
- rSGP.drawText (c_xlabel);
- rSGP.setTextSize (charheight);
+ m_pSGP->getTextExtent (c_xlabel.c_str(), &wText, &hText);
+ m_pSGP->moveAbs (xa_min + (xa_max-xa_min)/2 - wText / 2, xlbl_row + charheight * 1.5);\r
+ m_pSGP->drawText (c_xlabel);
+ m_pSGP->setTextSize (charheight);
minorinc = xn_tickinc / (o_xminortick + 1);
for (i = 0; i <= x_nint; i++) {
x = xt_min + xn_tickinc * i;
- rSGP.setColor (clr_axis);
- rSGP.moveAbs (x, xaxispos);
- rSGP.lineAbs (x, xaxispos + xticklen);
+ m_pSGP->setColor (clr_axis);
+ m_pSGP->moveAbs (x, xaxispos);
+ m_pSGP->lineAbs (x, xaxispos + xticklen);
if (i != x_nint)
for (j = 1; j <= o_xminortick; j++) {
x2 = x + minorinc * j;
- rSGP.moveAbs (x2, xaxispos);
- rSGP.lineAbs (x2, xaxispos + TICKRATIO * xticklen);
+ m_pSGP->moveAbs (x2, xaxispos);
+ m_pSGP->lineAbs (x2, xaxispos + TICKRATIO * xticklen);
}
axis_near = FALSE;
if (xaxispos + xtl_ofs > ya_min && o_yaxis != NOAXIS) {
if (o_xtlabel == TRUE && axis_near == FALSE) {
snprintf (str, sizeof(str), x_numfmt, xgw_min + xw_tickinc * i);
numstr = str_skip_head (str, " ");
- rSGP.moveAbs (x-strlen(numstr)*charwidth/2, xaxispos + xtl_ofs);
- rSGP.setTextColor (clr_number, -1);
- rSGP.drawText (numstr);
+ m_pSGP->moveAbs (x-strlen(numstr)*charwidth/2, xaxispos + xtl_ofs);
+ m_pSGP->setTextColor (clr_number, -1);
+ m_pSGP->drawText (numstr);
}
}
} // X - Axis
if (o_yaxis == LINEAR) {
- rSGP.setColor (clr_axis);
+ m_pSGP->setColor (clr_axis);
if (o_tag && !o_grid && !o_box && s_ycross) {
- rSGP.moveAbs (yaxispos - charwidth, ya_min);
- rSGP.lineAbs (yaxispos + charwidth, ya_min);
+ m_pSGP->moveAbs (yaxispos - charwidth, ya_min);
+ m_pSGP->lineAbs (yaxispos + charwidth, ya_min);
}
- rSGP.moveAbs (yaxispos, ya_min);
- rSGP.lineAbs (yaxispos, ya_max);
+ m_pSGP->moveAbs (yaxispos, ya_min);
+ m_pSGP->lineAbs (yaxispos, ya_max);
if (o_tag && !o_grid && !o_box) {
- rSGP.moveAbs (yaxispos - charwidth, ya_max);
- rSGP.lineAbs (yaxispos + charwidth, ya_max);
+ m_pSGP->moveAbs (yaxispos - charwidth, ya_max);
+ m_pSGP->lineAbs (yaxispos + charwidth, ya_max);
}
if (o_grid == TRUE) {
- rSGP.setColor (clr_grid);
+ m_pSGP->setColor (clr_grid);
for (i = 0; i <= y_nint; i++) {
y = yt_min + yn_tickinc * i;
- rSGP.moveAbs (xa_max, y);
- rSGP.lineAbs (xa_min, y);
+ m_pSGP->moveAbs (xa_max, y);
+ m_pSGP->lineAbs (xa_min, y);
}
}\r
- rSGP.setTextAngle (HALFPI);
- rSGP.setTextSize (1.5 * charheight);
- rSGP.setTextColor (clr_label, -1);\r
+ m_pSGP->setTextAngle (HALFPI);
+ m_pSGP->setTextSize (1.5 * charheight);
+ m_pSGP->setTextColor (clr_label, -1);\r
double xExtent, yExtent;\r
- rSGP.getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
- rSGP.moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - yExtent / 2);\r
- rSGP.drawText (c_ylabel);\r
- rSGP.setTextAngle (0.0);
- rSGP.setTextSize (charheight);
+ m_pSGP->getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
+ m_pSGP->moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - yExtent / 2);\r
+ m_pSGP->drawText (c_ylabel);\r
+ m_pSGP->setTextAngle (0.0);
+ m_pSGP->setTextSize (charheight);
minorinc = yn_tickinc / (o_yminortick + 1);
for (i = 0; i <= y_nint; i++) {
y = yt_min + yn_tickinc * i;
- rSGP.setColor (clr_axis);
- rSGP.moveAbs (yaxispos, y);
- rSGP.lineAbs (yaxispos + yticklen, y);
+ m_pSGP->setColor (clr_axis);
+ m_pSGP->moveAbs (yaxispos, y);
+ m_pSGP->lineAbs (yaxispos + yticklen, y);
if (i != y_nint)
for (j = 1; j <= o_yminortick; j++) {
y2 = y + minorinc * j;
- rSGP.moveAbs (yaxispos, y2);
- rSGP.lineAbs (yaxispos + TICKRATIO * yticklen, y2);
+ m_pSGP->moveAbs (yaxispos, y2);
+ m_pSGP->lineAbs (yaxispos + TICKRATIO * yticklen, y2);
}
axis_near = FALSE;
if (yaxispos + ytl_ofs > xa_min && o_xaxis != NOAXIS) {
}
if (o_ytlabel == TRUE && axis_near == FALSE) {
snprintf (str, sizeof(str), y_numfmt, ygw_min + yw_tickinc * i);\r
- rSGP.moveAbs (yaxispos + ytl_ofs, y + 0.5 * charheight);\r
- rSGP.setTextColor (clr_number, -1);\r
- rSGP.drawText (str);
+ m_pSGP->moveAbs (yaxispos + ytl_ofs, y + 0.5 * charheight);\r
+ m_pSGP->setTextColor (clr_number, -1);\r
+ m_pSGP->drawText (str);
}
}
} // Y - Axis
return;
if (sym == SB_CROSS) {
- rSGP.moveRel (-0.5 * symwidth, -0.5 * symheight);
- rSGP.lineRel (symwidth, symheight);
- rSGP.moveRel (-symwidth, 0.0);
- rSGP.lineRel (symwidth, -symheight);
- rSGP.moveRel (-0.5 * symwidth, 0.5 * symheight);
+ m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+ m_pSGP->lineRel (symwidth, symheight);
+ m_pSGP->moveRel (-symwidth, 0.0);
+ m_pSGP->lineRel (symwidth, -symheight);
+ m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
} else if (sym == SB_PLUS) {
- rSGP.moveRel (-0.5 * symwidth, 0.0);
- rSGP.lineRel (symwidth, 0.0);
- rSGP.moveRel (-0.5 * symwidth, -0.5 * symheight);
- rSGP.lineRel (0.0, symheight);
- rSGP.moveRel (0.0, -0.5 * symheight);
+ m_pSGP->moveRel (-0.5 * symwidth, 0.0);
+ m_pSGP->lineRel (symwidth, 0.0);
+ m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+ m_pSGP->lineRel (0.0, symheight);
+ m_pSGP->moveRel (0.0, -0.5 * symheight);
} else if (sym == SB_BOX) {
- rSGP.moveRel (-0.5 * symwidth, -0.5 * symheight);
- rSGP.lineRel (symwidth, 0.0);
- rSGP.lineRel (0.0, symheight);
- rSGP.lineRel (-symwidth, 0.0);
- rSGP.lineRel (0.0, -symheight);
- rSGP.moveRel (0.5 * symwidth, 0.5 * symheight);
+ m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+ m_pSGP->lineRel (symwidth, 0.0);
+ m_pSGP->lineRel (0.0, symheight);
+ m_pSGP->lineRel (-symwidth, 0.0);
+ m_pSGP->lineRel (0.0, -symheight);
+ m_pSGP->moveRel (0.5 * symwidth, 0.5 * symheight);
} else if (sym == SB_CIRCLE) {
- rSGP.drawCircle (symwidth);
+ m_pSGP->drawCircle (symwidth);
} else if (sym == SB_ERRORBAR) {
- rSGP.moveRel (-0.5 * symwidth, 0.5 * symheight);
- rSGP.lineRel (symwidth, 0.0);
- rSGP.moveRel (-0.5 * symwidth, 0.0);
- rSGP.lineRel (0.0, -symheight);
- rSGP.moveRel (-0.5 * symwidth, 0.0);
- rSGP.lineRel (symwidth, 0.0);
- rSGP.moveRel (-0.5 * symwidth, 0.5 * symheight);
+ m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
+ m_pSGP->lineRel (symwidth, 0.0);
+ m_pSGP->moveRel (-0.5 * symwidth, 0.0);
+ m_pSGP->lineRel (0.0, -symheight);
+ m_pSGP->moveRel (-0.5 * symwidth, 0.0);
+ m_pSGP->lineRel (symwidth, 0.0);
+ m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
}
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezset.cpp,v 1.14 2000/12/27 20:09:19 kevin Exp $
+** $Id: ezset.cpp,v 1.15 2000/12/29 15:45:06 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
}
break;
case S_REPLOT:
- plot ();
+ plot (m_pSGP);
break;
case S_CLEAR:
clearCurves ();
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: pol.cpp,v 1.7 2000/12/27 20:09:19 kevin Exp $
+** $Id: pol.cpp,v 1.8 2000/12/29 15:45:06 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
POL::POL()
{
- bp = 0;
currentf = -1;\r
m_bTrace = false;
init();
sys_error (ERR_SEVERE, "files nested too deeply");
return;
}
-
- bp = 0; /* clear any pushed back input */
-
+ \r
+ while (! m_stackPushBackInput.empty())\r
+ m_stackPushBackInput.pop();\r
+
if (source == P_USE_STR) {
filep[currentf] = NULL;
} else if (source == P_USE_FILE) {
int
POL::getch (FILE *fp)
{
- int c;
-
- if (bp > 0)
- return (buf[--bp]);
-
+ int c;\r
+ if (m_stackPushBackInput.size() > 0) {\r
+ c = m_stackPushBackInput.top();\r
+ m_stackPushBackInput.pop();\r
+ return c;\r
+ }\r
+
if (fp == NULL) {
if ((c = inputline[lineptr]) == EOS)
return (EOF);
return (c);
}
-/* push character back on input */
+// push character back on input
void
POL::ungetch (int c)
{
- if (bp > BUFSIZE)
- sys_error (ERR_SEVERE, "too many characters pushed back [ungetch]");
- else
- buf[bp++] = c;
+ m_stackPushBackInput.push (c);\r
}
int
POL::get_inputline (FILE *fp)
{
- lineptr = 0;
- bp = 0;
+ while (! m_stackPushBackInput.empty())\r
+ m_stackPushBackInput.pop();\r
+\r
+ lineptr = 0;\r
if (fgets (inputline, MAXLINE, fp) == NULL)
return (EOF);
else
void
POL::set_inputline (const char* const line)
{
- lineptr = 0;
- bp = 0;
+ while (! m_stackPushBackInput.empty())\r
+ m_stackPushBackInput.pop();\r
+\r
strncpy (inputline, line, MAXLINE);
+ lineptr = 0;\r
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: imagefile.cpp,v 1.24 2000/12/22 04:18:00 kevin Exp $
+** $Id: imagefile.cpp,v 1.25 2000/12/29 15:45:06 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
for (int i = -hx; i <= hx; i++) {
for (int j = -hy; j <= hy; j++) {
- double r = sqrt (i * i + j * j);
+ double r = ::sqrt (i * i + j * j);
v[i+hx][j+hy] = filter.response (r);
}
}
}
- d = sqrt (sqErrorSum / sqDiffFromMeanSum);
+ d = ::sqrt (sqErrorSum / sqDiffFromMeanSum);
r = absErrorSum / absValueSum;
int hx = m_nx / 2;
}\r
\r
\r
+bool\r
+ImageFile::invertPixelValues (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ for (int ix = 0; ix < m_nx; ix++) {\r
+ ImageFileColumnConst in = vLHS[ix];\r
+ ImageFileColumn out = vResult[ix];\r
+ for (int iy = 0; iy < m_ny; iy++)\r
+ *out++ = - *in++;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+ImageFile::sqrt (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ for (int ix = 0; ix < m_nx; ix++) {\r
+ ImageFileColumnConst in = vLHS[ix];\r
+ ImageFileColumn out = vResult[ix];\r
+ for (int iy = 0; iy < m_ny; iy++)\r
+ if (*in < 0)\r
+ *out++ = -::sqrt(-*in++);\r
+ else\r
+ *out++ = ::sqrt(*in++);\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+ImageFile::log (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ for (int ix = 0; ix < m_nx; ix++) {\r
+ ImageFileColumnConst in = vLHS[ix];\r
+ ImageFileColumn out = vResult[ix];\r
+ for (int iy = 0; iy < m_ny; iy++)\r
+ if (*in <= 0)\r
+ *out++ = 0;\r
+ else\r
+ *out++ = ::log(*in++);\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+ImageFile::exp (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ for (int ix = 0; ix < m_nx; ix++) {\r
+ ImageFileColumnConst in = vLHS[ix];\r
+ ImageFileColumn out = vResult[ix];\r
+ for (int iy = 0; iy < m_ny; iy++)\r
+ *out++ = ::exp (*in++);\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+ImageFile::FFTMagnitude (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ int ix, iy;\r
+ double* pY = new double [m_ny];\r
+ std::complex<double>** complexOut = new std::complex<double>* [m_nx];\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOut[ix] = new std::complex<double> [m_ny];\r
+\r
+ for (ix = 0; ix < m_nx; ix++) {\r
+ for (iy = 0; iy < m_ny; iy++)\r
+ pY[iy] = vLHS[ix][iy];\r
+ ProcessSignal::finiteFourierTransform (pY, complexOut[ix], m_ny, ProcessSignal::FORWARD);\r
+ }\r
+ delete pY;\r
+\r
+ std::complex<double>* pX = new std::complex<double> [m_nx];\r
+ std::complex<double>* complexOutCol = new std::complex<double> [m_nx];\r
+ for (iy = 0; iy < m_ny; iy++) {\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ pX[ix] = complexOut[ix][iy];\r
+ ProcessSignal::finiteFourierTransform (pX, complexOutCol, m_nx, ProcessSignal::FORWARD);\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOut[ix][iy] = complexOutCol[ix];\r
+ }\r
+ delete [] pX;\r
+\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ ProcessSignal::shuffleFourierToNaturalOrder (complexOut[ix], m_ny);\r
+\r
+ \r
+ for (iy = 0; iy < m_ny; iy++) {\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOutCol[ix] = complexOut[ix][iy];\r
+ ProcessSignal::shuffleFourierToNaturalOrder (complexOutCol, m_nx);;\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOut[ix][iy] = complexOutCol[ix];\r
+\r
+ }\r
+ delete [] complexOutCol;\r
+\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ for (iy = 0; iy < m_ny; iy++)\r
+ vResult[ix][iy] = std::abs (complexOut[ix][iy]);\r
+\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ delete [] complexOut[ix];\r
+\r
+ delete [] complexOut;\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+ImageFile::FFTPhase (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ int ix, iy;\r
+ double* pY = new double [m_ny];\r
+ std::complex<double>** complexOut = new std::complex<double>* [m_nx];\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOut[ix] = new std::complex<double> [m_ny];\r
+\r
+ for (ix = 0; ix < m_nx; ix++) {\r
+ for (iy = 0; iy < m_ny; iy++)\r
+ pY[iy] = vLHS[ix][iy];\r
+ ProcessSignal::finiteFourierTransform (pY, complexOut[ix], m_ny, ProcessSignal::FORWARD);\r
+ }\r
+ delete pY;\r
+\r
+ std::complex<double>* pX = new std::complex<double> [m_nx];\r
+ std::complex<double>* complexOutCol = new std::complex<double> [m_nx];\r
+ for (iy = 0; iy < m_ny; iy++) {\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ pX[ix] = complexOut[ix][iy];\r
+ ProcessSignal::finiteFourierTransform (pX, complexOutCol, m_nx, ProcessSignal::FORWARD);\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOut[ix][iy] = complexOutCol[ix];\r
+ }\r
+ delete [] pX;\r
+\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ ProcessSignal::shuffleFourierToNaturalOrder (complexOut[ix], m_ny);\r
+\r
+ \r
+ for (iy = 0; iy < m_ny; iy++) {\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOutCol[ix] = complexOut[ix][iy];\r
+ ProcessSignal::shuffleFourierToNaturalOrder (complexOutCol, m_nx);;\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ complexOut[ix][iy] = complexOutCol[ix];\r
+\r
+ }\r
+ delete [] complexOutCol;\r
+\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ for (iy = 0; iy < m_ny; iy++)\r
+ vResult[ix][iy] = atan (complexOut[ix][iy].imag / complexOut[ix][iy].real);\r
+\r
+ for (ix = 0; ix < m_nx; ix++)\r
+ delete [] complexOut[ix];\r
+\r
+ delete [] complexOut;\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+ImageFile::square (ImageFile& result) const\r
+{\r
+ if (m_nx != result.nx() || m_ny != result.ny()) {\r
+ sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+ return false;\r
+ }\r
+\r
+ ImageFileArrayConst vLHS = getArray();\r
+ ImageFileArray vResult = result.getArray();\r
+\r
+ for (int ix = 0; ix < m_nx; ix++) {\r
+ ImageFileColumnConst in = vLHS[ix];\r
+ ImageFileColumn out = vResult[ix];\r
+ for (int iy = 0; iy < m_ny; iy++) {\r
+ *out++ = *in * *in;\r
+ in++;\r
+ }\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+\r
void
ImageFile::writeImagePGM (const char *outfile, int nxcell, int nycell, double densmin, double densmax)
{
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: procsignal.cpp,v 1.10 2000/12/16 06:12:47 kevin Exp $
+** $Id: procsignal.cpp,v 1.11 2000/12/29 15:45:06 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
// ProcessSignal
//
ProcessSignal::ProcessSignal (const char* szFilterName, const char* szFilterMethodName, double dBandwidth, double dSignalIncrement, int nSignalPoints, double dFilterParam, const char* szDomainName, const char* szFilterGenerationName, int iZeropad, int iPreinterpolationFactor, int iTraceLevel, int iGeometry, double dFocalLength, SGP* pSGP)
- : m_adFourierCosTable(NULL), m_adFourierSinTable(NULL), m_adFilter(NULL), m_fail(false)
+: m_adFourierCosTable(NULL), m_adFourierSinTable(NULL), m_adFilter(NULL), m_fail(false)
{
m_idFilterMethod = convertFilterMethodNameToID (szFilterMethodName);
if (m_idFilterMethod == FILTER_METHOD_INVALID) {
m_failMessage += szDomainName;
return;
}
-
+
init (m_idFilter, m_idFilterMethod, dBandwidth, dSignalIncrement, nSignalPoints, dFilterParam, m_idDomain, m_idFilterGeneration, iZeropad, iPreinterpolationFactor, iTraceLevel, iGeometry, dFocalLength, pSGP);
}
m_idFilterGeneration = idFilterGeneration;
m_idGeometry = iGeometry;
m_dFocalLength = dFocalLength;
-
+
if (m_idFilter == SignalFilter::FILTER_INVALID || m_idDomain == SignalFilter::DOMAIN_INVALID || m_idFilterMethod == FILTER_METHOD_INVALID || m_idFilterGeneration == FILTER_GENERATION_INVALID) {
m_fail = true;
return;
m_dFilterParam = dFilterParam;
m_iZeropad = iZeropad;
m_iPreinterpolationFactor = iPreinterpolationFactor;
-
+
// scale signalInc/BW to signalInc/2 to adjust for imaginary detector
// through origin of phantom, see Kak-Slaney Fig 3.22, for Collinear
if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
m_dSignalInc /= 2;
m_dBandwidth *= 2;
}
-
+
if (m_idFilterMethod == FILTER_METHOD_FFT) {
#if HAVE_FFTW
m_idFilterMethod = FILTER_METHOD_RFFTW;
return;
#endif
}
-
+
bool m_bFrequencyFiltering = true;
if (m_idFilterMethod == FILTER_METHOD_CONVOLUTION)
m_bFrequencyFiltering = false;
-
+
// Spatial-based filtering
if (! m_bFrequencyFiltering) {
-
+
if (m_idFilterGeneration == FILTER_GENERATION_DIRECT) {
- m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
- m_dFilterMin = -m_dSignalInc * (m_nSignalPoints - 1);
- m_dFilterMax = m_dSignalInc * (m_nSignalPoints - 1);
- m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
- SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
- m_adFilter = new double[ m_nFilterPoints ];
- filter.copyFilterData (m_adFilter, 0, m_nFilterPoints);
+ m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
+ m_dFilterMin = -m_dSignalInc * (m_nSignalPoints - 1);
+ m_dFilterMax = m_dSignalInc * (m_nSignalPoints - 1);
+ m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
+ SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
+ m_adFilter = new double[ m_nFilterPoints ];
+ filter.copyFilterData (m_adFilter, 0, m_nFilterPoints);
} else if (m_idFilterGeneration == FILTER_GENERATION_INVERSE_FOURIER) {
- m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
- m_dFilterMin = -1. / (2 * m_dSignalInc);
- m_dFilterMax = 1. / (2 * m_dSignalInc);
- m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
- SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY);
- m_adFilter = new double[ m_nFilterPoints ];
- double* adFrequencyFilter = new double [m_nFilterPoints];
- filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints);
+ m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
+ m_dFilterMin = -1. / (2 * m_dSignalInc);
+ m_dFilterMax = 1. / (2 * m_dSignalInc);
+ m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
+ SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY);
+ m_adFilter = new double[ m_nFilterPoints ];
+ double* adFrequencyFilter = new double [m_nFilterPoints];
+ filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints);
#ifdef HAVE_SGP
- EZPlot* pEZPlot = NULL;
- if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot = new EZPlot (*pSGP);
- pEZPlot->ezset ("title Filter Response: Natural Order");
- pEZPlot->ezset ("ylength 0.25");
- pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
- pEZPlot->plot();
- }
+ EZPlot* pEZPlot = NULL;
+ if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
+ pEZPlot = new EZPlot ();
+ pEZPlot->ezset ("title Filter Response: Natural Order");
+ pEZPlot->ezset ("ylength 0.25");
+ pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
+ }
#endif
- shuffleNaturalToFourierOrder (adFrequencyFilter, m_nFilterPoints);
+ shuffleNaturalToFourierOrder (adFrequencyFilter, m_nFilterPoints);
#ifdef HAVE_SGP
- if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot->ezset ("title Filter Response: Fourier Order");
- pEZPlot->ezset ("ylength 0.25");
- pEZPlot->ezset ("yporigin 0.25");
- pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
- pEZPlot->plot();
- }
+ if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
+ pEZPlot->ezset ("title Filter Response: Fourier Order");
+ pEZPlot->ezset ("ylength 0.25");
+ pEZPlot->ezset ("yporigin 0.25");
+ pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
+ }
#endif
- ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, -1);
- delete adFrequencyFilter;\r
+ ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, -1);
+ delete adFrequencyFilter;\r
#ifdef HAVE_SGP
- if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order");
- pEZPlot->ezset ("ylength 0.25");
- pEZPlot->ezset ("yporigin 0.50");
- pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
- pEZPlot->plot();
- }
+ if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
+ pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order");
+ pEZPlot->ezset ("ylength 0.25");
+ pEZPlot->ezset ("yporigin 0.50");
+ pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
+ }
#endif
- shuffleFourierToNaturalOrder (m_adFilter, m_nFilterPoints);
+ shuffleFourierToNaturalOrder (m_adFilter, m_nFilterPoints);
#ifdef HAVE_SGP
- if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot->ezset ("title Inverse Fourier Frequency: Natural Order");
- pEZPlot->ezset ("ylength 0.25");
- pEZPlot->ezset ("yporigin 0.75");
- pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
- pEZPlot->plot();
- delete pEZPlot;
- }
+ if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
+ pEZPlot->ezset ("title Inverse Fourier Frequency: Natural Order");
+ pEZPlot->ezset ("ylength 0.25");
+ pEZPlot->ezset ("yporigin 0.75");
+ pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
+ delete pEZPlot;
+ }
#endif
- for (i = 0; i < m_nFilterPoints; i++) {
- m_adFilter[i] /= m_dSignalInc;
- }
+ for (i = 0; i < m_nFilterPoints; i++) {
+ m_adFilter[i] /= m_dSignalInc;
+ }
}
if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
- for (i = 0; i < m_nFilterPoints; i++)
- m_adFilter[i] *= 0.5;
+ 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);
- double sinScale = sin (iDetFromZero * m_dSignalInc);
- if (fabs(sinScale) < 1E-7)
- sinScale = 1;
- else
- sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
- double dScale = 0.5 * sinScale * sinScale;
- m_adFilter[i] *= dScale;
- }
+ for (i = 0; i < m_nFilterPoints; i++) {
+ int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
+ double sinScale = sin (iDetFromZero * m_dSignalInc);
+ if (fabs(sinScale) < 1E-7)
+ sinScale = 1;
+ else
+ sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
+ double dScale = 0.5 * sinScale * sinScale;
+ m_adFilter[i] *= dScale;
+ }
} // if (geometry)
} // if (spatial filtering)
-
+
else if (m_bFrequencyFiltering) { // Frequency-based filtering
-
+
if (m_idFilterGeneration == FILTER_GENERATION_DIRECT) {
// calculate number of filter points with zeropadding
m_nFilterPoints = m_nSignalPoints;
if (m_iZeropad > 0) {
- double logBase2 = log(m_nFilterPoints) / log(2);
- int nextPowerOf2 = static_cast<int>(floor(logBase2));
- if (logBase2 != floor(logBase2))
- nextPowerOf2++;
- nextPowerOf2 += (m_iZeropad - 1);
- m_nFilterPoints = 1 << nextPowerOf2;
+ double logBase2 = log(m_nFilterPoints) / log(2);
+ int nextPowerOf2 = static_cast<int>(floor(logBase2));
+ if (logBase2 != floor(logBase2))
+ nextPowerOf2++;
+ nextPowerOf2 += (m_iZeropad - 1);
+ m_nFilterPoints = 1 << nextPowerOf2;
#ifdef DEBUG
- if (m_traceLevel >= Trace::TRACE_CONSOLE)
- std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
+ if (m_traceLevel >= Trace::TRACE_CONSOLE)
+ std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
#endif
}
m_nOutputPoints = m_nFilterPoints * m_iPreinterpolationFactor;
-
+
if (m_nFilterPoints % 2) { // Odd
- m_dFilterMin = -1. / (2 * m_dSignalInc);
- m_dFilterMax = 1. / (2 * m_dSignalInc);
- m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
+ m_dFilterMin = -1. / (2 * m_dSignalInc);
+ m_dFilterMax = 1. / (2 * m_dSignalInc);
+ m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
} else { // Even
- m_dFilterMin = -1. / (2 * m_dSignalInc);
- m_dFilterMax = 1. / (2 * m_dSignalInc);
- m_dFilterInc = (m_dFilterMax - m_dFilterMin) / m_nFilterPoints;
- m_dFilterMax -= m_dFilterInc;
+ m_dFilterMin = -1. / (2 * m_dSignalInc);
+ m_dFilterMax = 1. / (2 * m_dSignalInc);
+ m_dFilterInc = (m_dFilterMax - m_dFilterMin) / m_nFilterPoints;
+ m_dFilterMax -= m_dFilterInc;
}
-
+
SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY);
m_adFilter = new double [m_nFilterPoints];
filter.copyFilterData (m_adFilter, 0, m_nFilterPoints);
-
+
// This doesn't work!
// Need to add filtering for divergent geometries & Frequency/Direct filtering
if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
- for (i = 0; i < m_nFilterPoints; i++)
- m_adFilter[i] *= 0.5;
+ 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);
- double sinScale = sin (iDetFromZero * m_dSignalInc);
- if (fabs(sinScale) < 1E-7)
- sinScale = 1;
- else
- sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
- double dScale = 0.5 * sinScale * sinScale;
- m_adFilter[i] *= dScale;
- }
+ for (i = 0; i < m_nFilterPoints; i++) {
+ int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
+ double sinScale = sin (iDetFromZero * m_dSignalInc);
+ if (fabs(sinScale) < 1E-7)
+ sinScale = 1;
+ else
+ sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
+ double dScale = 0.5 * sinScale * sinScale;
+ m_adFilter[i] *= dScale;
+ }
}
#ifdef HAVE_SGP
EZPlot* pEZPlot = NULL;
if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot = new EZPlot (*pSGP);
- pEZPlot->ezset ("title Filter Filter: Natural Order");
- pEZPlot->ezset ("ylength 0.50");
- pEZPlot->ezset ("yporigin 0.00");
- pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
- pEZPlot->plot();
+ pEZPlot = new EZPlot;
+ pEZPlot->ezset ("title Filter Filter: Natural Order");
+ pEZPlot->ezset ("ylength 0.50");
+ pEZPlot->ezset ("yporigin 0.00");
+ pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
}
#endif
shuffleNaturalToFourierOrder (m_adFilter, m_nFilterPoints);
#ifdef HAVE_SGP
if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot->ezset ("title Filter Filter: Fourier Order");
- pEZPlot->ezset ("ylength 0.50");
- pEZPlot->ezset ("yporigin 0.50");
- pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
- pEZPlot->plot();
- delete pEZPlot;
+ pEZPlot->ezset ("title Filter Filter: Fourier Order");
+ pEZPlot->ezset ("ylength 0.50");
+ pEZPlot->ezset ("yporigin 0.50");
+ pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
+ delete pEZPlot;
}
#endif
} else if (m_idFilterGeneration == FILTER_GENERATION_INVERSE_FOURIER) {
m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (nSpatialPoints - 1);
m_nFilterPoints = nSpatialPoints;
if (m_iZeropad > 0) {
- double logBase2 = log(nSpatialPoints) / log(2);
- int nextPowerOf2 = static_cast<int>(floor(logBase2));
- if (logBase2 != floor(logBase2))
- nextPowerOf2++;
- nextPowerOf2 += (m_iZeropad - 1);
- m_nFilterPoints = 1 << nextPowerOf2;
+ double logBase2 = log(nSpatialPoints) / log(2);
+ int nextPowerOf2 = static_cast<int>(floor(logBase2));
+ if (logBase2 != floor(logBase2))
+ nextPowerOf2++;
+ nextPowerOf2 += (m_iZeropad - 1);
+ m_nFilterPoints = 1 << nextPowerOf2;
}
m_nOutputPoints = m_nFilterPoints * m_iPreinterpolationFactor;
#ifdef DEBUG
if (m_traceLevel >= Trace::TRACE_CONSOLE)
- std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
+ std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
#endif
double* adSpatialFilter = new double [m_nFilterPoints];\r
SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, nSpatialPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
#ifdef HAVE_SGP
EZPlot* pEZPlot = NULL;
if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot = new EZPlot (*pSGP);
- pEZPlot->ezset ("title Spatial Filter: Natural Order");
- pEZPlot->ezset ("ylength 0.50");
- pEZPlot->ezset ("yporigin 0.00");
- pEZPlot->addCurve (adSpatialFilter, nSpatialPoints);
- pEZPlot->plot();
- delete pEZPlot;
+ pEZPlot = new EZPlot;
+ pEZPlot->ezset ("title Spatial Filter: Natural Order");
+ pEZPlot->ezset ("ylength 0.50");
+ pEZPlot->ezset ("yporigin 0.00");
+ pEZPlot->addCurve (adSpatialFilter, nSpatialPoints);
+ pEZPlot->plot (pSGP);
+ delete pEZPlot;
}
#endif
if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
- for (i = 0; i < m_nFilterPoints; i++)
- adSpatialFilter[i] *= 0.5;
+ for (i = 0; i < m_nFilterPoints; i++)
+ adSpatialFilter[i] *= 0.5;
} else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) {
- for (i = 0; i < m_nFilterPoints; i++) {
- int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
- double sinScale = sin (iDetFromZero * m_dSignalInc);
- if (fabs(sinScale) < 1E-7)
- sinScale = 1;
- else
- sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
- double dScale = 0.5 * sinScale * sinScale;
- adSpatialFilter[i] *= dScale;
- }
+ for (i = 0; i < m_nFilterPoints; i++) {
+ int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
+ double sinScale = sin (iDetFromZero * m_dSignalInc);
+ if (fabs(sinScale) < 1E-7)
+ sinScale = 1;
+ else
+ sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
+ double dScale = 0.5 * sinScale * sinScale;
+ adSpatialFilter[i] *= dScale;
+ }
}\r
for (i = nSpatialPoints; i < m_nFilterPoints; i++)
- adSpatialFilter[i] = 0;
-
+ adSpatialFilter[i] = 0;
+
m_adFilter = new double [m_nFilterPoints];
std::complex<double>* acInverseFilter = new std::complex<double> [m_nFilterPoints];\r
finiteFourierTransform (adSpatialFilter, acInverseFilter, m_nFilterPoints, 1);
- delete adSpatialFilter;\r
- for (i = 0; i < m_nFilterPoints; i++)
- m_adFilter[i] = std::abs(acInverseFilter[i]) * m_dSignalInc;
- delete acInverseFilter;\r
+ delete adSpatialFilter;\r
+ for (i = 0; i < m_nFilterPoints; i++)
+ m_adFilter[i] = std::abs(acInverseFilter[i]) * m_dSignalInc;
+ delete acInverseFilter;\r
#ifdef HAVE_SGP
if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
- pEZPlot->ezset ("title Spatial Filter: Inverse");
- pEZPlot->ezset ("ylength 0.50");
- pEZPlot->ezset ("yporigin 0.50");
- pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
- pEZPlot->plot();
- delete pEZPlot;\r
+ pEZPlot->ezset ("title Spatial Filter: Inverse");
+ pEZPlot->ezset ("ylength 0.50");
+ pEZPlot->ezset ("yporigin 0.50");
+ pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+ pEZPlot->plot (pSGP);
+ delete pEZPlot;\r
}
#endif
}
angle += angleIncrement;
}
}
-
+
#if HAVE_FFTW
if (m_idFilterMethod == FILTER_METHOD_FFTW || m_idFilterMethod == FILTER_METHOD_RFFTW) {
for (i = 0; i < m_nFilterPoints; i++) //fftw uses unnormalized fft
m_adFilter[i] /= m_nFilterPoints;
}
-
+
if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
m_realPlanForward = rfftw_create_plan (m_nFilterPoints, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE);
m_realPlanBackward = rfftw_create_plan (m_nOutputPoints, FFTW_COMPLEX_TO_REAL, FFTW_ESTIMATE);
ProcessSignal::~ProcessSignal (void)
{
- delete [] m_adFourierSinTable;
- delete [] m_adFourierCosTable;
- delete [] m_adFilter;
-
+ delete [] m_adFourierSinTable;
+ delete [] m_adFourierCosTable;
+ delete [] m_adFilter;
+
#if HAVE_FFTW
- if (m_idFilterMethod == FILTER_METHOD_FFTW) {
- fftw_destroy_plan(m_complexPlanForward);
- fftw_destroy_plan(m_complexPlanBackward);
- delete [] m_adComplexFftInput;
- delete [] m_adComplexFftSignal;
- }
- if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
- rfftw_destroy_plan(m_realPlanForward);
- rfftw_destroy_plan(m_realPlanBackward);
- delete [] m_adRealFftInput;
- delete [] m_adRealFftSignal;
- }
+ if (m_idFilterMethod == FILTER_METHOD_FFTW) {
+ fftw_destroy_plan(m_complexPlanForward);
+ fftw_destroy_plan(m_complexPlanBackward);
+ delete [] m_adComplexFftInput;
+ delete [] m_adComplexFftSignal;
+ }
+ if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
+ rfftw_destroy_plan(m_realPlanForward);
+ rfftw_destroy_plan(m_realPlanBackward);
+ delete [] m_adRealFftInput;
+ delete [] m_adRealFftSignal;
+ }
#endif
}
ProcessSignal::convertFilterMethodNameToID (const char* const filterMethodName)
{
int fmID = FILTER_METHOD_INVALID;
-
+
for (int i = 0; i < s_iFilterMethodCount; i++)
- if (strcasecmp (filterMethodName, s_aszFilterMethodName[i]) == 0) {
+ if (strcasecmp (filterMethodName, s_aszFilterMethodName[i]) == 0) {
fmID = i;
break;
}
-
- return (fmID);
+
+ return (fmID);
}
const char *
ProcessSignal::convertFilterMethodIDToName (const int fmID)
{
static const char *name = "";
-
+
if (fmID >= 0 && fmID < s_iFilterMethodCount)
- return (s_aszFilterMethodName [fmID]);
-
+ return (s_aszFilterMethodName [fmID]);
+
return (name);
}
ProcessSignal::convertFilterMethodIDToTitle (const int fmID)
{
static const char *title = "";
-
+
if (fmID >= 0 && fmID < s_iFilterMethodCount)
- return (s_aszFilterMethodTitle [fmID]);
-
+ return (s_aszFilterMethodTitle [fmID]);
+
return (title);
}
ProcessSignal::convertFilterGenerationNameToID (const char* const fgName)
{
int fgID = FILTER_GENERATION_INVALID;
-
+
for (int i = 0; i < s_iFilterGenerationCount; i++)
- if (strcasecmp (fgName, s_aszFilterGenerationName[i]) == 0) {
+ if (strcasecmp (fgName, s_aszFilterGenerationName[i]) == 0) {
fgID = i;
break;
}
-
- return (fgID);
+
+ return (fgID);
}
const char *
ProcessSignal::convertFilterGenerationIDToName (const int fgID)
{
static const char *name = "";
-
+
if (fgID >= 0 && fgID < s_iFilterGenerationCount)
- return (s_aszFilterGenerationName [fgID]);
-
+ return (s_aszFilterGenerationName [fgID]);
+
return (name);
}
ProcessSignal::convertFilterGenerationIDToTitle (const int fgID)
{
static const char *name = "";
-
+
if (fgID >= 0 && fgID < s_iFilterGenerationCount)
- return (s_aszFilterGenerationTitle [fgID]);
-
+ return (s_aszFilterGenerationTitle [fgID]);
+
return (name);
}
int i;\r
for (i = 0; i < m_nSignalPoints; i++)
input[i] = constInput[i];
-
+
if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
for (int i = 0; i < m_nSignalPoints; i++) {
int iDetFromCenter = i - (m_nSignalPoints / 2);
}
}\r
if (m_idFilterMethod == FILTER_METHOD_CONVOLUTION) {
- for (i = 0; i < m_nSignalPoints; i++)
- output[i] = convolve (input, m_dSignalInc, i, m_nSignalPoints);
+ for (i = 0; i < m_nSignalPoints; i++)
+ output[i] = convolve (input, m_dSignalInc, i, m_nSignalPoints);
} else if (m_idFilterMethod == FILTER_METHOD_FOURIER) {
double* inputSignal = new double [m_nFilterPoints];
for (i = 0; i < m_nSignalPoints; i++)
inputSignal[i] = 0; // zeropad
std::complex<double>* fftSignal = new std::complex<double> [m_nFilterPoints];
finiteFourierTransform (inputSignal, fftSignal, m_nFilterPoints, -1);\r
- delete inputSignal;
+ delete inputSignal;
for (i = 0; i < m_nFilterPoints; i++)
fftSignal[i] *= m_adFilter[i];
double* inverseFourier = new double [m_nFilterPoints];
finiteFourierTransform (fftSignal, inverseFourier, m_nFilterPoints, 1);\r
- delete fftSignal;
+ delete fftSignal;
for (i = 0; i < m_nSignalPoints; i++)
output[i] = inverseFourier[i];\r
- delete inverseFourier;
+ delete inverseFourier;
} else if (m_idFilterMethod == FILTER_METHOD_FOURIER_TABLE) {
double* inputSignal = new double [m_nFilterPoints];
for (i = 0; i < m_nSignalPoints; i++)
inputSignal[i] = 0; // zeropad
std::complex<double>* fftSignal = new std::complex<double> [m_nFilterPoints];
finiteFourierTransform (inputSignal, fftSignal, -1);\r
- delete inputSignal;
+ delete inputSignal;
for (i = 0; i < m_nFilterPoints; i++)
fftSignal[i] *= m_adFilter[i];
double* inverseFourier = new double [m_nFilterPoints];
finiteFourierTransform (fftSignal, inverseFourier, 1);\r
- delete fftSignal;
+ delete fftSignal;
for (i = 0; i < m_nSignalPoints; i++)
output[i] = inverseFourier[i];\r
- delete inverseFourier;
+ delete inverseFourier;
}
#if HAVE_FFTW
else if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
- for (i = 0; i < m_nSignalPoints; i++)
- m_adRealFftInput[i] = input[i];
-
- fftw_real* fftOutput = new fftw_real [ m_nFilterPoints ];
- rfftw_one (m_realPlanForward, m_adRealFftInput, fftOutput);
- for (i = 0; i < m_nFilterPoints; i++)
- m_adRealFftSignal[i] = m_adFilter[i] * fftOutput[i];\r
- delete [] fftOutput;
- for (i = m_nFilterPoints; i < m_nOutputPoints; i++)
+ for (i = 0; i < m_nSignalPoints; i++)
+ m_adRealFftInput[i] = input[i];
+
+ fftw_real* fftOutput = new fftw_real [ m_nFilterPoints ];
+ rfftw_one (m_realPlanForward, m_adRealFftInput, fftOutput);
+ for (i = 0; i < m_nFilterPoints; i++)
+ m_adRealFftSignal[i] = m_adFilter[i] * fftOutput[i];\r
+ delete [] fftOutput;
+ for (i = m_nFilterPoints; i < m_nOutputPoints; i++)
m_adRealFftSignal[i] = 0;
-
- fftw_real* ifftOutput = new fftw_real [ m_nOutputPoints ];
- rfftw_one (m_realPlanBackward, m_adRealFftSignal, ifftOutput);
- for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++)
- output[i] = ifftOutput[i];\r
- delete [] ifftOutput;
+
+ fftw_real* ifftOutput = new fftw_real [ m_nOutputPoints ];
+ rfftw_one (m_realPlanBackward, m_adRealFftSignal, ifftOutput);
+ for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++)
+ output[i] = ifftOutput[i];\r
+ delete [] ifftOutput;
} else if (m_idFilterMethod == FILTER_METHOD_FFTW) {
- for (i = 0; i < m_nSignalPoints; i++)
- m_adComplexFftInput[i].re = input[i];
-
- fftw_complex* fftOutput = new fftw_complex [ m_nFilterPoints ];
- fftw_one (m_complexPlanForward, m_adComplexFftInput, fftOutput);
- for (i = 0; i < m_nFilterPoints; i++) {
- m_adComplexFftSignal[i].re = m_adFilter[i] * fftOutput[i].re;
- m_adComplexFftSignal[i].im = m_adFilter[i] * fftOutput[i].im;
- }\r
- delete [] fftOutput;
- fftw_complex* ifftOutput = new fftw_complex [ m_nOutputPoints ];
- fftw_one (m_complexPlanBackward, m_adComplexFftSignal, ifftOutput);
- for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++)
- output[i] = ifftOutput[i].re;\r
- delete [] ifftOutput;
+ for (i = 0; i < m_nSignalPoints; i++)
+ m_adComplexFftInput[i].re = input[i];
+
+ fftw_complex* fftOutput = new fftw_complex [ m_nFilterPoints ];
+ fftw_one (m_complexPlanForward, m_adComplexFftInput, fftOutput);
+ for (i = 0; i < m_nFilterPoints; i++) {
+ m_adComplexFftSignal[i].re = m_adFilter[i] * fftOutput[i].re;
+ m_adComplexFftSignal[i].im = m_adFilter[i] * fftOutput[i].im;
+ }\r
+ delete [] fftOutput;
+ fftw_complex* ifftOutput = new fftw_complex [ m_nOutputPoints ];
+ fftw_one (m_complexPlanBackward, m_adComplexFftSignal, ifftOutput);
+ for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++)
+ output[i] = ifftOutput[i].re;\r
+ delete [] ifftOutput;
}
#endif\r
delete input;
/* NAME
- * convolve Discrete convolution of two functions
- *
- * SYNOPSIS
- * r = convolve (f1, f2, dx, n, np, func_type)
- * double r Convolved result
- * double f1[], f2[] Functions to be convolved
- * double dx Difference between successive x values
- * int n Array index to center convolution about
- * int np Number of points in f1 array
- * int func_type EVEN or ODD or EVEN_AND_ODD function f2
- *
- * NOTES
- * f1 is the projection data, its indices range from 0 to np - 1.
- * The index for f2, the filter, ranges from -(np-1) to (np-1).
- * There are 3 ways to handle the negative vertices of f2:
- * 1. If we know f2 is an EVEN function, then f2[-n] = f2[n].
- * All filters used in reconstruction are even.
- * 2. If we know f2 is an ODD function, then f2[-n] = -f2[n]
- * 3. If f2 is both ODD AND EVEN, then we must store the value of f2
- * for negative indices. Since f2 must range from -(np-1) to (np-1),
- * if we add (np - 1) to f2's array index, then f2's index will
- * range from 0 to 2 * (np - 1), and the origin, x = 0, will be
- * stored at f2[np-1].
- */
+* convolve Discrete convolution of two functions
+*
+* SYNOPSIS
+* r = convolve (f1, f2, dx, n, np, func_type)
+* double r Convolved result
+* double f1[], f2[] Functions to be convolved
+* double dx Difference between successive x values
+* int n Array index to center convolution about
+* int np Number of points in f1 array
+* int func_type EVEN or ODD or EVEN_AND_ODD function f2
+*
+* NOTES
+* f1 is the projection data, its indices range from 0 to np - 1.
+* The index for f2, the filter, ranges from -(np-1) to (np-1).
+* There are 3 ways to handle the negative vertices of f2:
+* 1. If we know f2 is an EVEN function, then f2[-n] = f2[n].
+* All filters used in reconstruction are even.
+* 2. If we know f2 is an ODD function, then f2[-n] = -f2[n]
+* 3. If f2 is both ODD AND EVEN, then we must store the value of f2
+* for negative indices. Since f2 must range from -(np-1) to (np-1),
+* if we add (np - 1) to f2's array index, then f2's index will
+* range from 0 to 2 * (np - 1), and the origin, x = 0, will be
+* stored at f2[np-1].
+*/
double
ProcessSignal::convolve (const double func[], const double dx, const int n, const int np) const
{
double sum = 0.0;
-
+
#if UNOPTIMIZED_CONVOLUTION
for (int i = 0; i < np; i++)
sum += func[i] * m_adFilter[n - i + (np - 1)];
for (int i = 0; i < np; i++)
sum += *func++ * *f2--;
#endif
-
+
return (sum * dx);
}
ProcessSignal::convolve (const float func[], const double dx, const int n, const int np) const
{
double sum = 0.0;
-
+
#if UNOPTIMIZED_CONVOLUTION
-for (int i = 0; i < np; i++)
- sum += func[i] * m_adFilter[n - i + (np - 1)];
+ for (int i = 0; i < np; i++)
+ sum += func[i] * m_adFilter[n - i + (np - 1)];
#else
-double* f2 = m_adFilter + n + (np - 1);
-for (int i = 0; i < np; i++)
- sum += *func++ * *f2--;
+ double* f2 = m_adFilter + n + (np - 1);
+ for (int i = 0; i < np; i++)
+ sum += *func++ * *f2--;
#endif
-
+
return (sum * dx);
}
void
ProcessSignal::finiteFourierTransform (const double input[], double output[], const int n, int direction)
{
- std::complex<double>* complexOutput = new std::complex<double> [n];
-
- finiteFourierTransform (input, complexOutput, n, direction);
- for (int i = 0; i < n; i++)
- output[i] = complexOutput[i].real();\r
- delete [] complexOutput;
+ std::complex<double>* complexOutput = new std::complex<double> [n];
+
+ finiteFourierTransform (input, complexOutput, n, direction);
+ for (int i = 0; i < n; i++)
+ output[i] = complexOutput[i].real();\r
+ delete [] complexOutput;
}
void
direction = -1;
else
direction = 1;
-
+
double angleIncrement = direction * 2 * PI / n;
for (int i = 0; i < n; i++) {
double sumReal = 0;
direction = -1;
else
direction = 1;
-
+
double angleIncrement = direction * 2 * PI / n;
for (int i = 0; i < n; i++) {
std::complex<double> sum (0,0);
direction = -1;
else
direction = 1;
-
+
double angleIncrement = direction * 2 * PI / n;
for (int i = 0; i < n; i++) {
- double sumReal = 0;
+ double sumReal = 0;
for (int j = 0; j < n; j++) {
double angle = i * j * angleIncrement;
sumReal += input[j].real() * cos(angle) - input[j].imag() * sin(angle);
direction = -1;
else
direction = 1;
-
+
for (int i = 0; i < m_nFilterPoints; i++) {
double sumReal = 0, sumImag = 0;
for (int j = 0; j < m_nFilterPoints; j++) {
int tableIndex = i * j;
if (direction > 0) {
- sumReal += input[j] * m_adFourierCosTable[tableIndex];
- sumImag += input[j] * m_adFourierSinTable[tableIndex];
+ sumReal += input[j] * m_adFourierCosTable[tableIndex];
+ sumImag += input[j] * m_adFourierSinTable[tableIndex];
} else {
- sumReal += input[j] * m_adFourierCosTable[tableIndex];
- sumImag -= input[j] * m_adFourierSinTable[tableIndex];
+ sumReal += input[j] * m_adFourierCosTable[tableIndex];
+ sumImag -= input[j] * m_adFourierSinTable[tableIndex];
}
}
if (direction < 0) {
direction = -1;
else
direction = 1;
-
+
for (int i = 0; i < m_nFilterPoints; i++) {
double sumReal = 0, sumImag = 0;
for (int j = 0; j < m_nFilterPoints; j++) {
int tableIndex = i * j;
if (direction > 0) {
- sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
- - input[j].imag() * m_adFourierSinTable[tableIndex];
- sumImag += input[j].real() * m_adFourierSinTable[tableIndex]
- + input[j].imag() * m_adFourierCosTable[tableIndex];
+ sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
+ - input[j].imag() * m_adFourierSinTable[tableIndex];
+ sumImag += input[j].real() * m_adFourierSinTable[tableIndex]
+ + input[j].imag() * m_adFourierCosTable[tableIndex];
} else {
- sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
- - input[j].imag() * -m_adFourierSinTable[tableIndex];
- sumImag += input[j].real() * -m_adFourierSinTable[tableIndex]
- + input[j].imag() * m_adFourierCosTable[tableIndex];
+ sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
+ - input[j].imag() * -m_adFourierSinTable[tableIndex];
+ sumImag += input[j].real() * -m_adFourierSinTable[tableIndex]
+ + input[j].imag() * m_adFourierCosTable[tableIndex];
}
}
if (direction < 0) {
direction = -1;
else
direction = 1;
-
+
for (int i = 0; i < m_nFilterPoints; i++) {
- double sumReal = 0;
+ double sumReal = 0;
for (int j = 0; j < m_nFilterPoints; j++) {
int tableIndex = i * j;
if (direction > 0) {
- sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
- - input[j].imag() * m_adFourierSinTable[tableIndex];
+ sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
+ - input[j].imag() * m_adFourierSinTable[tableIndex];
} else {
- sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
- - input[j].imag() * -m_adFourierSinTable[tableIndex];
+ sumReal += input[j].real() * m_adFourierCosTable[tableIndex]
+ - input[j].imag() * -m_adFourierSinTable[tableIndex];
}
}
if (direction < 0) {
// Natural Frequency Order: -n/2...-1,0,1...((n/2)-1)
// Fourier Frequency Order: 0,1...((n/2)-1),-n/2...-1
-void
-ProcessSignal::shuffleNaturalToFourierOrder (double* pdVector, const int n)
-{
+void\r
+ProcessSignal::shuffleNaturalToFourierOrder (double* pdVector, const int n)\r
+{\r
double* pdTemp = new double [n];\r
- int i;
- if (n % 2) { // Odd
- int iHalfN = (n - 1) / 2;
-
- pdTemp[0] = pdVector[iHalfN];
- for (i = 0; i < iHalfN; i++)
- pdTemp[i + 1] = pdVector[i + 1 + iHalfN];
- for (i = 0; i < iHalfN; i++)
- pdTemp[i + iHalfN + 1] = pdVector[i];
- } else { // Even
- int iHalfN = n / 2;
- pdTemp[0] = pdVector[iHalfN];
- for (i = 0; i < iHalfN; i++)
- pdTemp[i + 1] = pdVector[i + iHalfN];
- for (i = 0; i < iHalfN - 1; i++)
- pdTemp[i + iHalfN + 1] = pdVector[i];
- }
-
- for (i = 0; i < n; i++)
- pdVector[i] = pdTemp[i];
- delete pdTemp;
-}
-
-
-void
-ProcessSignal::shuffleFourierToNaturalOrder (double* pdVector, const int n)
-{
+ int i;\r
+ if (n % 2) { // Odd\r
+ int iHalfN = (n - 1) / 2;\r
+ \r
+ pdTemp[0] = pdVector[iHalfN];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + 1] = pdVector[i + 1 + iHalfN];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + iHalfN + 1] = pdVector[i];\r
+ } else { // Even\r
+ int iHalfN = n / 2;\r
+ pdTemp[0] = pdVector[iHalfN];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + 1] = pdVector[i + iHalfN];\r
+ for (i = 0; i < iHalfN - 1; i++)\r
+ pdTemp[i + iHalfN + 1] = pdVector[i];\r
+ }\r
+ \r
+ for (i = 0; i < n; i++)\r
+ pdVector[i] = pdTemp[i];\r
+ delete pdTemp;\r
+}\r
+\r
+void\r
+ProcessSignal::shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n)\r
+{\r
+ std::complex<double>* pdTemp = new std::complex<double> [n];\r
+ int i;\r
+ if (n % 2) { // Odd\r
+ int iHalfN = (n - 1) / 2;\r
+ \r
+ pdTemp[0] = pdVector[iHalfN];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + 1] = pdVector[i + 1 + iHalfN];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + iHalfN + 1] = pdVector[i];\r
+ } else { // Even\r
+ int iHalfN = n / 2;\r
+ pdTemp[0] = pdVector[iHalfN];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + 1] = pdVector[i + iHalfN];\r
+ for (i = 0; i < iHalfN - 1; i++)\r
+ pdTemp[i + iHalfN + 1] = pdVector[i];\r
+ }\r
+ \r
+ for (i = 0; i < n; i++)\r
+ pdVector[i] = pdTemp[i];\r
+ delete [] pdTemp;\r
+}\r
+\r
+
+void\r
+ProcessSignal::shuffleFourierToNaturalOrder (double* pdVector, const int n)\r
+{\r
double* pdTemp = new double [n];\r
- int i;
- if (n % 2) { // Odd
- int iHalfN = (n - 1) / 2;
-
+ int i;\r
+ if (n % 2) { // Odd\r
+ int iHalfN = (n - 1) / 2;\r
+ \r
pdTemp[iHalfN] = pdVector[0];\r
- for (i = 0; i < iHalfN; i++)
- pdTemp[i + 1 + iHalfN] = pdVector[i + 1];
- for (i = 0; i < iHalfN; i++)
- pdTemp[i] = pdVector[i + iHalfN + 1];
- } else { // Even
- int iHalfN = n / 2;
- pdTemp[iHalfN] = pdVector[0];
- for (i = 0; i < iHalfN; i++)
- pdTemp[i] = pdVector[i + iHalfN];
- for (i = 0; i < iHalfN - 1; i++)
- pdTemp[i + iHalfN + 1] = pdVector[i+1];
- }
-
- for (i = 0; i < n; i++)
- pdVector[i] = pdTemp[i];
- delete pdTemp;
-}
-
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + 1 + iHalfN] = pdVector[i + 1];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i] = pdVector[i + iHalfN + 1];\r
+ } else { // Even\r
+ int iHalfN = n / 2;\r
+ pdTemp[iHalfN] = pdVector[0];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i] = pdVector[i + iHalfN];\r
+ for (i = 0; i < iHalfN - 1; i++)\r
+ pdTemp[i + iHalfN + 1] = pdVector[i+1];\r
+ }\r
+ \r
+ for (i = 0; i < n; i++)\r
+ pdVector[i] = pdTemp[i];\r
+ delete pdTemp;\r
+}\r
+\r
+void\r
+ProcessSignal::shuffleFourierToNaturalOrder (std::complex<double>* pdVector, const int n)\r
+{\r
+ std::complex<double>* pdTemp = new std::complex<double> [n];\r
+ int i;\r
+ if (n % 2) { // Odd\r
+ int iHalfN = (n - 1) / 2;\r
+ \r
+ pdTemp[iHalfN] = pdVector[0];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i + 1 + iHalfN] = pdVector[i + 1];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i] = pdVector[i + iHalfN + 1];\r
+ } else { // Even\r
+ int iHalfN = n / 2;\r
+ pdTemp[iHalfN] = pdVector[0];\r
+ for (i = 0; i < iHalfN; i++)\r
+ pdTemp[i] = pdVector[i + iHalfN];\r
+ for (i = 0; i < iHalfN - 1; i++)\r
+ pdTemp[i + iHalfN + 1] = pdVector[i+1];\r
+ }\r
+ \r
+ for (i = 0; i < n; i++)\r
+ pdVector[i] = pdTemp[i];\r
+ delete [] pdTemp;\r
+}\r
+\r
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: reconstruct.cpp,v 1.5 2000/12/17 22:30:34 kevin Exp $
+** $Id: reconstruct.cpp,v 1.6 2000/12/29 15:45:06 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
adPlotXAxis[i] = f;
if (m_pProcessSignal->getFilter()) {
- EZPlot ezplot (*pSGP);
+ EZPlot ezplot;
ezplot.ezset ("title Filter Response");
ezplot.addCurve (adPlotXAxis, m_pProcessSignal->getFilter(), nVecFilter);
- ezplot.plot();
+ ezplot.plot (pSGP);
}
}\r
delete adPlotXAxis;
#ifdef HAVE_SGP
if (m_iTrace >= Trace::TRACE_PLOT && pSGP) {
- EZPlot ezplotProj (*pSGP);
+ EZPlot ezplotProj;
ezplotProj.ezset ("clear");
ezplotProj.ezset ("title Raw Projection");
ezplotProj.ezset ("box.");
ezplotProj.ezset ("grid.");
ezplotProj.addCurve (m_adPlotXAxis, detval, m_rProj.nDet());
- ezplotProj.plot();
+ ezplotProj.plot (pSGP);
ezplotProj.ezset ("clear");
ezplotProj.ezset ("title Filtered Projection");
ezplotProj.ezset ("xticks major 5");
ezplotProj.ezset ("box");
ezplotProj.ezset ("grid");
ezplotProj.addCurve (m_adPlotXAxis, adFilteredProj, m_nFilteredProjections);
- ezplotProj.plot();
+ ezplotProj.plot (pSGP);
}
#endif //HAVE_SGP
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: syserror.cpp,v 1.9 2000/12/27 20:09:19 kevin Exp $
+** $Id: syserror.cpp,v 1.10 2000/12/29 15:45:06 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
#include <exception>
#include <stdexcept>
#include <stdarg.h>
-#include <ctype.h>
-#include "ctsupport.h"
+#include <ctype.h>\r
+#include <string>
+#include "ct.h"
/* NAME
- * sys_error System error handler
- *
- * SYNOPSIS
- * sys_error (severity, msg, args . . .)
- * int severity Severity of error
- * char *msg Error message
- * args Argument list, direct transfer to printf stack
- * Can take 24 byte transfer
- */
-
-static int errorlevel = ERR_WARNING; /* Set error reporting level */
-
+* sys_error System error handler
+*
+* SYNOPSIS
+* sys_error (severity, msg, args . . .)
+* int severity Severity of error
+* char *msg Error message
+* args Argument list, direct transfer to printf stack
+* Can take 24 byte transfer
+*/
+
+static int s_reportErrorLevel = ERR_WARNING; // Set error reporting level
+\r
+bool g_bRunningWXWindows = false;
void sys_error (int severity, const char *msg, ...)
{
va_list arg;
-
+
va_start(arg, msg);
-
- sys_verror (severity, msg, arg);
+ \r
+ std::string strOutput;
+ sys_verror (strOutput, severity, msg, arg);
+ \r
+// if (g_bRunningWXWindows)\r
+// theApp->getLog() << strOutput.c_str();\r
+// else\r
+ std::cout << strOutput;\r
va_end(arg);
}
-static int nErrorCount = 0;
+static int s_nErrorCount = 0;
const static int MAX_ERROR_COUNT = 20;
-void sys_verror (int severity, const char *msg, va_list arg)
+void sys_verror (std::string& strOutput, int severity, const char *msg, va_list arg)
{
- if (severity < errorlevel)
- return; // ignore error if less than max level
+ if (severity < s_reportErrorLevel)
+ return; // ignore error if less than reporting level
+
+ std::ostringstream os;\r
- nErrorCount++;
+ s_nErrorCount++;\r
if (severity != ERR_FATAL) {
- if (nErrorCount > MAX_ERROR_COUNT)
+ if (s_nErrorCount > MAX_ERROR_COUNT)
return;
- else if (nErrorCount == MAX_ERROR_COUNT) {
- std::cout << "*****************************************************************\n";
- std::cout << "*** M A X I M U M E R R O R C O U N T R E A C H E D ***\n";
- std::cout << "*** ***\n";
- std::cout << "*** No further errors will be reported ***\n";
- std::cout << "*****************************************************************\n";
+ else if (s_nErrorCount == MAX_ERROR_COUNT) {
+ os << "*****************************************************************\n";
+ os << "*** M A X I M U M E R R O R C O U N T R E A C H E D ***\n";
+ os << "*** ***\n";
+ os << "*** No further errors will be reported ***\n";
+ os << "*****************************************************************\n";\r
+ strOutput = os.str();
return;
}
}
-
+
switch (severity) {
case ERR_FATAL:
- std::cout << "FATAL ERROR: ";
+ os << "FATAL ERROR: ";
break;
case ERR_SEVERE:
- std::cout << "SEVERE ERROR: ";
+ os << "SEVERE ERROR: ";
break;
case ERR_WARNING:
- std::cout << "WARNING ERROR: ";
+ os << "WARNING ERROR: ";
break;\r
case ERR_TRACE:\r
- std::cout << "Trace: ";\r
+ os << "Trace: ";\r
break;
default:
- std::cout << "Illegal error code #" << severity << ": ";
+ os << "Illegal error severity #" << severity << ": ";
}
- char errStr[512];\r
+ char errStr[2000];\r
#if HAVE_VSNPRINTF
vsnprintf (errStr, sizeof(errStr), msg, arg);
#else\r
strncpy (errStr, sizeof(errStr), "Error message not available on this platform.");
#endif
-
- std::cout << errStr << std::endl;
+
+ os << errStr << std::endl;
+ strOutput = os.str();\r
if (severity == ERR_FATAL)
- throw std::runtime_error (errStr);
+ throw std::runtime_error (errStr);
#if INTERACTIVE_ERROR_DISPLAY
std::cout << "A - Abort C - Continue W - Turn off warnings? ";
// fflush(stderr);
do
- {
- int c = cio_kb_waitc("AaBbCcWw", TRUE); /* get code from keyboard */
- c = tolower (c);
- fputc (c, stderr);
- fputc (NEWLINE, stderr);
-
- if (c == 'a')
- exit (1);
- else if (c == 'c')
- return;
- else if (c == 'w')
- {
- sys_error_level (ERR_SEVERE); /* report severe & fatal errors */
- break;
- }
- } while (TRUE);
+ {
+ int c = cio_kb_waitc("AaBbCcWw", TRUE); /* get code from keyboard */
+ c = tolower (c);
+ fputc (c, stderr);
+ fputc (NEWLINE, stderr);
+
+ if (c == 'a')
+ exit (1);
+ else if (c == 'c')
+ return;
+ else if (c == 'w')
+ {
+ sys_error_level (ERR_SEVERE); /* report severe & fatal errors */
+ break;
+ }
+ } while (TRUE);
#endif
}
/* NAME
- * sys_error_level Set error reporting level
- *
- * SYNOPSIS
- * sys_error_level (severity)
- * int severity Report all error as serious as severity and beyond
- *
- * DESCRIPTION
- * Causes the system to ignore all error below the level of severity
- * For example, if severity == ERR_SEVERE, then report severe & fatal
- * error and ignore warnings
- */
+* sys_error_level Set error reporting level
+*
+* SYNOPSIS
+* sys_error_level (severity)
+* int severity Report all error as serious as severity and beyond
+*
+* DESCRIPTION
+* Causes the system to ignore all error below the level of severity
+* For example, if severity == ERR_SEVERE, then report severe & fatal
+* error and ignore warnings
+*/
void
sys_error_level (int severity)
{
if (severity == ERR_FATAL ||
- severity == ERR_SEVERE ||
- severity == ERR_WARNING)
- errorlevel = severity;
+ severity == ERR_SEVERE ||
+ severity == ERR_WARNING ||\r
+ severity == ERR_TRACE)
+ s_reportErrorLevel = severity;
else
- errorlevel = ERR_WARNING;
+ s_reportErrorLevel = ERR_WARNING;
}
--------------------Configuration: libctsim - Win32 Debug--------------------\r
</h3>\r
<h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7B.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP34.tmp" with contents\r
[\r
/nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
-"C:\ctsim-2.0.6\libctgraphics\pol.cpp"\r
+"C:\ctsim-2.0.6\libctsim\imagefile.cpp"\r
]\r
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7B.tmp" \r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp" with contents\r
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP34.tmp" \r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP35.tmp" with contents\r
[\r
/nologo /out:"Debug\libctsim.lib" \r
".\Debug\array2dfile.obj"\r
".\Debug\fnetorderstream.obj"\r
".\Debug\getopt.obj"\r
".\Debug\getopt1.obj"\r
+".\Debug\hashtable.obj"\r
".\Debug\imagefile.obj"\r
".\Debug\mathfuncs.obj"\r
".\Debug\phantom.obj"\r
".\Debug\trace.obj"\r
".\Debug\transformmatrix.obj"\r
".\Debug\xform.obj"\r
-".\Debug\hashtable.obj"\r
]\r
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp"\r
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP35.tmp"\r
<h3>Output Window</h3>\r
Compiling...\r
-pol.cpp\r
+imagefile.cpp\r
Creating library...\r
<h3>\r
--------------------Configuration: ctsim - Win32 Debug--------------------\r
</h3>\r
<h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7D.tmp" with contents\r
-[\r
-/nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"2.5.0\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
-"C:\ctsim-2.0.6\src\ctsim.cpp"\r
-]\r
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7D.tmp" \r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7E.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP36.tmp" with contents\r
[\r
comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" \r
".\Debug\ctsim.obj"\r
"\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"\r
"\wx2\lib\wxd.lib"\r
]\r
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7E.tmp"\r
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP36.tmp"\r
<h3>Output Window</h3>\r
-Compiling...\r
-ctsim.cpp\r
Linking...\r
-Creating command line "bscmake.exe /nologo /o"Debug/ctsim.bsc" ".\Debug\ctsim.sbr" ".\Debug\dialogs.sbr" ".\Debug\dlgprojections.sbr" ".\Debug\dlgreconstruct.sbr" ".\Debug\docs.sbr" ".\Debug\views.sbr""\r
-Creating browse info file...\r
-<h3>Output Window</h3>\r
\r
\r
\r
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ctsim.h,v 1.13 2000/12/25 21:54:26 kevin Exp $
+** $Id: ctsim.h,v 1.14 2000/12/29 15:45:06 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
IFMENU_COMPARE_IMAGES,\r
IFMENU_COMPARE_ROW,\r
IFMENU_COMPARE_COL,\r
+ IFMENU_PROCESS_INVERTVALUES,\r
+ IFMENU_PROCESS_SQRT,\r
+ IFMENU_PROCESS_SQUARE,\r
+ IFMENU_PROCESS_LOG,\r
+ IFMENU_PROCESS_EXP,\r
+ IFMENU_PROCESS_FFT_MAGNITUDE,\r
+ IFMENU_PROCESS_FFT_PHASE,\r
PHMMENU_PROCESS_RASTERIZE,
PHMMENU_PROCESS_PROJECTIONS,\r
PLOTMENU_VIEW_SCALE_MINMAX,\r
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: dlgprojections.cpp,v 1.13 2000/12/18 12:29:41 kevin Exp $
+** $Id: dlgprojections.cpp,v 1.14 2000/12/29 15:45:06 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
double* detPos = new double [detArray.nDet()];
for (int i = 0; i < detArray.nDet(); i++)
detPos[i] = i;
- EZPlot ezplot (*m_pSGP);
- ezplot.ezset("grid");
- ezplot.ezset("box");\r
- ezplot.ezset("yticks left");
+ EZPlot ezplot;
+ ezplot.ezset ("grid");
+ ezplot.ezset ("box");\r
+ ezplot.ezset ("yticks left");
ezplot.addCurve (detValues, detPos, detArray.nDet());\r
m_pSGP->setViewport (0.67, 0.1, 1., 1.);
- ezplot.plot();\r
+ ezplot.plot (m_pSGP);\r
delete detPos;
}
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: docs.cpp,v 1.8 2000/12/27 03:16:02 kevin Exp $
+** $Id: docs.cpp,v 1.9 2000/12/29 15:45:06 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
}
Modify(false);
UpdateAllViews();\r
- ImageFileView* ifView = dynamic_cast<ImageFileView*>(GetFirstView());\r
- if (ifView)\r
- ifView->OnUpdate(ifView, NULL);\r
+ GetFirstView()->OnUpdate (GetFirstView(), NULL);\r
return true;
}
SetFilename(filename, true);
}
Modify(false);
- UpdateAllViews();
+ UpdateAllViews();\r
+
return true;
}
}
m_idPhantom = m_phantom.id();
Modify(false);
- UpdateAllViews();
+ UpdateAllViews();\r
+
return true;
}
return false;
}
*theApp->getLog() << "Read plot file " << filename << "\n";
- SetFilename(filename, true);\r
+ SetFilename (filename, true);\r
m_namePlot = filename.c_str();
}
- Modify(false);
+ Modify (false);
UpdateAllViews();\r
- PlotFileView* ifView = dynamic_cast<PlotFileView*>(GetFirstView());\r
- if (ifView)\r
- ifView->OnUpdate(ifView, NULL);\r
return true;
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.39 2000/12/27 03:16:02 kevin Exp $
+** $Id: views.cpp,v 1.40 2000/12/29 15:45:06 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
EVT_MENU(IFMENU_COMPARE_IMAGES, ImageFileView::OnCompare)\r
EVT_MENU(IFMENU_COMPARE_ROW, ImageFileView::OnCompareRow)\r
EVT_MENU(IFMENU_COMPARE_COL, ImageFileView::OnCompareCol)\r
+EVT_MENU(IFMENU_PROCESS_INVERTVALUES, ImageFileView::OnInvertValues)\r
+EVT_MENU(IFMENU_PROCESS_SQUARE, ImageFileView::OnSquare)\r
+EVT_MENU(IFMENU_PROCESS_SQRT, ImageFileView::OnSquareRoot)\r
+EVT_MENU(IFMENU_PROCESS_LOG, ImageFileView::OnLog)\r
+EVT_MENU(IFMENU_PROCESS_EXP, ImageFileView::OnExp)\r
+EVT_MENU(IFMENU_PROCESS_FFT_MAGNITUDE, ImageFileView::OnFFTMagnitude)\r
+EVT_MENU(IFMENU_PROCESS_FFT_PHASE, ImageFileView::OnFFTPhase)\r
EVT_MENU(IFMENU_PLOT_ROW, ImageFileView::OnPlotRow)\r
EVT_MENU(IFMENU_PLOT_COL, ImageFileView::OnPlotCol)\r
END_EVENT_TABLE()
{\r
std::vector<ImageFileDocument*> vecIF;\r
theApp->getCompatibleImages (GetDocument(), vecIF);\r
-\r
+ \r
if (vecIF.size() == 0) {\r
wxMessageBox("There are no compatible image files open for comparision", "No comparison images");\r
} else {\r
DialogGetComparisonImage dialogGetCompare(m_frame, "Get Comparison Image", vecIF, true);\r
-\r
+ \r
if (dialogGetCompare.ShowModal() == wxID_OK) {\r
- ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();\r
const ImageFile& rIF = GetDocument()->getImageFile();\r
+ ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();\r
const ImageFile& rCompareIF = pCompareDoc->getImageFile();\r
std::ostringstream os;\r
double min, max, mean, mode, median, stddev;\r
return;\r
}\r
ImageFile& differenceImage = pDifferenceDoc->getImageFile();\r
- \r
+ \r
differenceImage.setArraySize (rIF.nx(), rIF.ny());\r
if (! rIF.subtractImages (rCompareIF, differenceImage)) {\r
pDifferenceDoc->DeleteAllViews();\r
return;\r
}\r
-\r
+ \r
if (theApp->getSetModifyNewDocs())\r
pDifferenceDoc->Modify(true);\r
pDifferenceDoc->UpdateAllViews(this);\r
}\r
}
+void\r
+ImageFileView::OnInvertValues (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.invertPixelValues (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnSquare (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.square (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnSquareRoot (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.sqrt (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnLog (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.log (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnExp (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.exp (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnFFTMagnitude (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.FFTMagnitude (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnFFTPhase (wxCommandEvent& event)\r
+{\r
+ ImageFile& rIF = GetDocument()->getImageFile();\r
+ rIF.FFTPhase (rIF);\r
+ if (theApp->getSetModifyNewDocs())\r
+ GetDocument()->Modify(TRUE);\r
+ GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+\r
ImageFileCanvas*
ImageFileView::CreateCanvas (wxView *view, wxFrame *parent)
{
view_menu->Append(IFMENU_VIEW_SCALE_MINMAX, "Display Scale &Set...");
view_menu->Append(IFMENU_VIEW_SCALE_AUTO, "Display Scale &Auto...");
\r
+ wxMenu* process_menu = new wxMenu;\r
+ process_menu->Append (IFMENU_PROCESS_INVERTVALUES, "&Invert Values");\r
+ process_menu->Append (IFMENU_PROCESS_SQUARE, "&Square");\r
+ process_menu->Append (IFMENU_PROCESS_SQRT, "Square &Root");\r
+ process_menu->Append (IFMENU_PROCESS_LOG, "&Log");\r
+ process_menu->Append (IFMENU_PROCESS_EXP, "&Exp");\r
+ process_menu->Append (IFMENU_PROCESS_FFT_MAGNITUDE, "&FFT Magnitude");\r
+ process_menu->Append (IFMENU_PROCESS_FFT_PHASE, "FFT &Phase");\r
+\r
wxMenu *plot_menu = new wxMenu;\r
plot_menu->Append (IFMENU_PLOT_ROW, "Plot &Row");\r
plot_menu->Append (IFMENU_PLOT_COL, "Plot &Column");\r
compare_menu->Append (IFMENU_COMPARE_IMAGES, "Compare &Images...");\r
compare_menu->Append (IFMENU_COMPARE_ROW, "Compare &Row");\r
compare_menu->Append (IFMENU_COMPARE_COL, "Compare &Column");\r
-\r
+ \r
wxMenu *help_menu = new wxMenu;
help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
menu_bar->Append(file_menu, "&File");
menu_bar->Append(view_menu, "&View");\r
- menu_bar->Append(plot_menu, "&Plot");\r
+ menu_bar->Append(process_menu, "&Process");\r
+ menu_bar->Append(plot_menu, "P&lot");\r
menu_bar->Append(compare_menu, "&Compare");
menu_bar->Append(help_menu, "&Help");
delete pX;\r
delete pY;\r
if (theApp->getSetModifyNewDocs())\r
- pPlotDoc->Modify(true);\r
+ pPlotDoc->Modify(true);\r
+ pPlotDoc->UpdateAllViews();\r
}\r
- \r
}\r
void\r
delete pY;\r
if (theApp->getSetModifyNewDocs())\r
pPlotDoc->Modify(true);\r
+ pPlotDoc->UpdateAllViews();\r
}\r
}\r
\r
delete pY2;\r
if (theApp->getSetModifyNewDocs())\r
pPlotDoc->Modify(true);\r
+ pPlotDoc->UpdateAllViews();\r
}\r
}\r
}\r
wxMessageBox ("No compatible images for Row Comparison", "Error");\r
return;\r
}\r
-\r
+ \r
DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);\r
\r
if (dialogGetCompare.ShowModal() == wxID_OK) {\r
delete pY2;\r
if (theApp->getSetModifyNewDocs())\r
pPlotDoc->Modify(true);\r
+ pPlotDoc->UpdateAllViews();\r
}\r
}\r
}\r
END_EVENT_TABLE()
PlotFileView::PlotFileView(void)
-: wxView(), m_canvas(NULL), m_frame(NULL)
+: wxView(), m_canvas(NULL), m_frame(NULL), m_pEZPlot(NULL)
{
}
PlotFileView::~PlotFileView(void)
-{
+{\r
+ if (m_pEZPlot)\r
+ delete m_pEZPlot;
}
void
bool
-PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
+PlotFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
{
m_frame = CreateChildFrame(doc, this);
SetFrame(m_frame);
m_frame->Show(true);
Activate(true);
-
+
return true;
}
m_canvas->GetClientSize (&xsize, &ysize);\r
SGPDriver driver (dc, xsize, ysize);\r
SGP sgp (driver);\r
- EZPlot plot (sgp);\r
-\r
- for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)\r
- plot.ezset (rPlotFile.getEzsetCommand (iEzset));\r
-\r
- if (m_bMinSpecified) {\r
- std::ostringstream os;\r
- os << "ymin " << m_dMinPixel;\r
- plot.ezset (os.str());\r
- }\r
- \r
- if (m_bMaxSpecified) {\r
- std::ostringstream os;\r
- os << "ymax " << m_dMaxPixel;\r
- plot.ezset (os.str());\r
- }\r
- \r
- plot.ezset("box");\r
- plot.ezset("grid");\r
- \r
- double* pdXaxis = new double [iNRecords];\r
- rPlotFile.getColumn (0, pdXaxis);\r
- \r
- double* pdY = new double [iNRecords];\r
- for (int iCol = 1; iCol < iNColumns; iCol++) {\r
- rPlotFile.getColumn (iCol, pdY);\r
- plot.addCurve (pdXaxis, pdY, iNRecords);\r
- }\r
- \r
- delete pdXaxis;\r
- delete pdY;\r
- \r
- plot.plot();\r
+ if (m_pEZPlot)\r
+ m_pEZPlot->plot (&sgp);\r
}\r
}
void
-PlotFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
+PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
{
- if (m_canvas)
- m_canvas->Refresh();
+ if (m_canvas) {
+ const PlotFile& rPlotFile = GetDocument()->getPlotFile();\r
+ const int iNColumns = rPlotFile.getNumColumns();\r
+ const int iNRecords = rPlotFile.getNumRecords();\r
+ \r
+ if (iNColumns > 0 && iNRecords > 0) {\r
+ if (m_pEZPlot)\r
+ delete m_pEZPlot;\r
+ m_pEZPlot = new EZPlot;\r
+ \r
+ for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)\r
+ m_pEZPlot->ezset (rPlotFile.getEzsetCommand (iEzset));\r
+ \r
+ if (m_bMinSpecified) {\r
+ std::ostringstream os;\r
+ os << "ymin " << m_dMinPixel;\r
+ m_pEZPlot->ezset (os.str());\r
+ }\r
+ \r
+ if (m_bMaxSpecified) {\r
+ std::ostringstream os;\r
+ os << "ymax " << m_dMaxPixel;\r
+ m_pEZPlot->ezset (os.str());\r
+ }\r
+ \r
+ m_pEZPlot->ezset("box");\r
+ m_pEZPlot->ezset("grid");\r
+ \r
+ double* pdXaxis = new double [iNRecords];\r
+ rPlotFile.getColumn (0, pdXaxis);\r
+ \r
+ double* pdY = new double [iNRecords];\r
+ for (int iCol = 1; iCol < iNColumns; iCol++) {\r
+ rPlotFile.getColumn (iCol, pdY);\r
+ m_pEZPlot->addCurve (pdXaxis, pdY, iNRecords);\r
+ }\r
+ \r
+ delete pdXaxis;\r
+ delete pdY;\r
+ }\r
+ \r
+ m_canvas->Refresh();\r
+ }
}
bool
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.h,v 1.16 2000/12/22 04:18:00 kevin Exp $
+** $Id: views.h,v 1.17 2000/12/29 15:45:06 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 OnClose (bool deleteWindow = true);
void OnProperties (wxCommandEvent& event);
void OnCompare (wxCommandEvent& event);\r
+ void OnInvertValues (wxCommandEvent& event);\r
+ void OnSquare (wxCommandEvent& event);\r
+ void OnSquareRoot (wxCommandEvent& event);\r
+ void OnLog (wxCommandEvent& event);\r
+ void OnExp (wxCommandEvent& event);\r
+ void OnFFTMagnitude (wxCommandEvent& event);\r
+ void OnFFTPhase (wxCommandEvent& event);\r
void OnScaleAuto (wxCommandEvent& event);
void OnScaleMinMax (wxCommandEvent& event);
void OnPlotRow (wxCommandEvent& event);\r
PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
+ EZPlot* m_pEZPlot;\r
PlotFileCanvas *m_canvas;
wxFrame *m_frame;
bool m_bMinSpecified;\r
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: if1.cpp,v 1.2 2000/12/23 18:12:35 kevin Exp $
+** $Id: if1.cpp,v 1.3 2000/12/29 15:45:06 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
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: if1.cpp,v 1.2 2000/12/23 18:12:35 kevin Exp $";
+static const char* g_szIdStr = "$Id: if1.cpp,v 1.3 2000/12/29 15:45:06 kevin Exp $";
void
if1_usage (const char *program)
int
if1_main (int argc, char *const argv[])
{
- ImageFile *im_in;
- ImageFile *im_out;
char *in_file;
char *out_file;
int opt_verbose = 0;
in_file = argv[optind];
out_file = argv[optind + 1];
-
std::string histString;
if (opt_invert || opt_log || opt_exp || opt_sqr || opt_sqrt) {
- int ix, iy;
-
- im_in = new ImageFile ();
- im_in->fileRead (in_file);
- int nx = im_in->nx();
- int ny = im_in->ny();
- im_out = new ImageFile (nx, ny);
-
- ImageFileArray vIn = im_in->getArray();
- ImageFileArray vOut = im_out->getArray();
-
- if (opt_invert) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = - vIn[ix][iy];
+ ImageFile im_in;
+ im_in.fileRead (in_file);
+ int nx = im_in.nx();
+ int ny = im_in.ny();
+ ImageFile im_out (nx, ny);
+
+ if (opt_invert) {\r
+ im_in.invertPixelValues (im_out);
histString = "Invert transformation";
}
- if (opt_log) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)\r
- if (vIn[ix][iy] < 0)\r
- vOut[ix][iy] = 0;
- else\r
- vOut[ix][iy] = log (vIn[ix][iy]);
+ if (opt_log) {\r
+ im_in.log (im_out);
histString = "Logrithmic transformation";
}
- if (opt_exp) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = exp (vIn[ix][iy]);
+ if (opt_exp) {\r
+ im_in.exp (im_out);
histString = "Exponential transformation";
}
- if (opt_sqr) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = vIn[ix][iy] * vIn[ix][iy];
+ if (opt_sqr) {\r
+ im_in.square (im_out);
histString = "Square transformation";
}
- if (opt_sqrt) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)\r
- if (vIn[ix][iy] < 0)
- vOut[ix][iy] = sqrt (-vIn[ix][iy]);\r
- else\r
- vOut[ix][iy] = sqrt (vIn[ix][iy]);\r
+ if (opt_sqrt) {\r
+ im_in.sqrt (im_out);
histString = "Square root transformation";
}
- im_out->labelsCopy (*im_in);
- im_out->labelAdd (Array2dFileLabel::L_HISTORY, histString.c_str());
- im_out->fileWrite (out_file);
+ im_out.labelsCopy (im_in);
+ im_out.labelAdd (Array2dFileLabel::L_HISTORY, histString.c_str());
+ im_out.fileWrite (out_file);
}
return (0);
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: if2.cpp,v 1.5 2000/12/23 18:12:35 kevin Exp $
+** $Id: if2.cpp,v 1.6 2000/12/29 15:45:06 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
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: if2.cpp,v 1.5 2000/12/23 18:12:35 kevin Exp $";
+static const char* g_szIdStr = "$Id: if2.cpp,v 1.6 2000/12/29 15:45:06 kevin Exp $";
void
if2_usage (const char *program)
#if HAVE_SGP
SGPDriver driver ("Column Plot");
SGP sgp (driver);
- EZPlot ezplot (sgp);
+ EZPlot ezplot;
ezplot.ezset ("clear.");
ezplot.ezset ("xticks major 5.");
ezplot.ezset ("xlabel Column");
ezplot.ezset ("grid.");
ezplot.addCurve (plot_xaxis, v1[opt_columnPlot], im_in1.ny());
ezplot.addCurve (plot_xaxis, v2[opt_columnPlot], im_in2.ny());
- ezplot.plot();
+ ezplot.plot (&sgp);
std::cout << "Press enter to continue" << flush;
cio_kb_getc();
#endif
#if HAVE_SGP
SGPDriver driver ("Row Plot");
SGP sgp (driver);
- EZPlot ezplot (sgp);
+ EZPlot ezplot;
ezplot.ezset ("clear.");
ezplot.ezset ("xticks major 5.");
ezplot.ezset ("title Row Plot");
ezplot.ezset ("grid.");
ezplot.addCurve (plot_xaxis, v1Row, im_in1.nx());
ezplot.addCurve (plot_xaxis, v2Row, im_in2.nx());
- ezplot.plot();
+ ezplot.plot (&sgp);
std::cout << "Press enter to continue" << flush;
cio_kb_getc();
#endif