X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=cgi-bin%2Fctsim.cgi.in;h=49d94357fc7bac7642dfb38a574dd28baac46ca0;hb=2bcc0bfa4a003570480d67b50ad0c7aecdd2e79e;hp=a497dd908502f1dcc3988137fc196b99161bf5b7;hpb=9c75a49d81caa44eb0397f60cc442ebab1738309;p=ctsim.git diff --git a/cgi-bin/ctsim.cgi.in b/cgi-bin/ctsim.cgi.in old mode 100755 new mode 100644 index a497dd9..49d9435 --- a/cgi-bin/ctsim.cgi.in +++ b/cgi-bin/ctsim.cgi.in @@ -28,35 +28,39 @@ CGI::ReadParse(\%in); my $error = ""; if ($::single_process_only > 0) { - my @processes = '/bin/ps -A'; + my @processes = `/bin/ps -A`; my $running = 0; - foreach $p (@processes) { - if ($p ~= /ctsimtext/) { - $running = 1; - break; - } - if ($running > 0) { - $error .= "Another online simulation is currently running.
Click your browser's Refresh button to resubmit your simulation \nStatistics Error Measurements Execution time: $execution_time seconds\n";
}
$out .= "
";
- exit(0);
+ foreach my $p (@processes) {
+ if ($p =~ m/ctsimtext/) {
+ $error .= "Another online simulation is currently running.
You may wait a moment and then click your browser's Refresh button to resubmit your simulation
";
+ last;
}
+ }
}
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
" if ($Phantom_Name eq "");
-$error .= "Phantom NX and NY must be between 5 and 512
" if ($Phantom_Nx < 5 || $Phantom_Nx > 512 || $Phantom_Ny < 5 || $Phantom_Ny > 512);
+$error .= "Phantom Size must be between 5 and 512
" if ($Phantom_Nx < 5 || $Phantom_Nx > 512 || $Phantom_Ny < 5 || $Phantom_Ny > 512);
$error .= "Phantom NSample must be between 1 and 5
" if ($Phantom_NSample < 1 || $Phantom_NSample > 5);
+$error .= "View Ratio must be between 0 and 100
" if ($Phantom_ViewRatio <= 0 || $Phantom_ViewRatio > 100);
+my $PJ_Geometry = FilterMetaChars($in{'PJ_Geometry'});
my $PJ_NDet = FilterToNumber($in{'PJ_NDet'});
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
" if ($PJ_NDet < 5 || $PJ_NDet > 1000);
$error .= "Projection NRot must be between 5 and 1000
" if ($PJ_NRot < 5 || $PJ_NRot > 1000);
$error .= "Projection NRay must be between 1 and 5
" if ($PJ_NRay < 1 || $PJ_NRay > 5);
$error .= "Projection RotAngle must be between 0.1 and 2
" if ($PJ_RotAngle < 0.1 || $PJ_RotAngle > 2);
+$error .= "Focal length must be between 1.01 and 10" if ($PJ_FocalLength <= 1 || $PJ_FocalLength > 10);
+$error .= "Scan Ratio must be between 0 and 10
" if ($PJ_ScanRatio <= 0 || $PJ_ScanRatio > 10);
#my $IR_Nx = FilterToNumber($in{'IR_Nx'});
#my $IR_Ny = FilterToNumber($in{'IR_Ny'});
@@ -111,17 +115,17 @@ my $ir_png_url = "$::url_datadir/ir-$tmpid.png";
my $pj_png_url = "$::url_datadir/pj-$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/if2";
+my $pjrec_ver = "$::bindir/ctsimtext pjrec";
+my $phm2pj_ver = "$::bindir/ctsimtext phm2pj";
+my $phm2if_ver = "$::bindir/ctsimtext phm2if";
+my $diff_ver = "$::bindir/ctsimtext if2";
$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";
+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 .= " $title
\n";
@@ -185,11 +190,18 @@ if ($error ne "") {
}
}
}
+ # Delete image files and projection files
+ unlink($phantom_fname);
+ unlink($ir_fname);
+ unlink($pj_fname);
+ unlink($pj_if_fname);
+ unlink($sub_fname);
$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);
+ print LOGFILE "Client Address: $ENV{'REMOTE_ADDR'}\n";
print LOGFILE "Job $tmpid\n";
print LOGFILE $cmdout;
print LOGFILE "----------------------------------------------------\n";
@@ -209,21 +221,21 @@ if ($error ne "") {
$png_pjrec_out_html =~ s/\n/
/gms;
$png_pj_out_html =~ s/\n/
/gms;
$png_sub_out_html =~ s/\n/
/gms;
- $out .= " \n";
+ $out .= "Phantom Image Reconstructed Image
";
- $out .= "Execution time: $execution_time seconds\n";
- $out .= " \n";
$out .= "Phantom Image Reconstructed Image \n";
- $out .= " \n";
$out .= "
$png_gp_out
$png_pjrec_out \n";
+ $out .= "Projection Sinusoid Phantom/Reconst Error \n";
$out .= "Projection Sinogram Reconstruction Error \n";
$out .= " \n";
$out .= "
$png_pj_out
$sub_out
$png_sub_out
";
+ $out .= "
";
$out .= "$diff_out";
+ $out .= "
\n";
-$out .= "Return to CT Simulation Designer.
\n";
-$out .= "Return to Med-Info.\n";
+$out .= "Specify another simulation.
";
+$out .= "Return to CTSim's home.
\n";
$out .= " ";
$out .= "\n";
@@ -243,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";
@@ -292,7 +302,7 @@ sub head
sub FilterMetaChars
{
my $var = pop(@_);
- $var =~ /^(\w+)$/;
+ $var =~ /^([-\w]+)$/;
$1;
}