r61: Added support for new SGP library
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 24 May 2000 22:50:04 +0000 (22:50 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 24 May 2000 22:50:04 +0000 (22:50 +0000)
src/ctrec.c
src/phm2rs.c
src/phm2sdf.c
src/sdf-1.c
src/sdf-2.c
src/sdf2img.c

index a643d16f343378f13f1be5b7196ae137e8b25be7..01874dd82b8aecaa2c71896645102221af8b121b 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctrec.c,v 1.11 2000/05/16 04:33:59 kevin Exp $
+**  $Id: ctrec.c,v 1.12 2000/05/24 22:50:04 kevin Exp $
 **  $Log: ctrec.c,v $
+**  Revision 1.12  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
 **  Revision 1.11  2000/05/16 04:33:59  kevin
 **  Improved option processing
 **
@@ -115,7 +118,7 @@ ctrec_usage (const char *program)
   fprintf(stdout,"    --filter-param Alpha level for Hamming filter\n");
   fprintf(stdout,"    --trace        Set tracing to level\n");
   fprintf(stdout,"         none      No tracing (default)\n");
-  fprintf(stdout,"         status    Status tracing\n");
+  fprintf(stdout,"         text      Text level tracing\n");
   fprintf(stdout,"         phm       Trace phantom\n");
   fprintf(stdout,"         rays      Trace allrays\n");
   fprintf(stdout,"         plot      Trace plotting\n");
index b92c9141de8fa9e5fe72aad21d37484667a26e70..fa4fcbd0e70115d025c9d3e36a56c86752560d89 100644 (file)
@@ -9,8 +9,11 @@
 **   1984 -- Final DOS version  
 **   1999 -- First UNIX version
 **
-**  $Id: phm2rs.c,v 1.11 2000/05/16 04:33:59 kevin Exp $
+**  $Id: phm2rs.c,v 1.12 2000/05/24 22:50:04 kevin Exp $
 **  $Log: phm2rs.c,v $
+**  Revision 1.12  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
 **  Revision 1.11  2000/05/16 04:33:59  kevin
 **  Improved option processing
 **
@@ -106,7 +109,7 @@ if (mpi_ct.my_rank == 0)
   fprintf(stdout,"     --trace      Trace level to use\n");
   fprintf(stdout,"        none      No tracing (default)\n");
   fprintf(stdout,"        text      Trace text level\n");
-  fprintf(stdout,"        phm       Trace PHANTOM\n");
+  fprintf(stdout,"        phm       Trace phantom image\n");
   fprintf(stdout,"        rays      Trace rays\n");
   fprintf(stdout,"        plot      Trace plot\n");
   fprintf(stdout,"        clipping  Trace clipping\n");
index 4f063896ebf776aac8134184fb0d54160b011d40..fb72ab3288cc0a0eae1dd81eedd6bfe1d494a841 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phm2sdf.c,v 1.9 2000/05/16 04:33:59 kevin Exp $
+**  $Id: phm2sdf.c,v 1.10 2000/05/24 22:50:04 kevin Exp $
 **  $Log: phm2sdf.c,v $
+**  Revision 1.10  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
 **  Revision 1.9  2000/05/16 04:33:59  kevin
 **  Improved option processing
 **
@@ -278,11 +281,6 @@ phm2sdf_main (const int argc, char *const argv[])
       return (1);
     }
 
-#if HAVE_INTERACTIVE_GRAPHICS
-    if (opt_trace >= TRACE_PHM)
-      phm_show(phm);
-#endif
-
     if (optind + 3 != argc) {
       phm2sdf_usage(argv[0]);
       return (1);
@@ -406,7 +404,11 @@ phm2sdf_main (const int argc, char *const argv[])
     image_filter_response (im_global, opt_filter_domain, opt_filter_bw, opt_filter, opt_filter_param, opt_trace);
     im_global->calctime = 0;
   } else {
-    phm_to_image (phm, im_global, 0, opt_nx, opt_nsample, opt_trace);
+#if HAVE_SGP
+      if (opt_trace >= TRACE_PHM)
+       phm_show(phm);
+#endif
+      phm_to_image (phm, im_global, 0, opt_nx, opt_nsample, opt_trace);
   }
 #endif
 
