** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: imagefile.cpp,v 1.1 2000/06/19 02:59:34 kevin Exp $
+** $Id: imagefile.cpp,v 1.3 2000/06/22 10:17:28 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
/* FILE
* image.c Routines for managing images
- *
- * PROGRAMMER: Kevin Rosenberg
- * DATE: Aug 1984
- *
- * FUNCTION
- * Provides a set of routines for handling image files
*/
void
-image_filter_response (ImageFile& im, const DomainType domain, double bw, const FilterType filt_type, double filt_param, const int opt_trace)
+image_filter_response (ImageFile& im, const char* const domainName, double bw, const char* const filterName, double filt_param, const int opt_trace)
{
int hx = im.nx() / 2;
int hy = im.ny() / 2;
for (int j = -hy; j <= hy; j++) {
double r = sqrt(i * i + j * j);
- if (domain == D_SPATIAL)
- v[i+hx][j+hy] = filter_spatial_response_analytic (filt_type, r, bw, filt_param);
- else
- v[i+hx][j+hy] = filter_frequency_response (filt_type, r, bw, filt_param);
+ v[i+hx][j+hy] = SignalFilter::response (filterName, domainName, bw, r, filt_param);
if (opt_trace >= TRACE_PHM)
printf ("r=%8.4f, v=%8.4f\n", r, v[i+hx][j+hy]);
}
ImageFileArray v = im.getArray();
#if HAVE_G2_H
- int* pens = new int [nx * ny * scale * scale ];
+ int pens [nx * ny * scale * scale ];
double view_scale = 255 / (pmax - pmin);
int id_X11 = g2_open_X11 (nx * scale, ny * scale);
for (int i= 0, iy = ny - 1; iy >= 0; iy--) {
for (int ix = 0; ix < nx; ix++) {
- int cval = (int) ((v[ix][iy] - pmin) * view_scale);
+ int cval = static_cast<int>((v[ix][iy] - pmin) * view_scale);
if (cval < 0)
cval = 0;
else if (cval > 255)
g2_image (id_X11, 0., 0., nx, ny, pens);
- delete [] pens;
return (id_X11);
#endif