** 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
**
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");
** 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
**
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");
** 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
**
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);
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
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);
** 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
**
** 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
*/
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);
** 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
**
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) {
** 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
**
{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"
#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)
#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");
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]);
}
}
- 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)
{
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);