From: Kevin M. Rosenberg Date: Sun, 9 Jul 2000 08:16:18 +0000 (+0000) Subject: r140: *** empty log message *** X-Git-Tag: debian-4.5.3-3~877 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=6850134e4711a842cc7c0a306a9e4243df06b952 r140: *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index b79ebf1..055fcff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2.0.0-b3 - 7/09/00 Added highly optimized backprojection method idiff3 + Moved comparative stats to if-2 program from ifinfo 2.0.0-b2 - 7/07/00 Cleaned up SignalFilter class diff --git a/acconfig.h b/acconfig.h index 8d68fc0..a1ed6a6 100644 --- a/acconfig.h +++ b/acconfig.h @@ -64,3 +64,7 @@ #undef HAVE_WXWINDOWS #undef HAVE_FFTW + +#undef DEBUG + +#undef NDEBUG diff --git a/cgi-bin/ctsim.cgi.in b/cgi-bin/ctsim.cgi.in index 8c9190b..959d69b 100755 --- a/cgi-bin/ctsim.cgi.in +++ b/cgi-bin/ctsim.cgi.in @@ -84,23 +84,22 @@ my $phantom_fname = "$::datadir/phantom-$tmpid.if"; my $pj_fname = "$::datadir/pj-$tmpid.pj"; my $ir_fname = "$::datadir/ir-$tmpid.if"; my $pj_if_fname = "$::datadir/pj-$tmpid.if"; -my $diff_fname = "$::datadir/diff-$tmpid.if"; +my $sub_fname = "$::datadir/sub-$tmpid.if"; my $phantom_png = "$::datadir/phantom-$tmpid.png"; my $ir_png = "$::datadir/ir-$tmpid.png"; my $pj_png = "$::datadir/pj-$tmpid.png"; -my $diff_png = "$::datadir/diff-$tmpid.png"; +my $sub_png = "$::datadir/sub-$tmpid.png"; my $result_url = "$::url_datadir/result-$tmpid.html"; my $phantom_png_url = "$::url_datadir/phantom-$tmpid.png"; my $ir_png_url = "$::url_datadir/ir-$tmpid.png"; my $pj_png_url = "$::url_datadir/pj-$tmpid.png"; -my $diff_png_url = "$::url_datadir/diff-$tmpid.png"; +my $sub_png_url = "$::url_datadir/sub-$tmpid.png"; my $pjrec_ver = "$::bindir/pjrec"; my $phm2pj_ver = "$::bindir/phm2pj"; my $phm2if_ver = "$::bindir/phm2if"; my $diff_ver = "$::bindir/if-2"; -my $ifinfo_ver = "$::bindir/ifinfo"; $pjrec_ver = "/opt/lam/bin/mpirun N N $::lamrundir/pjrec-lam" if $MPI; $phm2pj_ver = "/opt/lam/bin/mpirun N N $::lamrundir/phm2pj-lam" if $MPI; @@ -110,8 +109,8 @@ my $gp_cmd = "$phm2if_ver $phantom_fname $Phantom_Nx $Phantom_Ny --phantom $Phan my $pj_cmd = "$phm2pj_ver $pj_fname $PJ_NDet $PJ_NRot --phantom $Phantom_Name --nray $PJ_NRay --rotangle $PJ_RotAngle"; my $pj_if_cmd = "$::bindir/pj2if $pj_fname $pj_if_fname"; my $pjrec_cmd = "$pjrec_ver $pj_fname $ir_fname $IR_Nx $IR_Ny --filter $IR_Filter --filter-param $IR_Filter_Param --interp $IR_Interp --backproj $IR_Backproj --filter-method $IR_FilterMethod --zeropad $IR_Zeropad"; -my $diff_cmd = "$diff_ver $phantom_fname $ir_fname $diff_fname --comp"; -my $compare_cmd = "$ifinfo_ver $phantom_fname $ir_fname"; +my $sub_cmd = "$diff_ver $phantom_fname $ir_fname $sub_fname --sub"; +my $diff_cmd = "$diff_ver $phantom_fname $ir_fname --comp"; my $window_options = "--auto $auto_window_img"; if ($Disp_Min ne 'auto') { @@ -124,7 +123,7 @@ if ($Disp_Max ne 'auto') { my $png1_cmd = "$::bindir/if2img $phantom_fname $phantom_png $window_options --stats --format png"; my $png2_cmd = "$::bindir/if2img $ir_fname $ir_png $window_options --stats --format png"; my $png3_cmd = "$::bindir/if2img $pj_if_fname $pj_png --auto $auto_window_pj --stats --format png"; -my $png4_cmd = "$::bindir/if2img $diff_fname $diff_png --auto $auto_window_diff --stats --format png"; +my $png4_cmd = "$::bindir/if2img $sub_fname $sub_png --auto $auto_window_diff --stats --format png"; my $title = "CT Simulation Results"; @@ -149,12 +148,12 @@ if ($error ne "") { my $pj_out; my $pj_if_out; my $pjrec_out; + my $sub_out; my $diff_out; my $png_gp_out; my $png_pjrec_out; my $png_pj_out; - my $png_diff_out; - my $compare_out; + my $png_sub_out; $gp_out = `$gp_cmd`; if (-s $phantom_fname) { $pj_out .= `$pj_cmd`; @@ -165,14 +164,14 @@ if ($error ne "") { $pjrec_out .= `$pjrec_cmd`; if (-s $ir_fname) { $png_pjrec_out .= `$png2_cmd`; + $sub_out .= `$sub_cmd`; $diff_out .= `$diff_cmd`; - $png_diff_out .= `$png4_cmd`; - $compare_out = `$compare_cmd`; + $png_sub_out .= `$png4_cmd`; } } } - $cmdout = "$gp_cmd\n $gp_out $pj_cmd\n $pj_out $pj_if_cmd\n $pj_if_out $pjrec_cmd\n $pjrec_out $diff_cmd\n $diff_out $png1_cmd\n $png_gp_out $png2_cmd\n $png_pjrec_out $png3_cmd\n $png_pj_out $png4_cmd\n $png_diff_out"; + $cmdout = "$gp_cmd\n $gp_out $pj_cmd\n $pj_out $pj_if_cmd\n $pj_if_out $pjrec_cmd\n $pjrec_out $diff_cmd\n $diff_out $png1_cmd\n $png_gp_out $png2_cmd\n $png_pjrec_out $png3_cmd\n $png_pj_out $png4_cmd\n $png_sub_out"; if (open(LOGFILE,">> $logfile")) { flock(LOGFILE,LOCK_EX); seek(LOGFILE, 0, 2); @@ -190,21 +189,21 @@ if ($error ne "") { my $png_gp_out_html = $png_gp_out; my $png_pjrec_out_html = $png_pjrec_out; my $png_pj_out_html = $png_pj_out; - my $png_diff_out_html = $png_diff_out; + my $png_sub_out_html = $png_sub_out; $png_gp_out_html =~ s/\n/
/gms; $png_pjrec_out_html =~ s/\n/
/gms; $png_pj_out_html =~ s/\n/
/gms; - $png_diff_out_html =~ s/\n/
/gms; + $png_sub_out_html =~ s/\n/
/gms; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; $out .= "\n"; - $out .= "\n"; + $out .= "\n"; $out .= "
Phantom ImageReconstructed Image

