r25: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 30 Apr 2000 19:20:05 +0000 (19:20 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 30 Apr 2000 19:20:05 +0000 (19:20 +0000)
cgi-bin/ctsim.cgi [deleted file]
cgi-bin/ctsim.conf.in [new file with mode: 0755]
html/ctsim.html [deleted file]
src/sample-ctrec.sh [deleted file]

diff --git a/cgi-bin/ctsim.cgi b/cgi-bin/ctsim.cgi
deleted file mode 100644 (file)
index 1c2d4a1..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-#!/usr/bin/perl
-# Generated automatically from ctsim.cgi.in by configure.
-
-use strict;
-use CGI;
-use File::Basename;
-use Fcntl ':flock';
-
-require './ctsim.conf';
-
-my $opt_d = 0;
-$ENV{'PATH'} = $::bindir;
-
-my $fromhost = $ENV{'REMOTE_HOST'};
-
-my $gmt_start = time();
-my $gmt_end;
-my $execution_time;
-
-my %in;
-CGI::ReadParse(\%in);
-
-# Incoming variables 
-#   Phantom_Name, Phantom_Nx, Phantom_Ny, Phantom_NSample
-#   RS_NDet, RS_NRot, RS_NRay, RS_RotAngle,
-#   IR_Nx, IR_Ny, IR_Filter, IR_Filter_Param
-
-my $error = "";
-
-my $Phantom_Name = FilterMetaChars($in{'Phantom_Name'});
-my $Phantom_Nx = FilterToNumber($in{'Phantom_Nx'});
-my $Phantom_Ny = FilterToNumber($in{'Phantom_Ny'});
-my $Phantom_NSample = FilterToNumber($in{'Phantom_NSample'});
-$error .= "Phantom name must not be blank<br>" if ($Phantom_Name eq "");
-$error .= "Phantom NX and NY must be between 5 and 1024<br>" if ($Phantom_Nx < 5 || $Phantom_Nx > 1024 || $Phantom_Ny < 5 || $Phantom_Ny > 1024);
-$error .= "Phantom NSample must be between 1 and 10<br>" if ($Phantom_NSample < 1 || $Phantom_NSample > 10);
-
-my $RS_NDet = FilterToNumber($in{'RS_NDet'});
-my $RS_NRot = FilterToNumber($in{'RS_NRot'});
-my $RS_NRay = FilterToNumber($in{'RS_NRay'});
-my $RS_RotAngle = FilterToNumber($in{'RS_RotAngle'});
-$error .= "Raysum NDet must be between 5 and 1800<br>" if ($RS_NDet < 5 || $RS_NDet > 1800);
-$error .= "Raysum NRot must be between 5 and 2048<br>" if ($RS_NRot < 5 || $RS_NRot > 2048);
-$error .= "Raysum RotAngle must be between 0.1 and 2<br>" if ($RS_RotAngle < 0.1 || $RS_RotAngle > 2);
-
-#my $IR_Nx = FilterToNumber($in{'IR_Nx'});
-#my $IR_Ny = FilterToNumber($in{'IR_Ny'});
-my $IR_Nx = $Phantom_Nx;
-my $IR_Ny = $Phantom_Ny;
-my $IR_Filter = FilterMetaChars($in{'IR_Filter'});
-my $IR_Filter_Param = FilterToNumber($in{'IR_Filter_Param'});
-my $IR_Interp = FilterMetaChars($in{'IR_Interp'});
-my $IR_Backproj = FilterMetaChars($in{'IR_Backproj'});
-
-my $Disp_Min = "auto";
-my $Disp_Max = "auto";
-$Disp_Min = FilterToNumber($in{'Disp_Min'}) if ($in{'Disp_Min'} ne "auto" && $in{'Disp_Min'} ne "");
-$Disp_Max = FilterToNumber($in{'Disp_Max'}) if ($in{'Disp_Max'} ne "auto" && $in{'Disp_Max'} ne "");
-if ($Disp_Min ne 'auto' && ! ($Disp_Min =~ /^[\d\.]+$/)) {
-    $error .= "Display Minimum must be 'auto' or numeric (received '$Disp_Min') <br>";
-}
-if ($Disp_Max ne 'auto' && ! ($Disp_Max =~ /^[\d\.]+$/)) {
-    $error .= "Display Maximum must be 'auto' or numeric (received '$Disp_Max') <br>";
-}
-
-my $MPI_Str = FilterMetaChars($in{'MPI'});
-my $MPI = 0;
-$MPI = 1 if ($MPI_Str eq "yes" && $::mpi_enable ne "");
-
-$error .= "IR Nx and Ny must be between 5 and 1024<br>" if ($IR_Nx < 5 || $IR_Nx > 1024 || $IR_Ny < 5 || $IR_Ny > 1024);
-$error .= "IR Filter Parameter must be between 0 and 1<br>" if ($IR_Filter_Param < 0 || $IR_Filter_Param > 1);
-
-
-my $tmpid = $$;
-my $auto_window_img = "std0.1";
-my $auto_window_diff = "std1";
-my $auto_window_rs = "full";
-my $logfile = "$::jobdir/ctsim.log";
-
-my $result_fname = "$::datadir/result-$tmpid.html";
-my $phantom_fname = "$::datadir/phantom-$tmpid.sdf";
-my $rs_fname = "$::datadir/rs-$tmpid.rs";
-my $ir_fname = "$::datadir/ir-$tmpid.sdf";
-my $rs_sdf_fname = "$::datadir/rs-$tmpid.sdf";
-my $diff_fname = "$::datadir/diff-$tmpid.sdf";
-my $phantom_png = "$::datadir/phantom-$tmpid.png";
-my $ir_png = "$::datadir/ir-$tmpid.png";
-my $rs_png = "$::datadir/rs-$tmpid.png";
-my $diff_png = "$::datadir/diff-$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 $rs_png_url = "$::url_datadir/rs-$tmpid.png";
-my $diff_png_url = "$::url_datadir/diff-$tmpid.png";
-
-my $ctrec_ver = "$::bindir/ctrec";
-my $phm2rs_ver = "$::bindir/phm2rs";
-my $phm2sdf_ver = "$::bindir/phm2sdf";
-my $diff_ver = "$::bindir/sdf-2";
-$ctrec_ver = "/opt/lam/bin/mpirun N N $::bindir/ctrec-lam" if $MPI;
-$phm2rs_ver = "/opt/lam/bin/mpirun N N $::bindir/phm2rs-lam" if $MPI;
-$phm2sdf_ver = "/opt/lam/bin/mpirun N N $::bindir/phm2sdf-lam" if $MPI;
-
-my $gp_cmd = "$phm2sdf_ver $phantom_fname $Phantom_Nx $Phantom_Ny --phantom $Phantom_Name --nsample $Phantom_NSample";
-my $rs_cmd = "$phm2rs_ver $rs_fname $RS_NDet $RS_NRot --phantom $Phantom_Name --nray $RS_NRay --rotangle $RS_RotAngle";
-my $rs_sdf_cmd = "$::bindir/rs2sdf $rs_fname $rs_sdf_fname";
-my $ir_cmd = "$ctrec_ver $rs_fname $ir_fname $IR_Nx $IR_Ny --filter $IR_Filter --filter-param $IR_Filter_Param --interp $IR_Interp --backproj $IR_Backproj";
-my $diff_cmd = "$diff_ver $phantom_fname $ir_fname $diff_fname --comp";
-
-my $window_options = "--auto $auto_window_img";
-if ($Disp_Min ne 'auto') {
-    $window_options .= " --min $Disp_Min";
-}
-if ($Disp_Max ne 'auto') {
-    $window_options .= " --max $Disp_Max";
-}
-
-my $png1_cmd = "$::bindir/sdf2img $phantom_fname $phantom_png $window_options --stats --format png";
-my $png2_cmd = "$::bindir/sdf2img $ir_fname $ir_png $window_options --stats --format png";
-my $png3_cmd = "$::bindir/sdf2img $rs_sdf_fname $rs_png --auto $auto_window_rs --stats --format png";
-my $png4_cmd = "$::bindir/sdf2img $diff_fname $diff_png --auto $auto_window_diff --stats --format png";
-
-my $title = "CT Simulation Results";
-
-my $out = head();
-$out .= "<HTML> <HEAD><TITLE> $title </TITLE></HEAD>\n";
-$out .= "<BODY  BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"  VLINK=\"#800020\" LINK=\"#0000FF\">\n";
-$out .= "<H1>$title</H1><HR>\n";
-
-if ($opt_d) {
-    $out .= "<H2>Commands</H2>\n";
-    $out .= "$gp_cmd<br>\n$rs_cmd<br>\n$rs_sdf_cmd<br>\n$ir_cmd<br>\n$diff_cmd<br>\n$png1_cmd<br>\n$png2_cmd<br>\n" .
-            "$png3_cmd<br>\n$png4_cmd<br>\n";
-}
-
-my $cmdout = "";
-if ($error ne "") {
-    $out .= "<FONT COLOR=\"#FF0000\">The following errors were present in your request.<br>\n";
-    $out .= "Please correct them and try submitting your request again.</FONT><br>\n";
-    $out .= "<i>$error</i>";
-} else {
-    my $gp_out;
-    my $rs_out;
-    my $rs_sdf_out;
-    my $ir_out;
-    my $diff_out;
-    my $png_gp_out;
-    my $png_ir_out;
-    my $png_rs_out;
-    my $png_diff_out;
-    if (1) {
-       $gp_out = `$gp_cmd`;
-       $rs_out .= `$rs_cmd`;
-       $rs_sdf_out .= `$rs_sdf_cmd`;
-       $ir_out .= `$ir_cmd`;
-       $diff_out .= `$diff_cmd`;
-       $png_gp_out .= `$png1_cmd`;
-       $png_ir_out .= `$png2_cmd`;
-       $png_rs_out .= `$png3_cmd`;
-       $png_diff_out .= `$png4_cmd`;
-    } else {
-       $gp_out = `$gp_cmd 2>&1`;
-       $rs_out .= `$rs_cmd 2>&1`;
-       $rs_sdf_out .= `$rs_sdf_cmd 2>&1`;
-       $ir_out .= `$ir_cmd 2>&1`;
-       $diff_out .= `$diff_cmd 2>&1`;
-       $png_gp_out .= `$png1_cmd 2>&1`;
-       $png_ir_out .= `$png2_cmd 2>&1`;
-       $png_rs_out .= `$png3_cmd 2>&1`;
-       $png_diff_out .= `$png4_cmd 2>&1`;
-    }
-    $cmdout = "$gp_cmd\n $gp_out $rs_cmd\n $rs_out $rs_sdf_cmd\n $rs_sdf_out $ir_cmd\n $ir_out $diff_cmd\n $diff_out $png1_cmd\n $png_gp_out $png2_cmd\n $png_ir_out $png3_cmd\n $png_rs_out $png4_cmd\n $png_diff_out";
-    if (open(LOGFILE,">> $logfile")) {
-       flock(LOGFILE,LOCK_EX);
-       seek(LOGFILE, 0, 2);
-       print LOGFILE "Job $tmpid\n";
-       print LOGFILE $cmdout;
-       print LOGFILE "----------------------------------------------------\n";
-       flock(LOGFILE,LOCK_UN);
-       close(LOGFILE);
-    }
-    $gmt_end = time();
-    $execution_time = $gmt_end - $gmt_start;
-    if ($opt_d)
-    {
-       $out .= "<H3>Command Output</H3>$cmdout<HR>\n";
-    }
-    my $png_gp_out_html = $png_gp_out;
-    my $png_ir_out_html = $png_ir_out;
-    my $png_rs_out_html = $png_rs_out;
-    my $png_diff_out_html = $png_diff_out;
-    $png_gp_out_html =~ s/\n/<br>/gms;
-    $png_ir_out_html =~ s/\n/<br>/gms;
-    $png_rs_out_html =~ s/\n/<br>/gms;
-    $png_diff_out_html =~ s/\n/<br>/gms;
-    $out .= "<TABLE><TR><TD>Phantom Image</TD><TD>Reconstructed Image</TD></TR>\n";
-    $out .= "<TR><TD><IMG SRC=\"$phantom_png_url\"><br><FONT SIZE=1>$png_gp_out</FONT></TD>\n";
-    $out .= "<TD><IMG SRC=\"$ir_png_url\"><br><FONT SIZE=1>$png_ir_out</FONT></TD></TR>\n";
-    $out .= "<TR><TD>Raysum Sinusoid</TD><TD>Phantom/Reconst Error</TD></TR>\n";
-    $out .= "<TR><TD><IMG SRC=\"$rs_png_url\"><br><FONT SIZE=1>$png_rs_out</FONT></TD>\n";
-    $out .= "<TD><IMG SRC=\"$diff_png_url\"><br><FONT SIZE=2>$diff_out</FONT><br><FONT SIZE=1>$png_diff_out</FONT></TD></TR>\n";
-    $out .= "</TABLE>";
-    $out .= "Execution time: $execution_time seconds\n";
-}
-
-$out .= "<HR>\n";
-$out .= "Return to <A HREF=\"/ctsim/index.html\">CT Simulation Designer</a>.<br>\n";
-$out .= "Return to <A HREF=\"www.med-info.com\">Med-Info</a>.\n";
-$out .= "</BODY> </HTML>";
-$out .= "\n";
-
-if (open(OUTFILE,"> $result_fname"))
-{
-    flock(OUTFILE,LOCK_EX);
-    print OUTFILE $out;
-    flock(OUTFILE,LOCK_UN);
-    close OUTFILE;
-    print "Location: $result_url\n\n";
-}
-else
-{
-    print "Content-type: text/plain\n\n";
-    print "The simulator was unable to create an result file.\n";
-}
-if (open(JOBFILES,"> $::jobdir/$tmpid"))
-{
-    flock(JOBFILES,LOCK_EX);
-    print JOBFILES "gmt_start=$gmt_start\n";
-    print JOBFILES "gmt_end=$gmt_end\n";
-    print JOBFILES "execution_time=$execution_time\n";
-    print JOBFILES "Phantom_Name=$Phantom_Name\n";
-    print JOBFILES "Phantom_Nx=$Phantom_Nx\n";
-    print JOBFILES "Phantom_Ny=$Phantom_Nx\n";
-    print JOBFILES "Phantom_NSample=$Phantom_NSample\n";
-    print JOBFILES "RS_NDet=$RS_NDet\n";
-    print JOBFILES "RS_NRot=$RS_NRot\n";
-    print JOBFILES "RS_NRay=$RS_NRay\n";
-    print JOBFILES "RS_RotAngle=$RS_RotAngle\n";
-    print JOBFILES "IR_Nx=$IR_Nx\n";
-    print JOBFILES "IR_Ny=$IR_Ny\n";
-    print JOBFILES "IR_Interp=$IR_Interp\n";
-    print JOBFILES "IR_Filter=$IR_Filter\n";
-    print JOBFILES "IR_Filter_Param=$IR_Filter_Param\n";
-    print JOBFILES "IR_Backproj=$IR_Backproj\n";
-    print JOBFILES "Disp_Min=$Disp_Min\n";
-    print JOBFILES "Disp_Max=$Disp_Max\n";
-    print JOBFILES "MPI=$MPI\n";
-    print JOBFILES "Files=$result_fname,$phantom_fname,$rs_fname,$ir_fname,$phantom_png,$ir_png,$rs_sdf_fname,$rs_png\n" if ($error eq "");
-    printf JOBFILES "cmdout=$cmdout\n";
-    flock(JOBFILES,LOCK_UN);
-    close JOBFILES;
-}
-
-
-exit;
-
-
-sub internal_error
-{
-  my $out = head();
-  $out .= "<H1>Internal error</H1>
-  Please notify <A HREF=mailto:webmaster\@med-info.com>webmaster\@med-info.com</A>
-  </BODY>";
-  print $out;
-  exit;
-}
-
-sub head
-{
-#  "Content: text/html\n\n";
-}
-
-
-sub FilterMetaChars
-{
-   my $var = pop(@_);
-   $var =~ /^(\w+)$/;  
-   $1;
-}
-
-sub FilterToNumber
-{
-   my $var = pop(@_);
-   $var =~ /^(\d*\.*\d*)$/;  
-   $1;
-}
diff --git a/cgi-bin/ctsim.conf.in b/cgi-bin/ctsim.conf.in
new file mode 100755 (executable)
index 0000000..e0d5977
--- /dev/null
@@ -0,0 +1,7 @@
+# @configure_input@
+
+$::bindir = "@prefix@/bin";
+$::jobdir = "@webdatadir@";
+$::datadir = "@webdatadir@";
+$::url_datadir = "@webdataurl@";
+$::mpi_enable = "@mpienable@";
diff --git a/html/ctsim.html b/html/ctsim.html
deleted file mode 100644 (file)
index e013614..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Perform CT Simulation</TITLE>
-</HEAD>
-<BODY BGCOLOR="#FFFFFF">
-<H1>Perform CT Simulation</H1>
-<FORM action="/cgi-bin/ctsim.cgi" method="POST">
-<table border=1 cellpadding="5" bgcolor="#FFFFFF">
-<tr><td valign="top">
-<h3>Select Image and Size</h3>
-Phantom Name:<br>
-<INPUT type="radio" name="Phantom_Name" value="herman" checked>G.T. Herman<br>
-<INPUT type="radio" name="Phantom_Name" value="rowland">Rowland<br>
-<INPUT type="radio" name="Phantom_Name" value="browland">Bordered Rowland<br>
-<INPUT type="radio" name="Phantom_Name" value="unitpulse">Unit Pulse<br>
-<p>
-Nx: <input type="text" name="Phantom_Nx" size="4" value="256"><br>
-Ny: <input type="text" name="Phantom_Ny" size="4" value="256"><br>
-<p>
-Number of Samples<br>per pixel: <input type="text" name="Phantom_NSample" size="2" value="1"><br>
-<p>
-Display Window:<br>
-Minium: <input type="text" name="Disp_Min" size=5 value="auto"><br>
-Maximum: <input type="text" name="Disp_Max" size=5 value="auto"><br>
-<p> 
-MPI Supercomputing:<br>
-<INPUT type="radio" name="MPI" value="yes">Yes (Multiple CPUs)<br>
-<INPUT type="radio" name="MPI" value="no" checked>No (Single CPU)<br>
-</td><td valign="top">
-<h3>Simulate X-Ray acquistion</h3>
-Number of detectors: <input type="text" name="RS_NDet" size="4" value="367"><p>
-Number of Rotations: <input type="text" name="RS_NRot" size="4" value="320"><p>
-Number of Rays<br>(samples) per detector: <input type="text" name="RS_NRay" size="2" value="1"><p>
-Rotation Angle<br>as a multiple of PI: <input type="text" name="RS_RotAngle" size="3" value="1.0"><br>
-</td><td valign="top">
-<H3>Image Reconstruction</H3>
-Interpolation:<br>
-<input type="radio" name="IR_Interp" value="linear" checked>Linear<br>
-<input type="radio" name="IR_Interp" value="nearest">Nearest Neighbor<br>
-<input type="radio" name="IR_Interp" value="bspline">B-Spline<br>
-<p>
-Filter for Backprojection:<br>
-<input type="radio" name="IR_Filter" value="abs_bandlimit" checked>Abs*Bandlimit<br>
-<input type="radio" name="IR_Filter" value="abs_cos">Abs*Cosine<br>
-<input type="radio" name="IR_Filter" value="abs_hamming">Abs*Hamming<br>
-<input type="radio" name="IR_Filter" value="shepp">Shepp-Logan<br>
-<input type="radio" name="IR_Filter" value="bandlimit">Bandlimit<br>
-<input type="radio" name="IR_Filter" value="hamming">Hamming<br>
-<input type="radio" name="IR_Filter" value="cos">Cosine<br>
-<input type="radio" name="IR_Filter" value="sinc">Sinc<br>
-<input type="radio" name="IR_Filter" value="triangle">Triangle<p>
-Hamming alpha factor (0.0-1.0): <input type="text" name="IR_Filter_Param" size="3" value="1.0"><p>
-Backprojection Method:<br>
-<input type="radio" name="IR_Backproj" value="trig">Trig<br>
-<input type="radio" name="IR_Backproj" value="table">Trig Table<br>
-<input type="radio" name="IR_Backproj" value="diff">Difference<br>
-<input type="radio" name="IR_Backproj" value="diff2" checked>Difference Optimized<br>
-<input type="radio" name="IR_Backproj" value="idiff2">Difference Optimized (integer math)<br>
-</td></tr></table>
-<p>
-<input type="submit" value="Simulate"><input type="reset" value="clear fields">
-</form>
-</BODY>
-</HTML>
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/sample-ctrec.sh b/src/sample-ctrec.sh
deleted file mode 100644 (file)
index 5daa07e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-bin="/opt/ctsim/bin/"
-
-# Generate phantom image
-
-${bin}phm2sdf sample-phm.sdf 256 256 --nsample 2
-${bin}sdf2img sample-phm.sdf sample-phm.png --format png
-
-# Simulate CT data collection and generate raysum sinugram for display
-${bin}phm2rs  sample-rs.rs 367 320 --nray 2 
-${bin}rs2sdf  sample-rs.rs sample-rs.sdf
-${bin}sdf2img sample-rs.sdf sample-rs.png --format png
-
-# Reconstruct raysums and generate image for display
-${bin}ctrec   sample-rs.rs sample-rec.sdf 256 256 
-${bin}sdf2img sample-rec.sdf sample-rec.png --format png
-
-# Files sample-phm.png, sample-rs.png, and sample-rec.png are ready for display