Fix spelling mistake
[ctsim.git] / cgi-bin / ctsim.cgi.in
old mode 100755 (executable)
new mode 100644 (file)
index 4ead487..49d9435
@@ -41,10 +41,12 @@ if ($::single_process_only > 0) {
 my $Phantom_Name = FilterMetaChars($in{'Phantom_Name'});
 my $Phantom_Nx = FilterToNumber($in{'Phantom_Nx'});
 my $Phantom_Ny = FilterToNumber($in{'Phantom_Ny'});
+my $Phantom_ViewRatio = FilterToNumber($in{'Phantom_ViewRatio'});
 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 512<br>" if ($Phantom_Nx < 5 || $Phantom_Nx > 512 || $Phantom_Ny < 5 || $Phantom_Ny > 512);
+$error .= "Phantom Size must be between 5 and 512<br>" if ($Phantom_Nx < 5 || $Phantom_Nx > 512 || $Phantom_Ny < 5 || $Phantom_Ny > 512);
 $error .= "Phantom NSample must be between 1 and 5<br>" if ($Phantom_NSample < 1 || $Phantom_NSample > 5);
+$error .= "View Ratio must be between 0 and 100<br>" if ($Phantom_ViewRatio <= 0 || $Phantom_ViewRatio > 100);
 
 my $PJ_Geometry = FilterMetaChars($in{'PJ_Geometry'});
 my $PJ_NDet = FilterToNumber($in{'PJ_NDet'});
@@ -52,11 +54,13 @@ my $PJ_NRot = FilterToNumber($in{'PJ_NRot'});
 my $PJ_FocalLength = FilterToNumber($in{'PJ_FocalLength'});
 my $PJ_NRay = FilterToNumber($in{'PJ_NRay'});
 my $PJ_RotAngle = FilterToNumber($in{'PJ_RotAngle'});
+my $PJ_ScanRatio = FilterToNumber($in{'PJ_ScanRatio'});
 $error .= "Projection NDet must be between 5 and 1000<br>" if ($PJ_NDet < 5 || $PJ_NDet > 1000);
 $error .= "Projection NRot must be between 5 and 1000<br>" if ($PJ_NRot < 5 || $PJ_NRot > 1000);
 $error .= "Projection NRay must be between 1 and 5<br>" if ($PJ_NRay < 1 || $PJ_NRay > 5);
 $error .= "Projection RotAngle must be between 0.1 and 2<br>" if ($PJ_RotAngle < 0.1 || $PJ_RotAngle > 2);
 $error .= "Focal length must be between 1.01 and 10<b>" if ($PJ_FocalLength <= 1 || $PJ_FocalLength > 10);
+$error .= "Scan Ratio must be between 0 and 10<br>" if ($PJ_ScanRatio <= 0 || $PJ_ScanRatio > 10);
 
 #my $IR_Nx = FilterToNumber($in{'IR_Nx'});
 #my $IR_Ny = FilterToNumber($in{'IR_Ny'});
@@ -120,8 +124,8 @@ $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;
 $phm2if_ver = "/opt/lam/bin/mpirun N N $::lamrundir/phm2if-lam" if $MPI;
 
-my $gp_cmd = "$phm2if_ver $phantom_fname $Phantom_Nx $Phantom_Ny --phantom $Phantom_Name --nsample $Phantom_NSample";
-my $pj_cmd = "$phm2pj_ver $pj_fname $PJ_NDet $PJ_NRot --phantom $Phantom_Name --nray $PJ_NRay --rotangle $PJ_RotAngle --geometry $PJ_Geometry --focal-length $PJ_FocalLength";
+my $gp_cmd = "$phm2if_ver $phantom_fname $Phantom_Nx $Phantom_Ny --phantom $Phantom_Name --nsample $Phantom_NSample --view-ratio $Phantom_ViewRatio";
+my $pj_cmd = "$phm2pj_ver $pj_fname $PJ_NDet $PJ_NRot --phantom $Phantom_Name --nray $PJ_NRay --rotangle $PJ_RotAngle --geometry $PJ_Geometry --focal-length $PJ_FocalLength --view-ratio $Phantom_ViewRatio --scan-ratio $PJ_ScanRatio";
 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 $sub_cmd = "$diff_ver $phantom_fname $ir_fname $sub_fname --sub";
@@ -135,15 +139,16 @@ if ($Disp_Max ne 'auto') {
     $window_options .= " --max $Disp_Max";
 }
 
-my $png1_cmd = "$::bindir/ifexport $phantom_fname $phantom_png $window_options --stats --format png";
-my $png2_cmd = "$::bindir/ifexport $ir_fname $ir_png $window_options --stats --format png";
-my $png3_cmd = "$::bindir/ifexport $pj_if_fname $pj_png --auto $auto_window_pj --stats --format png";
-my $png4_cmd = "$::bindir/ifexport $sub_fname $sub_png --auto $auto_window_diff --stats --format png";
+my $png1_cmd = "$::bindir/ifexport $phantom_fname $phantom_png $window_options --stats --format png --center mode";
+my $png2_cmd = "$::bindir/ifexport $ir_fname $ir_png $window_options --stats --format png --center mode";
+my $png3_cmd = "$::bindir/ifexport $pj_if_fname $pj_png --auto $auto_window_pj --stats --format png --center mode";
+my $png4_cmd = "$::bindir/ifexport $sub_fname $sub_png --auto $auto_window_diff --stats --format png --center mode";
 
-my $title = "CT Simulation Results";
+my $title = "CTSim Results";
 
 my $out = head();
-$out .= "<HTML> <HEAD><TITLE> $title </TITLE></HEAD>\n";
+$out .= "<HTML> <HEAD><TITLE> $title </TITLE><LINK rel=\"stylesheet\" href=\"http://www.ctsim.org/main.css\" type=\"text/css\">
+</HEAD>\n";
 $out .= "<BODY  BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"  VLINK=\"#800020\" LINK=\"#0000FF\">\n";
 $out .= "<H1>$title</H1><HR>\n";
 
@@ -196,6 +201,7 @@ if ($error ne "") {
   if (open(LOGFILE,">> $logfile")) {
     flock(LOGFILE,LOCK_EX);
     seek(LOGFILE, 0, 2);
+    print LOGFILE "Client Address: $ENV{'REMOTE_ADDR'}\n";
     print LOGFILE "Job $tmpid\n";
     print LOGFILE $cmdout;
     print LOGFILE "----------------------------------------------------\n";
@@ -215,20 +221,21 @@ if ($error ne "") {
   $png_pjrec_out_html =~ s/\n/<br>/gms;
   $png_pj_out_html =~ s/\n/<br>/gms;
   $png_sub_out_html =~ s/\n/<br>/gms;
-  $out .= "<TABLE><TR><TD>Phantom Image</TD><TD>Reconstructed Image</TD></TR>\n";
+  $out .= "<TABLE><TR><TD><b>Phantom Image</b></TD><TD><b>Reconstructed Image</b></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_pjrec_out</FONT></TD></TR>\n";
-  $out .= "<TR><TD>Projection Sinusoid</TD><TD>Phantom/Reconst Error</TD></TR>\n";
+  $out .= "<TR><TD><b>Projection Sinogram</b></TD><TD><b>Reconstruction Error</b></TD></TR>\n";
   $out .= "<TR><TD><IMG SRC=\"$pj_png_url\"><br><FONT SIZE=1>$png_pj_out</FONT></TD>\n";
   $out .= "<TD><IMG SRC=\"$sub_png_url\"><br><FONT SIZE=2>$sub_out</FONT><br><FONT SIZE=1>$png_sub_out</FONT></TD></TR>\n";
   $out .= "</TABLE>";
-  $out .= "Execution time: $execution_time seconds\n";
-  $out .= "<p>\nStatistics<br>";
+  $out .= "<p><b>Error Measurements</b><br>";
   $out .= "$diff_out";
+  $out .= "<p>Execution time: $execution_time seconds\n";
 }
 
 $out .= "<HR>\n";
-$out .= "Return to <A HREF=\"http://www.ctsim.org\">CTSim</a>.<br>\n";
+$out .= "Specify another <a href=\"http://www.ctsim.org/simulate.shtml\">simulation</a>.<br>";
+$out .= "Return to CTSim's <A HREF=\"http://www.ctsim.org\">home</a>.<br>\n";
 $out .= "</BODY> </HTML>";
 $out .= "\n";
 
@@ -248,8 +255,6 @@ else
 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";
@@ -297,7 +302,7 @@ sub head
 sub FilterMetaChars
 {
    my $var = pop(@_);
-   $var =~ /^(\w+)$/;  
+   $var =~ /^([-\w]+)$/;  
    $1;
 }