X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=tools%2FpjHinterp.cpp;h=1e6ef3161f2eb1abb640dac2df47b0c0ce7153f0;hp=dc2b0e94457f81a7b5075bc8d23a19b9d7527601;hb=e89023477e02d9332f87cab5a7975407625dbd60;hpb=8a7697ce57b56cdc43698cd1241ad98d49f9b5ac diff --git a/tools/pjHinterp.cpp b/tools/pjHinterp.cpp index dc2b0e9..1e6ef31 100644 --- a/tools/pjHinterp.cpp +++ b/tools/pjHinterp.cpp @@ -1,29 +1,27 @@ /***************************************************************************** -* ** FILE IDENTIFICATION -* ** -* ** Name: phm2helix.cpp -* ** Purpose: Take projections of a phantom object -* ** Programmer: Ian Kay -* ** Date Started: Aug 2001 -* ** -* ** This is part of the CTSim program -* ** Copyright (C) 1983-2000 Kevin Rosenberg -* ** -* ** $Id$ -* ** -* ** 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 -* ** published by the Free Software Foundation. -* ** -* ** This program is distributed in the hope that it will be useful, -* ** but WITHOUT ANY WARRANTY; without even the implied warranty of -* ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* ** GNU General Public License for more details. -* ** -* ** You should have received a copy of the GNU General Public License -* ** along with this program; if not, write to the Free Software -* ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* ******************************************************************************/ + ** FILE IDENTIFICATION + ** + ** Name: pjHinterp.cpp + ** Purpose: Interpolate helical data in projection space + ** Programmer: Ian Kay and Kevin Rosenberg + ** Date Started: Aug 2001 + ** + ** This is part of the CTSim program + ** Copyright (C) 1983-2009 Kevin Rosenberg + ** + ** 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 + ** published by the Free Software Foundation. + ** + ** This program is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with this program; if not, write to the Free Software + ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ******************************************************************************/ #include "ct.h" #include "timer.h" @@ -31,16 +29,15 @@ enum { O_INTERPVIEW, O_VERBOSE, O_TRACE, O_HELP, O_DEBUG, O_VERSION}; - static struct option my_options[] = { - {"interpview", 1, 0, O_INTERPVIEW}, - {"trace", 1, 0, O_TRACE}, - {"debug", 0, 0, O_DEBUG}, - {"verbose", 0, 0, O_VERBOSE}, - {"help", 0, 0, O_HELP}, - {"version", 0, 0, O_VERSION}, - {0, 0, 0, 0} + {"interpview", 1, 0, O_INTERPVIEW}, + {"trace", 1, 0, O_TRACE}, + {"debug", 0, 0, O_DEBUG}, + {"verbose", 0, 0, O_VERBOSE}, + {"help", 0, 0, O_HELP}, + {"version", 0, 0, O_VERSION}, + {0, 0, 0, 0} }; static const char* g_szIdStr = "$Id$"; @@ -68,26 +65,27 @@ pjHinterp_main(int argc, char * const argv[]) char* pszProjFilename = NULL; char* pszInterpFilename = NULL; bool bOptVerbose = false; - bool bOptDebug = 1; + bool bOptDebug = false; int optTrace = Trace::TRACE_NONE; char *endptr = NULL; - char *endstr; + char *endstr; int opt_interpview=-1; + UNUSED(bOptDebug); while (1) { int c = getopt_long(argc, argv, "", my_options, NULL); - + if (c == -1) break; - + switch (c) { case O_INTERPVIEW: opt_interpview = strtol(optarg, &endptr, 10); endstr = optarg + strlen(optarg); - if (endptr != endstr) { - std::cerr << "Error setting --interpview to %s" << optarg << std::endl; - pjHinterp_usage(argv[0]); - return(1); + if (endptr != endstr) { + std::cerr << "Error setting --interpview to %s" << optarg << std::endl; + pjHinterp_usage(argv[0]); + return(1); } break; case O_VERBOSE: @@ -97,23 +95,23 @@ pjHinterp_main(int argc, char * const argv[]) bOptDebug = true; break; case O_TRACE: - if ((optTrace = Trace::convertTraceNameToID(optarg)) - == Trace::TRACE_INVALID) { - pjHinterp_usage(argv[0]); - return (1); + if ((optTrace = Trace::convertTraceNameToID(optarg)) + == Trace::TRACE_INVALID) { + pjHinterp_usage(argv[0]); + return (1); } break; case O_VERSION: #ifdef VERSION - std::cout << "Version " << VERSION << std::endl << - g_szIdStr << std::endl; + std::cout << "Version " << VERSION << std::endl << + g_szIdStr << std::endl; #else std::cout << "Unknown version number" << std::endl; #endif return (0); - + case O_HELP: - case '?': + case '?': pjHinterp_usage(argv[0]); return (0); default: @@ -121,33 +119,33 @@ pjHinterp_main(int argc, char * const argv[]) return (1); } // end switch } // end while - + if (optind + 2 != argc) { pjHinterp_usage(argv[0]); return (1); } - + pszProjFilename = argv[optind]; - + pszInterpFilename = argv[optind + 1]; - + Projections projections; - if ( projections.read(pszProjFilename) != true ){ - std::cerr << "Error reading input file " << pszProjFilename << std::endl; + if ( projections.read(pszProjFilename) != true ){ + std::cerr << "Error reading input file " << pszProjFilename << std::endl; return (1); } - if (bOptVerbose) { - std::ostringstream os; + if (bOptVerbose) { + std::ostringstream os; projections.printScanInfo(os); std::cout << os.str(); } - + int status = projections.Helical180LI(opt_interpview); if ( status != 0 ) return (1); status = projections.HalfScanFeather(); if ( status != 0 ) return (1); projections.write( pszInterpFilename ); - + return (0); }