$png_gp_out

$png_pjrec_out
Projection SinusoidPhantom/Reconst Error

$png_pj_out

$diff_out
$png_diff_out

$sub_out
$png_sub_out
"; $out .= "Execution time: $execution_time seconds\n"; $out .= "

\nStatistics
"; - $out .= "$compare_out"; + $out .= "$diff_out"; } $out .= "


\n"; diff --git a/config.h.in b/config.h.in index 1a9d08d..a4a5146 100644 --- a/config.h.in +++ b/config.h.in @@ -56,6 +56,10 @@ #undef HAVE_FFTW +#undef DEBUG + +#undef NDEBUG + /* The number of bytes in a double. */ #undef SIZEOF_DOUBLE @@ -89,6 +93,9 @@ /* Define if you have the header file. */ #undef HAVE_X11_EXTENSIONS_MULTIBUF_H +/* Define if you have the header file. */ +#undef HAVE_ASSERT_H + /* Define if you have the header file. */ #undef HAVE_CTYPE_H diff --git a/configure b/configure index 889edc6..2b9a3c6 100755 --- a/configure +++ b/configure @@ -710,7 +710,7 @@ fi PACKAGE=ctsim -VERSION=2.0.0-b2 +VERSION=2.0.0-b3 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -2257,7 +2257,7 @@ EOF fi -for ac_hdr in fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h g2.h +for ac_hdr in fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h g2.h assert.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -2865,18 +2865,16 @@ if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) debug=true - CFLAGS="-g -DDEBUG" echo "$ac_t""yes" 1>&6 ;; no) debug=false echo "$ac_t""no" 1>&6 - CFLAGS="-g -O" ;; *) echo "$ac_t""bad value ${enableval} for --enable-debug" 1>&6 ;; esac else - debug=false + debug=false; echo "$ac_t""no" 1>&6 fi @@ -2889,6 +2887,20 @@ else DEBUG_FALSE= fi +if test "$debug" = "true" ; then + CFLAGS="-g -DDEBUG" + cat >> confdefs.h <<\EOF +#define DEBUG 1 +EOF + +else + CFLAGS="-g -O3 -DNDEBUG" + cat >> confdefs.h <<\EOF +#define NDEBUG 1 +EOF + +fi + # Check whether --with-lam or --without-lam was given. if test "${with_lam+set}" = set; then withval="$with_lam" @@ -2905,7 +2917,7 @@ if test "$withval" != "no" ; then fi echo $ac_n "checking for LAM MPI installation""... $ac_c" 1>&6 -echo "configure:2909: checking for LAM MPI installation" >&5 +echo "configure:2921: checking for LAM MPI installation" >&5 for testlamdir in "." $trylamdir /usr/local /usr/local/lam /usr /usr/lam /opt /opt/lam ; do if test -x "$testlamdir/bin/hcc" ; then LDFLAGS="$LDFLAGS -L$testlamdir/lib" @@ -2923,7 +2935,7 @@ else fi echo $ac_n "checking for web access""... $ac_c" 1>&6 -echo "configure:2927: checking for web access" >&5 +echo "configure:2939: checking for web access" >&5 # Check whether --with-cgibin-dir or --without-cgibin-dir was given. if test "${with_cgibin_dir+set}" = set; then withval="$with_cgibin_dir" @@ -3013,7 +3025,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:3017: checking for X" >&5 +echo "configure:3029: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -3075,12 +3087,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3084: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3149,14 +3161,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -3262,17 +3274,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:3266: checking whether -R must be followed by a space" >&5 +echo "configure:3278: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -3288,14 +3300,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -3327,7 +3339,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:3331: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3343: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3335,7 +3347,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3368,7 +3380,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:3372: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:3384: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3376,7 +3388,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3416,12 +3428,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:3420: checking for gethostbyname" >&5 +echo "configure:3432: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -3465,7 +3477,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3469: checking for gethostbyname in -lnsl" >&5 +echo "configure:3481: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3473,7 +3485,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3514,12 +3526,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:3518: checking for connect" >&5 +echo "configure:3530: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -3563,7 +3575,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3567: checking for connect in -lsocket" >&5 +echo "configure:3579: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3571,7 +3583,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3606,12 +3618,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:3610: checking for remove" >&5 +echo "configure:3622: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -3655,7 +3667,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:3659: checking for remove in -lposix" >&5 +echo "configure:3671: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3663,7 +3675,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3698,12 +3710,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:3702: checking for shmat" >&5 +echo "configure:3714: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -3747,7 +3759,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:3751: checking for shmat in -lipc" >&5 +echo "configure:3763: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3755,7 +3767,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3799,7 +3811,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:3803: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:3815: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3807,7 +3819,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3855,7 +3867,7 @@ X_BASIC_LIBS="-lXext -lX11" our_saved_LDFLAGS="$LDFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" echo $ac_n "checking for XtToolkitThreadInitialize in -lXt""... $ac_c" 1>&6 -echo "configure:3859: checking for XtToolkitThreadInitialize in -lXt" >&5 +echo "configure:3871: checking for XtToolkitThreadInitialize in -lXt" >&5 ac_lib_var=`echo Xt'_'XtToolkitThreadInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3863,7 +3875,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXt $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3902,7 +3914,7 @@ LDFLAGS="$our_saved_LDFLAGS" our_saved_LDFLAGS="$LDFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" echo $ac_n "checking for XdbeQueryExtension in -lXext""... $ac_c" 1>&6 -echo "configure:3906: checking for XdbeQueryExtension in -lXext" >&5 +echo "configure:3918: checking for XdbeQueryExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XdbeQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3910,7 +3922,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext -lX11 "$X_EXTRA_LIBS" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3945,7 +3957,7 @@ else fi echo $ac_n "checking for XmbufQueryExtension in -lXext""... $ac_c" 1>&6 -echo "configure:3949: checking for XmbufQueryExtension in -lXext" >&5 +echo "configure:3961: checking for XmbufQueryExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XmbufQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3953,7 +3965,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext -lX11 "$X_EXTRA_LIBS" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3994,17 +4006,17 @@ for ac_hdr in X11/extensions/Xdbe.h X11/extensions/multibuf.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3998: checking for $ac_hdr" >&5 +echo "configure:4010: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4046,7 +4058,7 @@ my_includes="$my_includes -I../include -I.." echo $ac_n "checking interactive graphics""... $ac_c" 1>&6 -echo "configure:4050: checking interactive graphics" >&5 +echo "configure:4062: checking interactive graphics" >&5 if test "$no_x" != "yes" ; then cat >> confdefs.h <<\EOF #define HAVE_X11 1 diff --git a/configure.in b/configure.in index 776c723..20cc064 100644 --- a/configure.in +++ b/configure.in @@ -88,7 +88,7 @@ fi dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h g2.h) +AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h g2.h assert.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -143,19 +143,25 @@ AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging], [case "${enableval}" in yes) debug=true - CFLAGS="-g -DDEBUG" AC_MSG_RESULT(yes) ;; no) debug=false AC_MSG_RESULT(no) - CFLAGS="-g -O" ;; *) AC_MSG_RESULT([bad value ${enableval} for --enable-debug]) ;; esac], -[debug=false]) +[debug=false; AC_MSG_RESULT(no)]) AM_CONDITIONAL(DEBUG, test "$debug" = "true") +if test "$debug" = "true" ; then + CFLAGS="-g -DDEBUG" + AC_DEFINE(DEBUG) +else + CFLAGS="-g -O3 -DNDEBUG" + AC_DEFINE(NDEBUG) +fi + dnl Set LAM path AC_ARG_WITH(lam, [ --with-lam[=PATH] Set path of LAM MPI ], diff --git a/html/simulate.html.in b/html/simulate.html.in index c05887d..5039901 100644 --- a/html/simulate.html.in +++ b/html/simulate.html.in @@ -65,7 +65,8 @@ Backprojection Method:
Trig Table
Difference
Difference Optimized
-Difference Optimized (integer math)
+Difference Optimized (integer math)
+Difference Highly-optimized (integer math)