@@ -430,14 +432,13 @@ phm2sdf_main (const int argc, char *const argv[])
   if (opt_trace >= TRACE_PHM)
     {
       double dmin, dmax;
-      int nx, ny;
+      int nscale;
 
-      printf ("Enter size of cell (nx, ny): ");
-      scanf ("%d %d", &nx, &ny);
+      printf ("Enter display size scale (nominal = 1): ");
+      scanf ("%d", &nscale);
       printf ("Enter minimum and maximum densities (min, max): ");
       scanf ("%lf %lf", &dmin, &dmax);
-      //      image_paint (CRTDEV, im_global, 0, 0, nx, ny, dmin, dmax, 0);
-
+      image_display_scale (im_global, nscale, dmin, dmax);
     }
 
   phm_free (phm);
index d9119cbafc5eb8030baf3291360ba1c8a51edb0f..0b591c784efbf5c87738652893f6dbbec83f77c0 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sdf-1.c,v 1.5 2000/05/16 04:33:59 kevin Exp $
+**  $Id: sdf-1.c,v 1.6 2000/05/24 22:50:04 kevin Exp $
 **  $Log: sdf-1.c,v $
+**  Revision 1.6  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
 **  Revision 1.5  2000/05/16 04:33:59  kevin
 **  Improved option processing
 **
@@ -34,6 +37,7 @@
 **  along with this program; if not, write to the Free Software
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
+
 /* FILE
  *   sdf-1.c             Filter a single SDF file
  */
@@ -139,7 +143,7 @@ sdf1_main (int argc, char *const argv[])
   out_file = argv[optind + 1];
 
 
