X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fctrec.cpp;h=19278c98bbeb2443c3de464edf6fdcb5b9bc59e4;hb=a62ba7c54d39fcf1e469c8df169018fa60ae7c3b;hp=68b9ff669606260806bb0d8067519a05c24cd53a;hpb=2451ac413848718a1dd666ce6f6464e974680f47;p=ctsim.git diff --git a/src/ctrec.cpp b/src/ctrec.cpp index 68b9ff6..19278c9 100644 --- a/src/ctrec.cpp +++ b/src/ctrec.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctrec.cpp,v 1.5 2000/06/09 01:35:33 kevin Exp $ +** $Id: ctrec.cpp,v 1.7 2000/06/10 22:33:11 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 @@ -46,48 +46,48 @@ static struct option my_options[] = void ctrec_usage (const char *program) { - fprintf(stdout,"usage: %s raysum-file image-file nx-image ny-image [OPTIONS]\n", kbasename(program)); - fprintf(stdout,"Image reconstruction from raysum projections\n"); - fprintf(stdout,"\n"); - fprintf(stdout," raysum-file Input raysum file\n"); - fprintf(stdout," image-file Output image file in SDF2D format\n"); - fprintf(stdout," nx-image Number of columns in output image\n"); - fprintf(stdout," ny-image Number of rows in output image\n"); - fprintf(stdout," --interp Interpolation method during backprojection\n"); - fprintf(stdout," nearest Nearest neighbor interpolation\n"); - fprintf(stdout," linear Linear interpolation\n"); + cout << "usage: " << kbasename(program) << " raysum-file image-file nx-image ny-image [OPTIONS]" << endl; + cout << "Image reconstruction from raysum projections" << endl; + cout << endl; + cout << " raysum-file Input raysum file" << endl; + cout << " image-file Output image file in SDF2D format" << endl; + cout << " nx-image Number of columns in output image" << endl; + cout << " ny-image Number of rows in output image" << endl; + cout << " --interp Interpolation method during backprojection" << endl; + cout << " nearest Nearest neighbor interpolation" << endl; + cout << " linear Linear interpolation" << endl; #if HAVE_BSPLINE_INTERP - fprintf(stdout," bspline B-spline interpolation\n"); + cout << " bspline B-spline interpolation" << endl; #endif - fprintf(stdout," --filter Filter name\n"); - fprintf(stdout," abs_bandlimit Abs * Bandlimiting (default)\n"); - fprintf(stdout," abs_sinc Abs * Sinc\n"); - fprintf(stdout," abs_cos Abs * Cosine\n"); - fprintf(stdout," abs_hamming Abs * Hamming\n"); - fprintf(stdout," shepp Shepp-Logan\n"); - fprintf(stdout," bandlimit Bandlimiting\n"); - fprintf(stdout," sinc Sinc\n"); - fprintf(stdout," cos Cosine\n"); - fprintf(stdout," triangle Triangle\n"); - fprintf(stdout," hamming Hamming\n"); - fprintf(stdout," --backproj Backprojection Method\n"); - fprintf(stdout," trig Trigometric functions at every point\n"); - fprintf(stdout," table Trigometric functions with precalculated table\n"); - fprintf(stdout," diff Difference method\n"); - fprintf(stdout," diff2 Optimized difference method (default)\n"); - fprintf(stdout," idiff2 Optimized difference method with integer math\n"); - 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," text Text level tracing\n"); - fprintf(stdout," phm Trace phantom\n"); - fprintf(stdout," rays Trace allrays\n"); - fprintf(stdout," plot Trace plotting\n"); - fprintf(stdout," clipping Trace clipping\n"); - fprintf(stdout," --verbose Turn on verbose mode\n"); - fprintf(stdout," --debug Turn on debug mode\n"); - fprintf(stdout," --version Print version\n"); - fprintf(stdout," --help Print this help message\n"); + cout << " --filter Filter name" << endl; + cout << " abs_bandlimit Abs * Bandlimiting (default)" << endl; + cout << " abs_sinc Abs * Sinc" << endl; + cout << " abs_cos Abs * Cosine" << endl; + cout << " abs_hamming Abs * Hamming" << endl; + cout << " shepp Shepp-Logan" << endl; + cout << " bandlimit Bandlimiting" << endl; + cout << " sinc Sinc" << endl; + cout << " cos Cosine" << endl; + cout << " triangle Triangle" << endl; + cout << " hamming Hamming" << endl; + cout << " --backproj Backprojection Method" << endl; + cout << " trig Trigometric functions at every point" << endl; + cout << " table Trigometric functions with precalculated table" << endl; + cout << " diff Difference method" << endl; + cout << " diff2 Optimized difference method (default)" << endl; + cout << " idiff2 Optimized difference method with integer math" << endl; + cout << " --filter-param Alpha level for Hamming filter" << endl; + cout << " --trace Set tracing to level" << endl; + cout << " none No tracing (default)" << endl; + cout << " text Text level tracing" << endl; + cout << " phm Trace phantom" << endl; + cout << " rays Trace allrays" << endl; + cout << " plot Trace plotting" << endl; + cout << " clipping Trace clipping" << endl; + cout << " --verbose Turn on verbose mode" << endl; + cout << " --debug Turn on debug mode" << endl; + cout << " --version Print version" << endl; + cout << " --help Print this help message" << endl; } @@ -95,7 +95,6 @@ ctrec_usage (const char *program) static void mpi_scatter_rs (MPIWorld& mpiWorld, RAYSUM *rs_global, RAYSUM *rs_local, const int debug); #endif -static void print_raysum_info(const RAYSUM *rs); int ctrec_main (int argc, char * argv[]) @@ -181,9 +180,9 @@ ctrec_main (int argc, char * argv[]) break; case O_VERSION: #ifdef VERSION - fprintf(stdout, "Version %s\n", VERSION); + cout << "Version " << VERSION << endl; #else - fprintf(stderr, "Unknown version number"); + cout << "Unknown version number" << endl; #endif exit(0); case O_HELP: @@ -228,7 +227,7 @@ ctrec_main (int argc, char * argv[]) rs_global = raysum_open (rs_name); raysum_read (rs_global); if (opt_verbose) - print_raysum_info(rs_global); + raysum_print_info(rs_global); mpi_ndet = rs_global->ndet; mpi_nview = rs_global->nview; @@ -264,7 +263,6 @@ ctrec_main (int argc, char * argv[]) mpiWorld.setTotalWorkUnits (mpi_nview); rs_local = raysum_create (NULL, mpiWorld.getMyLocalWorkUnits(), mpi_ndet); - rs_local->ndet = mpi_ndet; rs_local->nview = mpi_nview; rs_local->det_inc = mpi_detinc; @@ -284,7 +282,7 @@ ctrec_main (int argc, char * argv[]) if (mpiWorld.getRank() == 0) { im_global = new ImageFile (im_filename, nx, ny); - im_global->adf.fileCreate(); + im_global->fileCreate(); } im_local = new ImageFile (nx, ny); @@ -292,10 +290,10 @@ ctrec_main (int argc, char * argv[]) rs_global = raysum_open (rs_name); raysum_read (rs_global); if (opt_verbose) - print_raysum_info(rs_global); + raysum_print_info(rs_global); im_global = new ImageFile (im_filename, nx, ny); - im_global->adf.fileCreate(); + im_global->fileCreate(); #endif #ifdef HAVE_MPI @@ -317,8 +315,8 @@ ctrec_main (int argc, char * argv[]) if (opt_verbose) mpi_t1 = MPI::Wtime(); - int nxLocal = im_local->adf.nx(); - int nyLocal = im_local->adf.ny(); + int nxLocal = im_local->nx(); + int nyLocal = im_local->ny(); ImageFileArray vLocal = im_local->getArray(); ImageFileArray vGlobal = NULL; if (mpiWorld.getRank() == 0) @@ -346,17 +344,16 @@ ctrec_main (int argc, char * argv[]) time_end = td_current_sec(); #endif - #ifdef HAVE_MPI if (mpiWorld.getRank() == 0) #endif { raysum_close (rs_global); double calctime = time_end - time_start; - im_global->adf.arrayDataWrite (); - im_global->adf.labelAdd (Array2dFileLabel::L_HISTORY, rs_global->remark, rs_global->calctime); - im_global->adf.labelAdd (Array2dFileLabel::L_HISTORY, remark, calctime); - im_global->adf.fileClose (); + im_global->arrayDataWrite (); + im_global->labelAdd (Array2dFileLabel::L_HISTORY, rs_global->remark, rs_global->calctime); + im_global->labelAdd (Array2dFileLabel::L_HISTORY, remark, calctime); + im_global->fileClose (); if (opt_verbose) cout << "Time active = " << calctime << " sec" << endl; } @@ -368,7 +365,6 @@ ctrec_main (int argc, char * argv[]) return (0); } - #ifdef HAVE_MPI static void mpi_scatter_rs (MPIWorld& mpiWorld, RAYSUM *rs_global, RAYSUM *rs_local, const int opt_debug) { @@ -394,18 +390,6 @@ static void mpi_scatter_rs (MPIWorld& mpiWorld, RAYSUM *rs_global, RAYSUM *rs_lo #endif -static void print_raysum_info(const RAYSUM *rs) -{ - printf ("Number of detectors: %d\n", rs->ndet); - printf (" Number of views: %d\n", rs->nview); - printf (" Remark: %s\n", rs->remark); - printf (" phmlen: %f\n", rs->phmlen); - printf (" det_start: %f\n", rs->det_start); - printf (" det_inc: %f\n", rs->det_inc); - printf (" rot_start: %f\n", rs->rot_start); - printf (" rot_inc: %f\n", rs->rot_inc); -} - #ifndef NO_MAIN int main (int argc, char* argv[])