X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=cgi-bin%2Fctsim.cgi.in;h=660ac60b504445ad9182d9db2427424b2b6030c4;hb=f24b761bf648dd317adae95ecdee6587e41bffe2;hp=ac31936d15c0bc42d68b9b54d0698e33fd9abfeb;hpb=d0628f1ae00136e2202a614917f52a2b0655df70;p=ctsim.git
diff --git a/cgi-bin/ctsim.cgi.in b/cgi-bin/ctsim.cgi.in
index ac31936..660ac60 100755
--- a/cgi-bin/ctsim.cgi.in
+++ b/cgi-bin/ctsim.cgi.in
@@ -9,7 +9,7 @@ use Fcntl ':flock';
require './ctsim.conf';
my $opt_d = 0;
-$ENV{'PATH'} = $::bindir;
+$ENV{'PATH'} = "$::bindir:$::lamrundir";
my $fromhost = $ENV{'REMOTE_HOST'};
@@ -56,16 +56,16 @@ 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')
";
+if ($Disp_Min ne 'auto' && ! ($Disp_Min =~ /^[\d\.\-]+$/)) {
+ $error .= "Display Minimum must be 'auto' or numeric (received $Disp_Min)
";
}
-if ($Disp_Max ne 'auto' && ! ($Disp_Max =~ /^[\d\.]+$/)) {
- $error .= "Display Maximum must be 'auto' or numeric (received '$Disp_Max')
";
+if ($Disp_Max ne 'auto' && ! ($Disp_Max =~ /^[\d\.\-]+$/)) {
+ $error .= "Display Maximum must be 'auto' or numeric (received $Disp_Max)
";
}
my $MPI_Str = FilterMetaChars($in{'MPI'});
my $MPI = 0;
-$MPI = 1 if ($MPI_Str eq "yes");
+$MPI = 1 if ($MPI_Str eq "yes" && $::mpi_enable ne "");
$error .= "IR Nx and Ny must be between 5 and 1024
" if ($IR_Nx < 5 || $IR_Nx > 1024 || $IR_Ny < 5 || $IR_Ny > 1024);
$error .= "IR Filter Parameter must be between 0 and 1
" if ($IR_Filter_Param < 0 || $IR_Filter_Param > 1);
@@ -98,9 +98,9 @@ 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;
+$ctrec_ver = "/opt/lam/bin/mpirun N N $::lamrundir/ctrec-lam" if $MPI;
+$phm2rs_ver = "/opt/lam/bin/mpirun N N $::lamrundir/phm2rs-lam" if $MPI;
+$phm2sdf_ver = "/opt/lam/bin/mpirun N N $::lamrundir/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";
@@ -140,68 +140,62 @@ if ($error ne "") {
$out .= "Please correct them and try submitting your request again.
\n";
$out .= "$error";
} 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`;
+ 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;
+ $gp_out = `$gp_cmd`;
+ if (-s $phantom_fname) {
+ $rs_out .= `$rs_cmd`;
+ $png_gp_out .= `$png1_cmd`;
+ if (-s $rs_fname) {
+ $rs_sdf_out .= `$rs_sdf_cmd`;
+ $png_rs_out .= `$png3_cmd`;
+ $ir_out .= `$ir_cmd`;
+ if (-s $ir_fname) {
$png_ir_out .= `$png2_cmd`;
- $png_rs_out .= `$png3_cmd`;
+ $diff_out .= `$diff_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 .= "
Phantom Image | Reconstructed Image |
$png_gp_out | \n";
- $out .= "$png_ir_out |
Raysum Sinusoid | Phantom/Reconst Error |
$png_rs_out | \n";
- $out .= "$diff_out $png_diff_out |
Phantom Image | Reconstructed Image |
$png_gp_out | \n";
+ $out .= "$png_ir_out |
Raysum Sinusoid | Phantom/Reconst Error |
$png_rs_out | \n";
+ $out .= "$diff_out $png_diff_out |