-  if (opt_invert || opt_log || opt_exp) {
+  if (opt_invert || opt_log || opt_exp || opt_sqr || opt_sqrt) {
     int ix, iy;
 
     im_in = image_load (in_file);
index 29ccc34ac570c665c5d59d0060231f5249991434..57a8469f739cf2fb0b6429f279b0dadc240cb82b 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sdf-2.c,v 1.4 2000/05/16 04:33:59 kevin Exp $
+**  $Id: sdf-2.c,v 1.5 2000/05/24 22:50:04 kevin Exp $
 **  $Log: sdf-2.c,v $
+**  Revision 1.5  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
 **  Revision 1.4  2000/05/16 04:33:59  kevin
 **  Improved option processing
 **
@@ -138,11 +141,21 @@ sdf2_main (int argc, char *const argv[])
 
   im_in1 = image_load (in_file1);
   im_in2 = image_load (in_file2);
+  if (im_in1 == NULL || im_in2 == NULL) {
+      fprintf(stderr, "Error reading an image");
+      return (1);
+  }
+
   if (im_in1->nx != im_in2->nx || im_in1->ny != im_in2->ny) {
-    fprintf(stderr, "Size of image 1 (%d,%d) and image 2 (%d,%d) do not match\n",
+    fprintf(stderr, "Error: Size of image 1 (%d,%d) and image 2 (%d,%d) do not match\n",
            im_in1->nx, im_in1->ny, im_in2->nx, im_in2->ny);
-    exit(1);
+    return(1);
+  }
+  if (im_in1->nx < 0 || im_in1->ny < 0) {
+      fprintf(stderr, "Error: Size of image < 0");
+      return(1);
   }
+
   im_out = image_create (out_file, im_in1->nx, im_in1->ny);
 
   if (opt_add) {
index 600d8d77582a43369545876a2d09a941956e882f..e51d7889bc73e4fe8a8b255b6657407bcc2d3a6c 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sdf2img.c,v 1.3 2000/05/16 04:33:59 kevin Exp $
+**  $Id: sdf2img.c,v 1.4 2000/05/24 22:50:04 kevin Exp $
 **  $Log: sdf2img.c,v $
+**  Revision 1.4  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
 **  Revision 1.3  2000/05/16 04:33:59  kevin
 **  Improved option processing
 **
@@ -64,13 +67,7 @@ static struct option my_options[] =
   {0, 0, 0, 0}
 };
 
-#define O_AUTO_FULL   1
-#define O_AUTO_STD0_1 2
-#define O_AUTO_STD0_5 3
-#define O_AUTO_STD1   4
-#define O_AUTO_STD2   5
-#define O_AUTO_STD3   6
-
+enum { O_AUTO_FULL, O_AUTO_STD0_1, O_AUTO_STD0_5, O_AUTO_STD1, O_AUTO_STD2, O_AUTO_STD3 };
 #define O_AUTO_FULL_STR  "full"
 #define O_AUTO_STD0_1_STR  "std0.1"
 #define O_AUTO_STD0_5_STR  "std0.5"
@@ -78,19 +75,16 @@ static struct option my_options[] =
 #define O_AUTO_STD2_STR  "std2"
 #define O_AUTO_STD3_STR  "std3"
 
-#define O_CENTER_MEAN      1
-#define O_CENTER_MODE      2
+enum { O_CENTER_MEAN, O_CENTER_MODE };
 #define O_CENTER_MEAN_STR  "mean"
 #define O_CENTER_MODE_STR  "mode"
 
-#define O_FORMAT_GIF       1
-#define O_FORMAT_PNG       2
-#define O_FORMAT_PGM       3
-#define O_FORMAT_PGMASC    4
+enum { O_FORMAT_GIF, O_FORMAT_PNG, O_FORMAT_PGM, O_FORMAT_PGMASC, O_FORMAT_DISP };
 #define O_FORMAT_GIF_STR   "gif"
 #define O_FORMAT_PNG_STR   "png" 
 #define O_FORMAT_PGM_STR   "pgm"
 #define O_FORMAT_PGMASC_STR "pgmasc"
+#define O_FORMAT_DISP_STR    "disp"
 
 void 
 sdf2img_usage (const char *program)
@@ -109,6 +103,7 @@ sdf2img_usage (const char *program)
 #ifdef HAVE_GIF
   fprintf(stdout, "         gif    GIF format\n");
 #endif
+  fprintf(stdout, "         disp   Display on screen\n");
   fprintf(stdout, "     --center   Center of window\n");
   fprintf(stdout, "         mode   Mode is center of window (default)\n");
   fprintf(stdout, "         mean   Mean is center of window\n");
@@ -236,6 +231,8 @@ sdf2img_main (int argc, char *const argv[])
          else if (strcmp(optarg, O_FORMAT_GIF_STR) == 0)
            opt_format = O_FORMAT_GIF;
 #endif
+         else if (strcmp(optarg, O_FORMAT_DISP_STR) == 0)
+           opt_format = O_FORMAT_DISP;
          else {
              fprintf(stderr, "Invalid format mode %s\n", optarg);
              sdf2img_usage(argv[0]);
@@ -271,14 +268,18 @@ sdf2img_main (int argc, char *const argv[])
        }
     }
 
-  if (optind + 2 != argc)
+  if ((opt_format == O_FORMAT_DISP && optind + 1 != argc) 
+      || (opt_format != O_FORMAT_DISP && optind + 2 != argc))
     {
-      sdf2img_usage(argv[0]);
-      return (1);
+       sdf2img_usage(argv[0]);
+       return (1);
     }
   
   in_file = argv[optind];
-  out_file = argv[optind+1];
+
+  if (opt_format != O_FORMAT_DISP)
+      out_file = argv[optind+1];
+  else out_file = NULL;
 
   if ((im = image_load (in_file)) == NULL)
     {
@@ -446,6 +447,11 @@ sdf2img_main (int argc, char *const argv[])
   else if (opt_format == O_FORMAT_GIF) 
     sdf2d_to_gif (im, out_file, opt_scale, opt_scale, densmin, densmax);
 #endif
+  else if (opt_format == O_FORMAT_DISP) {
+      int gid = image_display_scale (im, opt_scale, densmin, densmax);
+      cio_kb_getc();
+      g2_close(gid);
+  }
   else
     {
       fprintf(stderr, "Internal Error: Invalid format mode %d\n", opt_format);