X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fctrec.c;h=1843d3123f48b2721a2b1280fe1150cb057e7f5d;hb=bde04020170bb0a7e49d433b10098db7becbac5f;hp=8b6645957d63c02321806bf77d403ab92217263f;hpb=cda35cc393bfef9a53de1a5c611e09992fb77022;p=ctsim.git diff --git a/src/ctrec.c b/src/ctrec.c index 8b66459..1843d31 100644 --- a/src/ctrec.c +++ b/src/ctrec.c @@ -2,8 +2,17 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctrec.c,v 1.7 2000/05/03 08:49:50 kevin Exp $ +** $Id: ctrec.c,v 1.10 2000/05/11 01:06:30 kevin Exp $ ** $Log: ctrec.c,v $ +** Revision 1.10 2000/05/11 01:06:30 kevin +** Changed sprintf to snprintf +** +** Revision 1.9 2000/05/08 20:02:32 kevin +** ANSI C changes +** +** Revision 1.8 2000/05/04 18:16:34 kevin +** renamed filter definitions +** ** Revision 1.7 2000/05/03 08:49:50 kevin ** Code cleanup ** @@ -53,15 +62,7 @@ #include "ct.h" -#define O_INTERP 1 -#define O_FILTER 2 -#define O_FILTER_PARAM 3 -#define O_BACKPROJ 4 -#define O_VERBOSE 5 -#define O_TRACE 6 -#define O_HELP 7 -#define O_DEBUG 8 -#define O_VERSION 9 +enum {O_INTERP, O_FILTER, O_FILTER_PARAM, O_BACKPROJ, O_VERBOSE, O_TRACE, O_HELP, O_DEBUG, O_VERSION}; static struct option my_options[] = { @@ -144,10 +145,10 @@ main (const int argc, char *const argv[]) int opt_debug = 0; int opt_trace = TRACE_NONE; double opt_filter_param = 1; - int opt_filter = W_A_BANDLIMIT; + int opt_filter = FILTER_ABS_BANDLIMIT; int opt_interp = I_LINEAR; int opt_interp_param = 1; - int opt_backproj = O_BPROJ_DIFF2; + BackprojType opt_backproj = O_BPROJ_DIFF2; #ifdef MPI_CT IMAGE *im_local; RAYSUM *rs_local; @@ -242,14 +243,13 @@ main (const int argc, char *const argv[]) nx = strtol(argv[optind + 2], &endptr, 10); ny = strtol(argv[optind + 3], &endptr, 10); - if (opt_filter == W_G_HAMMING || opt_filter == W_AG_HAMMING) - sprintf (filt_name, "%s: alpha = %.2f", + if (opt_filter == FILTER_G_HAMMING || opt_filter == FILTER_ABS_G_HAMMING) + snprintf (filt_name, sizeof(filt_name), "%s: alpha = %.2f", name_of_filter (opt_filter), opt_filter_param); else - sprintf (filt_name, "%s", name_of_filter (opt_filter)); + snprintf (filt_name, sizeof(filt_name), "%s", name_of_filter (opt_filter)); - sprintf (remark, - "Reconstruct: %dx%d, %s, %s, %s", + snprintf (remark, sizeof(remark), "Reconstruct: %dx%d, %s, %s, %s", nx, ny, filt_name, name_of_interpolation (opt_interp), name_of_backproj(opt_backproj)); if (opt_verbose) @@ -373,7 +373,7 @@ main (const int argc, char *const argv[]) printf("Time to reduce image = %f secs, max time = %f\n", mpi_t, mpi_t_g); } if (mpi_ct.my_rank == 0) { - strncpy (im_global->remark, remark, MAXREMARK); + strncpy (im_global->remark, remark, sizeof(im_global->remark)); time_end = MPI_Wtime(); im_global->calctime = time_end - time_start; image_save (im_global); @@ -382,7 +382,7 @@ main (const int argc, char *const argv[]) } #else raysum_close (rs_global); - strncpy (im_global->remark, remark, MAXREMARK); + strncpy (im_global->remark, remark, sizeof(im_global->remark)); time_end = td_current_sec(); im_global->calctime = time_end - time_start; image_save (im_global);