r117: *** empty log message ***
[ctsim.git] / libctsim / imagefile.cpp
index 4cae5d2569768a26e5439871589e682663395670..bcb07e2e75092d42e79cad842f63ea7183ecc2da 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.cpp,v 1.2 2000/06/20 17:54:51 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
@@ -89,17 +89,11 @@ Array2dFileLabel::getDateString (void) const
 
 /* 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;
@@ -109,10 +103,7 @@ image_filter_response (ImageFile& im, const DomainType domain, double bw, const
     for (int j = -hy; j <= hy; j++) {
       double r = sqrt(i * i + j * j);
       
-      if (domain == D_SPATIAL)
-       v[i+hx][j+hy] = SignalFilter::spatialResponseAnalytic (filt_type, bw, r, filt_param);
-      else
-       v[i+hx][j+hy] = SignalFilter::frequencyResponse (filt_type, bw, r, 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]);
     }
@@ -137,7 +128,7 @@ int image_display_scale (const ImageFile& im, const int scale, const double pmin
     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);
@@ -149,7 +140,7 @@ int image_display_scale (const ImageFile& im, const int scale, const double pmin
 
     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) 
@@ -160,7 +151,6 @@ int image_display_scale (const ImageFile& im, const int scale, const double pmin
 
     g2_image (id_X11, 0., 0., nx, ny, pens);
 
-    delete [] pens;
     return (id_X11);
 
 #endif