diff --git a/include/array2dfile.h b/include/array2dfile.h index 8104129..9ff8dca 100644 --- a/include/array2dfile.h +++ b/include/array2dfile.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.h,v 1.3 2000/06/28 15:25:34 kevin Exp $ +** $Id: array2dfile.h,v 1.4 2000/07/09 08:16:17 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 @@ -164,8 +164,12 @@ public: bool fileRead (const char* const filename); + bool fileRead (const string& filename); + bool fileWrite (const char* const filename); + bool fileWrite (const string& filename); + const string& getFilename (void) const { return m_filename; } diff --git a/include/backprojectors.h b/include/backprojectors.h index 0a2a8e1..f0cc19a 100644 --- a/include/backprojectors.h +++ b/include/backprojectors.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.h,v 1.6 2000/07/07 15:30:59 kevin Exp $ +** $Id: backprojectors.h,v 1.7 2000/07/09 08:16:17 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 @@ -52,7 +52,8 @@ class Backprojector I_2BSPLINE, I_3BSPLINE, #endif - INTERP_LINEAR // Linear interpolation + INTERP_LINEAR, // Linear interpolation + INTERP_FREQ_PREINTERPOLATE, } InterpolationID; static const char BPROJ_TRIG_STR[]= "trig"; @@ -65,7 +66,7 @@ class Backprojector static const char INTERP_NEAREST_STR[]= "nearest"; static const char INTERP_LINEAR_STR[]= "linear"; static const char INTERP_BSPLINE_STR[]= "bspline"; - + static const char INTERP_FREQ_PREINTERPOLATE_STR[]= "freq_preinterpolate"; Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName); diff --git a/include/ct.h b/include/ct.h index 5a0dc9b..07a76ef 100644 --- a/include/ct.h +++ b/include/ct.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ct.h,v 1.26 2000/07/06 18:37:24 kevin Exp $ +** $Id: ct.h,v 1.27 2000/07/09 08:16:17 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 @@ -108,6 +108,9 @@ extern "C" { #ifdef HAVE_STDINT_H #include /* Standard ints on Linux */ #endif +#ifdef HAVE_ASSERT_H +#include +#endif #ifdef HAVE_FFTW #include diff --git a/libctsim/Makefile.am b/libctsim/Makefile.am index 1d340b8..ec764a3 100644 --- a/libctsim/Makefile.am +++ b/libctsim/Makefile.am @@ -3,4 +3,3 @@ libctsim_a_SOURCES = filter.cpp scanner.cpp projections.cpp phantom.cpp imagefil INCLUDES=@my_includes@ EXTRA_DIST=Makefile.nt - diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index 03a5f1a..0ed6354 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.4 2000/06/29 12:39:46 kevin Exp $ +** $Id: array2dfile.cpp,v 1.5 2000/07/09 08:16:17 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 @@ -240,6 +240,12 @@ Array2dFile::freeArray (void) } } +bool +Array2dFile::fileWrite (const string& filename) +{ + return fileWrite (filename.c_str()); +} + bool Array2dFile::fileWrite (const char* const filename) { @@ -262,6 +268,12 @@ Array2dFile::fileWrite (const char* const filename) return true; } +bool +Array2dFile::fileRead (const string& filename) +{ + return fileRead (filename.c_str()); +} + bool Array2dFile::fileRead (const char* const filename) { diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index 0684c16..d3cb203 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.5 2000/07/07 15:30:59 kevin Exp $ +** $Id: backprojectors.cpp,v 1.6 2000/07/09 08:16:17 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 @@ -152,6 +152,8 @@ Backprojector::convertInterpolationNameToID (const char* const interpName) interpID = INTERP_NEAREST; else if (strcasecmp (interpName, INTERP_LINEAR_STR) == 0) interpID = INTERP_LINEAR; + else if (strcasecmp (interpName, INTERP_FREQ_PREINTERPOLATE_STR) == 0) + interpID = INTERP_FREQ_PREINTERPOLATE; #if HAVE_BSPLINE_INTERP else if (strcasecmp (interpName, INTERP_BSPLINE_STR) == 0) interpID = INTERP_BSPLINE; @@ -180,6 +182,8 @@ Backprojector::convertInterpolationIDToName (const InterpolationID interpID) return (INTERP_NEAREST_STR); else if (interpID == INTERP_LINEAR) return (INTERP_LINEAR_STR); + else if (interpID == INTERP_FREQ_PREINTERPOLATE) + return (INTERP_FREQ_PREINTERPOLATE_STR); #if HAVE_BSPLINE_INTERP else if (interpID == INTERP_BSPLINE) return (INTERP_BSPLINE_STR); @@ -471,12 +475,12 @@ BackprojectIntDiff2::BackprojectView (const double* const filteredProj, const do { double theta = - view_angle; // add half PI to view angle to get perpendicular theta angle - kint32 scale = 1 << 16; - double dScale = scale; - kint32 halfScale = scale / 2; + static const kint32 scale = 1 << 16; + static const double dScale = scale; + static const kint32 halfScale = scale / 2; - kint32 det_dx = nearest (xInc * sin (theta) / detInc * scale); - kint32 det_dy = nearest (yInc * cos (theta) / detInc * scale); + const kint32 det_dx = nearest (xInc * sin (theta) / detInc * scale); + const kint32 det_dy = nearest (yInc * cos (theta) / detInc * scale); // calculate L for first point in image (0, 0) kint32 detPosColStart = nearest (start_r * cos (theta - start_phi) / detInc * scale); @@ -524,8 +528,10 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do double theta = - view_angle; // add half PI to view angle to get perpendicular theta angle static const int scaleShift = 16; static const kint32 scale = (1 << scaleShift); + static const kint32 scaleBitmask = scale - 1; static const double dScale = scale; static const kint32 halfScale = scale / 2; + static const double dInvScale = 1. / scale; const kint32 det_dx = nearest (xInc * sin (theta) / detInc * scale); const kint32 det_dy = nearest (yInc * cos (theta) / detInc * scale); @@ -537,28 +543,26 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do kint32 curDetPos = detPosColStart; ImageFileColumn pImCol = v[ix]; - for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) { - if (interpType == Backprojector::INTERP_NEAREST) { - int iDetPos = (curDetPos + halfScale) >> scaleShift; - - if (iDetPos < 0 || iDetPos >= nDet) // check for impossible: index outside of raysum pos - errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos); - else - *pImCol++ += filteredProj[iDetPos]; - } else if (interpType == Backprojector::INTERP_LINEAR) { - kint32 detPosFloor = curDetPos / scale; - kint32 detPosRemainder = curDetPos % scale; - if (detPosRemainder < 0) { - detPosFloor--; - detPosRemainder += scale; - } - int iDetPos = iDetCenter + detPosFloor; - double frac = detPosRemainder / dScale; - if (iDetPos < 0 || iDetPos >= nDet - 1) - errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos); - else - *pImCol++ += ((1.-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]); - } - } // end for y - } // end for x + if (interpType == Backprojector::INTERP_NEAREST) { + for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) { + int iDetPos = (curDetPos + halfScale) >> 16; + assert(iDetPos >= 0 && iDetPos < nDet); + *pImCol++ += filteredProj[iDetPos]; + } // end for iy + } else if (interpType == Backprojector::INTERP_LINEAR) { + for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) { + kint32 iDetPos = curDetPos >> scaleShift; + kint32 detRemainder = curDetPos & scaleBitmask; +#if 0 + double frac = detRemainder * (1. / 65536.); + assert(iDetPos >= 0 && iDetPos < nDet - 1); + *pImCol++ += ((1.-frac) * filteredProj[iDetPos]) + (frac * filteredProj[iDetPos+1]); +#else + assert(iDetPos >= 0 && iDetPos < nDet - 1); + const double* const detPointer = &filteredProj[iDetPos]; + *pImCol++ += (((scale-detRemainder) * *detPointer) + (detRemainder * *(detPointer+1))) * dInvScale; +#endif + } // end for iy + } //end linear + } // end for ix } diff --git a/src/Makefile.am b/src/Makefile.am index 616f189..9b48e9c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,25 +3,35 @@ bin_SCRIPTS = sample-ctsim.sh EXTRA_PROGRAMS = pjrec-lam phm2pj-lam phm2if-lam INCLUDES=@my_includes@ EXTRA_DIST=Makefile.nt mpiworld.cpp +SOURCE_DEPEND=../include/ct.h ../libctsim/libctsim.a ../libctsupport/libctsupport.a ../libctgraphics/libctgraphics.a -ctsim_SOURCES = ctsim.cpp +ctsim_SOURCES = ctsim.cpp $ ctsim_LDADD = @ctlibs@ -pjrec_SOURCES = pjrec.cpp +ctsim_DEPENDENCIES=$(SOURCE_DEPEND) +pjrec_SOURCES = pjrec.cpp pjrec_LDADD=@ctlibs@ -phm2pj_SOURCES=phm2pj.cpp +pjrec_DEPENDENCIES=$(SOURCE_DEPEND) +phm2pj_SOURCES=phm2pj.cpp phm2pj_LDADD=@ctlibs@ +phm2pj_DEPENDENCIES=$(SOURCE_DEPEND) phm2if_SOURCES = phm2if.cpp phm2if_LDADD=@ctlibs@ +phm2if_DEPENDENCIES=$(SOURCE_DEPEND) if2img_SOURCES = if2img.cpp if2img_LDADD=@ctlibs@ +if2img_DEPENDENCIES=$(SOURCE_DEPEND) pj2if_SOURCES = pj2if.cpp pj2if_LDADD=@ctlibs@ -if_1_SOURCES=if-1.cpp +pj2if_DEPENDENCIES=$(SOURCE_DEPEND) +if_1_SOURCES=if-1.cpp if_1_LDADD=@ctlibs@ -if_2_SOURCES=if-2.cpp +if_1_DEPENDENCIES=$(SOURCE_DEPEND) +if_2_SOURCES=if-2.cpp if_2_LDADD=@ctlibs@ +if_2_DEPENDENCIES=$(SOURCE_DEPEND) ifinfo_SOURCES = ifinfo.cpp ifinfo_LDADD=@ctlibs@ +ifinfo_DEPENDENCIES=$(SOURCE_DEPEND) pjrec_lam_SOURCES=pjrec.cpp pjrec_lam_LDADD=@ctlamlibs@ diff --git a/src/if-2.cpp b/src/if-2.cpp index 545920a..7757f72 100644 --- a/src/if-2.cpp +++ b/src/if-2.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: if-2.cpp,v 1.9 2000/06/28 15:25:34 kevin Exp $ +** $Id: if-2.cpp,v 1.10 2000/07/09 08:16:18 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 @@ -32,7 +32,7 @@ #include "ct.h" #include "timer.h" -enum {O_ADD, O_SUB, O_MUL, O_COMP, O_VERBOSE, O_HELP, O_VERSION}; +enum {O_ADD, O_SUB, O_MUL, O_COMP, O_ROW_PLOT, O_COLUMN_PLOT, O_VERBOSE, O_HELP, O_VERSION}; static struct option my_options[] = { @@ -40,6 +40,8 @@ static struct option my_options[] = {"sub", 0, 0, O_SUB}, {"mul", 0, 0, O_MUL}, {"comp", 0, 0, O_COMP}, + {"column-plot", 1, 0, O_COLUMN_PLOT}, + {"row-plot", 1, 0, O_ROW_PLOT}, {"verbose", 0, 0, O_VERBOSE}, {"help", 0, 0, O_HELP}, {"version", 0, 0, O_VERSION}, @@ -50,18 +52,20 @@ void if2_usage (const char *program) { cout << "usage: " << fileBasename(program) << " infile1 infile2 outfile [OPTIONS]" << endl; - cout << "Generate an image file from two input image files files" << endl; + cout << "Perform functions on two input image files" << endl; cout << endl; - cout << " infile1 Name of first input IF file" << endl; - cout << " infile2 Name of second input IF file" << endl; - cout << " outfile Name of output IF file" << endl; - cout << " --add Add images" << endl; - cout << " --sub Subtract image 2 from image 1" << endl; - cout << " --mul Multiply images" << endl; - cout << " --comp Compare images" << endl; - cout << " --verbose Verbose modem" << endl; - cout << " --version Print version" << endl; - cout << " --help Print this help message" << endl; + cout << " infile1 Name of first input IF file" << endl; + cout << " infile2 Name of second input IF file" << endl; + cout << " outfile Name of output IF file" << endl; + cout << " --add Add images" << endl; + cout << " --sub Subtract image 2 from image 1" << endl; + cout << " --mul Multiply images" << endl; + cout << " --comp Compare images" << endl; + cout << " --column-plot n Plot column\n"; + cout << " --row-plot n Plot row\n"; + cout << " --verbose Verbose modem" << endl; + cout << " --version Print version" << endl; + cout << " --help Print this help message" << endl; } int @@ -70,18 +74,21 @@ if2_main (int argc, char *const argv[]) ImageFile* pim_in1; ImageFile* pim_in2; ImageFile* pim_out; - char *in_file1; - char *in_file2; - char *out_file; + string in_file1; + string in_file2; + string out_file; int opt_verbose = 0; int opt_add = 0; int opt_sub = 0; int opt_mul = 0; int opt_comp = 0; - + int opt_outputFile = 0; + int opt_rowPlot = -1; + int opt_columnPlot = -1; Timer timerProgram; while (1) { + char* endptr; int c = getopt_long (argc, argv, "", my_options, NULL); if (c == -1) @@ -90,13 +97,26 @@ if2_main (int argc, char *const argv[]) switch (c) { case O_ADD: opt_add = 1; + opt_outputFile = 1; break; case O_SUB : opt_sub = 1; + opt_outputFile = 1; break; case O_MUL: opt_mul = 1; + opt_outputFile = 1; break; + case O_ROW_PLOT: + opt_rowPlot = strtol(optarg, &endptr, 10); + if (endptr != optarg + strlen(optarg)) { + if2_usage(argv[0]); + } + case O_COLUMN_PLOT: + opt_columnPlot = strtol(optarg, &endptr, 10); + if (endptr != optarg + strlen(optarg)) { + if2_usage(argv[0]); + } case O_COMP: opt_comp = 1; break; @@ -119,15 +139,20 @@ if2_main (int argc, char *const argv[]) return (1); } } - - if (optind + 3 != argc) { + + if (opt_outputFile && (optind + 3 != argc)) { + if2_usage(argv[0]); + return (1); + } + else if (! opt_outputFile && optind + 2 != argc) { if2_usage(argv[0]); return (1); } in_file1 = argv[optind]; in_file2 = argv[optind + 1]; - out_file = argv[optind + 2]; + if (opt_outputFile) + out_file = argv[optind + 2]; pim_in1 = new ImageFile (); pim_in2 = new ImageFile (); @@ -149,14 +174,16 @@ if2_main (int argc, char *const argv[]) return(1); } - pim_out = new ImageFile (im_in1.nx(), im_in1.ny()); - ImageFile& im_out = *pim_out; - - string strOperation; ImageFileArray v1 = im_in1.getArray(); ImageFileArray v2 = im_in2.getArray(); - ImageFileArray vout = im_out.getArray(); + ImageFileArray vout = NULL; + + if (opt_outputFile) { + pim_out = new ImageFile (im_in1.nx(), im_in1.ny()); + vout = pim_out->getArray(); + } + string strOperation; if (opt_add) { strOperation = "Add Images"; for (int ix = 0; ix < im_in1.nx(); ix++) { @@ -184,28 +211,81 @@ if2_main (int argc, char *const argv[]) for (int iy = 0; iy < im_in1.ny(); iy++) *out++ = *in1++ * *in2++; } - } else if (opt_comp) { - double abs_error = 0.; - strOperation = "Subtract Images"; - for (int ix = 0; ix < im_in1.nx(); ix++) { - ImageFileColumn in1 = v1[ix]; - ImageFileColumn in2 = v2[ix]; - ImageFileColumn out = vout[ix]; - for (int iy = 0; iy < im_in1.ny(); iy++) { - double diff = *in1++ - *in2++; - *out++ = diff; - } - } + } + if (opt_comp) { double d, r, e; im_in1.comparativeStatistics (im_in2, d, r, e); cout << "d=" << d << ", r=" << r << ", e=" << e << endl; } + if (opt_columnPlot > 0) { + if (opt_columnPlot >= im_in1.nx() || opt_columnPlot >= im_in2.nx()) { + sys_error (ERR_SEVERE, "column-plot > nx"); + return (1); + } + double plot_xaxis [im_in1.nx()]; + for (int i = 0; i < im_in1.nx(); i++) + plot_xaxis[i] = i; +#if HAVE_SGP +#if 0 +#else + ezset ("clear."); + ezset ("xticks major 5."); + ezset ("xlabel Column"); + ezset ("ylabel Pixel"); + ezset ("curves 2"); + ezset ("box."); + ezset ("grid."); + ezplot (v1[opt_columnPlot], plot_xaxis, im_in1.ny()); + ezplot (v2[opt_columnPlot], plot_xaxis, im_in2.ny()); +#endif + char str[256]; + cout << "Press enter to continue" << flush; + fgets(str, sizeof(str), stdin); + sgp2_close (sgp2_get_active_win()); +#endif + } - im_out.labelsCopy (im_in1, "if-2 file 1: "); - im_out.labelsCopy (im_in2, "if-2 file 2: "); - im_out.labelAdd (Array2dFileLabel::L_HISTORY, strOperation.c_str(), timerProgram.timerEnd()); + if (opt_rowPlot > 0) { + if (opt_rowPlot >= im_in1.ny() || opt_rowPlot >= im_in2.ny()) { + sys_error (ERR_SEVERE, "row_plot > ny"); + return (1); + } + double plot_xaxis [im_in1.ny()]; + double v1Row[im_in1.nx()], v2Row[im_in2.nx()]; + + for (int i = 0; i < im_in1.ny(); i++) + plot_xaxis[i] = i; + for (int i = 0; i < im_in1.nx(); i++) + v1Row[i] = v1[opt_rowPlot][i]; + for (int i = 0; i < im_in2.nx(); i++) + v2Row[i] = v2[opt_rowPlot][i]; - im_out.fileWrite(out_file); +#if HAVE_SGP +#if 0 +#else + ezset ("clear."); + ezset ("xticks major 5."); + ezset ("xlabel Column"); + ezset ("ylabel Pixel"); + ezset ("curves 2"); + ezset ("box."); + ezset ("grid."); + ezplot (v1Row, plot_xaxis, im_in1.nx()); + ezplot (v2Row, plot_xaxis, im_in2.nx()); +#endif + char str[256]; + cout << "Press enter to continue" << flush; + fgets(str, sizeof(str), stdin); + sgp2_close (sgp2_get_active_win()); +#endif + } + + if (opt_outputFile) { + pim_out->labelsCopy (im_in1, "if-2 file 1: "); + pim_out->labelsCopy (im_in2, "if-2 file 2: "); + pim_out->labelAdd (Array2dFileLabel::L_HISTORY, strOperation.c_str(), timerProgram.timerEnd()); + pim_out->fileWrite(out_file); + } return (0); } diff --git a/src/if2img.cpp b/src/if2img.cpp index 2547b51..6945de8 100644 --- a/src/if2img.cpp +++ b/src/if2img.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: if2img.cpp,v 1.10 2000/07/04 22:21:01 kevin Exp $ +** $Id: if2img.cpp,v 1.11 2000/07/09 08:16:18 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 @@ -411,9 +411,9 @@ if2img_main (int argc, char *const argv[]) #endif else if (opt_format == O_FORMAT_DISP) { #if HAVE_SGP - // image_display_scale (im, opt_scale, densmin, densmax); - // cio_kb_getc(); - sgp2_close(sgp2_get_active_win()); + im.displayScaling (opt_scale, densmin, densmax); + cio_kb_getc(); + sgp2_close(sgp2_get_active_win()); #endif } else diff --git a/src/ifinfo.cpp b/src/ifinfo.cpp index 321fc5c..6149c9e 100644 --- a/src/ifinfo.cpp +++ b/src/ifinfo.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ifinfo.cpp,v 1.12 2000/06/27 10:48:11 kevin Exp $ +** $Id: ifinfo.cpp,v 1.13 2000/07/09 08:16:18 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 @@ -49,7 +49,7 @@ static struct option my_options[] = void ifinfo_usage (const char *program) { - cout << "usage: " << fileBasename(program) << " image1 [image2] [OPTIONS]" << endl; + cout << "usage: " << fileBasename(program) << " image-filename [OPTIONS]" << endl; cout << "Imagefile information" << endl; cout << endl; cout << " infile Name of input IF file" << endl; @@ -68,9 +68,7 @@ int ifinfo_main (int argc, char *const argv[]) { ImageFile *im = NULL; - ImageFile* im2 = NULL; string in_file; - string in2_file; int opt_verbose = 0; int opt_stats = 1; int opt_labels = 1; @@ -120,9 +118,7 @@ ifinfo_main (int argc, char *const argv[]) } } - if (optind + 2 == argc) { - in2_file = argv [optind+1]; - } else if (optind + 1 != argc) { + if (optind + 1 != argc) { ifinfo_usage (argv[0]); return (1); } @@ -130,45 +126,19 @@ ifinfo_main (int argc, char *const argv[]) in_file = argv[optind]; im = new ImageFile (); - if (! im->fileRead (in_file.c_str())) { + if (! im->fileRead (in_file)) { sys_error (ERR_WARNING, "Unable to read file %s", in_file.c_str()); return (1); } - if (in2_file != "") { - im2 = new ImageFile(); - if (! im2->fileRead (in2_file.c_str())) { - sys_error (ERR_WARNING, "Unable to read file %s", in2_file.c_str()); - return (1); - } - } - - if (opt_stats) - cout << "Image size: (" << im->nx() << "," << im->ny() << ")" << endl << endl; - if (im2) - cout << "Image 1: " << im->getFilename() << endl; - if (opt_labels) im->printLabels (cout); if (opt_stats) { + cout << "Size: (" << im->nx() << "," << im->ny() << ")" << endl; im->printStatistics (cout); - - if (im2) { - cout << endl; - - cout << "Image 2: " << im2->getFilename() << endl; - - if (opt_labels) - im2->printLabels(cout); - - im2->printStatistics (cout); - cout << endl; - - im->printComparativeStatistics (*im2, cout); - } } - + return (0); } diff --git a/src/pjrec.cpp b/src/pjrec.cpp index c64f6ae..40a8cba 100644 --- a/src/pjrec.cpp +++ b/src/pjrec.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: pjrec.cpp,v 1.8 2000/07/06 18:37:24 kevin Exp $ +** $Id: pjrec.cpp,v 1.9 2000/07/09 08:16:18 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 @@ -92,6 +92,7 @@ pjrec_usage (const char *program) cout << " diff Difference method" << endl; cout << " diff2 Optimized difference method (default)" << endl; cout << " idiff2 Optimized difference method with integer math" << endl; + cout << " idiff3 Highly-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; diff --git a/src/sample-ctsim.sh.in b/src/sample-ctsim.sh.in index efc14e2..1277641 100755 --- a/src/sample-ctsim.sh.in +++ b/src/sample-ctsim.sh.in @@ -35,7 +35,7 @@ if [ -f sample-rec.if ]; then ${bin}if2img sample-rec.if sample-rec.png --format png ${bin}if2img sample-rec.if sample-rec16.png --format png16 - ${bin}ifinfo sample-phm.if sample-rec.if + ${bin}if-2 sample-phm.if sample-rec.if --comp fi # Files sample-phm.png, sample-pj.png, and sample-rec.png are ready for display