From: Kevin M. Rosenberg Date: Wed, 24 May 2000 22:50:04 +0000 (+0000) Subject: r61: Added support for new SGP library X-Git-Tag: debian-4.5.3-3~956 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=8f6d22c1d18c183cfcb95ca97cea85cbae0ab6c3 r61: Added support for new SGP library --- diff --git a/src/ctrec.c b/src/ctrec.c index a643d16..01874dd 100644 --- a/src/ctrec.c +++ b/src/ctrec.c @@ -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"); diff --git a/src/phm2rs.c b/src/phm2rs.c index b92c914..fa4fcbd 100644 --- a/src/phm2rs.c +++ b/src/phm2rs.c @@ -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"); diff --git a/src/phm2sdf.c b/src/phm2sdf.c index 4f06389..fb72ab3 100644 --- a/src/phm2sdf.c +++ b/src/phm2sdf.c @@ -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); diff --git a/src/sdf-1.c b/src/sdf-1.c index d9119cb..0b591c7 100644 --- a/src/sdf-1.c +++ b/src/sdf-1.c @@ -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); diff --git a/src/sdf-2.c b/src/sdf-2.c index 29ccc34..57a8469 100644 --- a/src/sdf-2.c +++ b/src/sdf-2.c @@ -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) { diff --git a/src/sdf2img.c b/src/sdf2img.c index 600d8d7..e51d788 100644 --- a/src/sdf2img.c +++ b/src/sdf2img.c @@ -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);