X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=libctsim%2Foptions.cpp;fp=libctsim%2Foptions.cpp;h=0000000000000000000000000000000000000000;hb=2d39e823ba389fc68e5317c422b55be006094252;hp=9bbb5853aa8869185268ce7118c9f821bd33134c;hpb=a95e41ac40cd2f3a4401d921618604cf33f2a904;p=ctsim.git diff --git a/libctsim/options.cpp b/libctsim/options.cpp deleted file mode 100644 index 9bbb585..0000000 --- a/libctsim/options.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/***************************************************************************** -** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg -** -** $Id: options.cpp,v 1.1 2000/06/19 02:59:34 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 -** 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" - -int -opt_set_trace (const char *optarg) -{ - int opt; - - if (strcmp(optarg, O_TRACE_NONE_STR) == 0) - opt = TRACE_NONE; - else if (strcmp(optarg, O_TRACE_TEXT_STR) == 0) - opt = TRACE_TEXT; - else if (strcmp(optarg, O_TRACE_PHM_STR) == 0) - opt = TRACE_PHM; - else if (strcmp(optarg, O_TRACE_PLOT_STR) == 0) - opt = TRACE_PLOT; - else if (strcmp(optarg, O_TRACE_CLIPPING_STR) == 0) - opt = TRACE_CLIPPING; - else if (strcmp(optarg, O_TRACE_RAYS_STR) == 0) - opt = TRACE_RAYS; - else { - sys_error(ERR_WARNING,"Invalid trace option %s\n", optarg); - opt = -1; - } - - return (opt); -} - -const char * -name_of_phantom (const int phmnum) -{ - const char *name = "Unknown phantom"; - - if (phmnum == O_PHM_HERMAN) - name = O_PHM_HERMAN_STR; - else if (phmnum == O_PHM_ROWLAND) - name = O_PHM_ROWLAND_STR; - else if (phmnum == O_PHM_BROWLAND) - name = O_PHM_BROWLAND_STR; - else if (phmnum == O_PHM_UNITPULSE) - name = O_PHM_UNITPULSE_STR; - - return (name); -} - -int -opt_set_phantom (const char *optarg) -{ - int opt; - - if (strcmp(optarg, O_PHM_HERMAN_STR) == 0) - opt = O_PHM_HERMAN; - else if (strcmp(optarg, O_PHM_ROWLAND_STR) == 0) - opt = O_PHM_ROWLAND; - else if (strcmp(optarg, O_PHM_BROWLAND_STR) == 0) - opt = O_PHM_BROWLAND; - else if (strcmp(optarg, O_PHM_UNITPULSE_STR) == 0) - opt = O_PHM_UNITPULSE; - else { - sys_error(ERR_WARNING,"Invalid phantom option %s\n", optarg); - opt = -1; - } - - return (opt); - -} - -InterpolationType -opt_set_interpolation (const char *optarg) -{ - InterpolationType opt; - - if (strcmp(optarg, O_INTERP_NEAREST_STR) == 0) - opt = I_NEAREST; - else if (strcmp(optarg, O_INTERP_LINEAR_STR) == 0) - opt = I_LINEAR; -#if HAVE_BSPLINE_INTERP - else if (strcmp(optarg, O_INTERP_BSPLINE_STR) == 0) - opt = I_BSPLINE; -#endif - else { - sys_error(ERR_WARNING, "Invalid interpolation type %s\n", optarg); - opt = static_cast(-1); - } - - return (opt); -} - -FilterType -opt_set_filter (const char *optarg) -{ - FilterType opt; - - if (strcmp(optarg, O_FILTER_BANDLIMIT_STR) == 0) - opt = FILTER_BANDLIMIT; - else if (strcmp(optarg, O_FILTER_HAMMING_STR) == 0) - opt = FILTER_G_HAMMING; - else if (strcmp(optarg, O_FILTER_SINC_STR) == 0) - opt = FILTER_SINC; - else if (strcmp(optarg, O_FILTER_COS_STR) == 0) - opt = FILTER_COSINE; - else if (strcmp(optarg, O_FILTER_TRIANGLE_STR) == 0) - opt = FILTER_TRIANGLE; - else if (strcmp(optarg, O_FILTER_ABS_BANDLIMIT_STR) == 0) - opt = FILTER_ABS_BANDLIMIT; - else if (strcmp(optarg, O_FILTER_ABS_HAMMING_STR) == 0) - opt = FILTER_ABS_G_HAMMING; - else if (strcmp(optarg, O_FILTER_ABS_SINC_STR) == 0) - opt = FILTER_ABS_SINC; - else if (strcmp(optarg, O_FILTER_ABS_COS_STR) == 0) - opt = FILTER_ABS_COSINE; - else if (strcmp(optarg, O_FILTER_SHEPP_STR) == 0) - opt = FILTER_SHEPP; - else { - sys_error(ERR_WARNING, "Invalid filter type %s\n", optarg); - opt = static_cast(-1); - } - - return (opt); -} - -const char * -name_of_filter (const int filter) -{ - const char *name = "Unknown filter"; - - if (filter == FILTER_SHEPP) - name = O_FILTER_SHEPP_STR; - else if (filter == FILTER_ABS_COSINE) - name = O_FILTER_ABS_COS_STR; - else if (filter == FILTER_ABS_SINC) - name = O_FILTER_ABS_SINC_STR; - else if (filter == FILTER_ABS_G_HAMMING) - name = O_FILTER_ABS_HAMMING_STR; - else if (filter == FILTER_ABS_BANDLIMIT) - name = O_FILTER_ABS_BANDLIMIT_STR; - else if (filter == FILTER_COSINE) - name = O_FILTER_COS_STR; - else if (filter == FILTER_SINC) - name = O_FILTER_SINC_STR; - else if (filter == FILTER_G_HAMMING) - name = O_FILTER_HAMMING_STR; - else if (filter == FILTER_BANDLIMIT) - name = O_FILTER_BANDLIMIT_STR; - else if (filter == FILTER_TRIANGLE) - name = O_FILTER_TRIANGLE_STR; - - return (name); -} - -DomainType -opt_set_filter_domain (const char *optarg) -{ - DomainType opt; - - if (strcmp(optarg, D_SPATIAL_STR) == 0) - opt = D_SPATIAL; - else if (strcmp(optarg, D_FREQ_STR) == 0) - opt = D_FREQ; - else { - sys_error(ERR_WARNING, "Invalid filter domain %s\n", optarg); - opt = static_cast(-1); - } - - return (opt); -} - -const char * -name_of_filter_domain (const DomainType domain) -{ - const char *name = "Unknown domain"; - - if (domain == D_SPATIAL) - return(D_SPATIAL_STR); - else if (domain == D_FREQ) - return(D_FREQ_STR); - - return (name); -} - - -BackprojType -opt_set_backproj (const char *optarg) -{ - BackprojType opt; - - if (strcmp(optarg, O_BPROJ_TRIG_STR) == 0) - opt = O_BPROJ_TRIG; - else if (strcmp(optarg, O_BPROJ_TABLE_STR) == 0) - opt = O_BPROJ_TABLE; - else if (strcmp(optarg, O_BPROJ_DIFF_STR) == 0) - opt = O_BPROJ_DIFF; - else if (strcmp(optarg, O_BPROJ_DIFF2_STR) == 0) - opt = O_BPROJ_DIFF2; - else if (strcmp(optarg, O_BPROJ_IDIFF2_STR) == 0) - opt = O_BPROJ_IDIFF2; - else { - sys_error(ERR_WARNING, "Invalid backprojection method %s\n", optarg); - opt = static_cast(-1); - } - - return (opt); -} - -const char * -name_of_backproj(const BackprojType bproj) -{ - const char *name = "Unknown backprojection method"; - - if (bproj == O_BPROJ_TRIG) - name = O_BPROJ_TRIG_STR; - else if (bproj == O_BPROJ_TABLE) - name = O_BPROJ_TABLE_STR; - else if (bproj == O_BPROJ_DIFF) - name = O_BPROJ_DIFF_STR; - else if (bproj == O_BPROJ_DIFF2) - name = O_BPROJ_DIFF2_STR; - else if (bproj == O_BPROJ_IDIFF2) - name = O_BPROJ_IDIFF2_STR; - - return (name); -} - - - -/* NAME - * name_of_interp Return name of interpolation method - * - * SYNOPSIS - * name = name_of_interp (interp_type) - * char *name Name of interpolation method - * int interp_type Method of interpolation - * - * NOTES - * Returns NULL if interp_type is invalid - */ - -const char * -name_of_interpolation (int interp_type) -{ - if (interp_type == I_NEAREST) - return (O_INTERP_NEAREST_STR); - else if (interp_type == I_LINEAR) - return (O_INTERP_LINEAR_STR); -#if HAVE_BSPLINE_INTERP - else if (interp_type == I_BSPLINE) - return (O_INTERP_BSPLINE_STR); -#endif - else - return ("Unknown interpolation method"); -} - -