X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=cgi-bin%2Fctsim.cgi.in;h=6b0da4833601b1a57a6bf13482e72ddb62430a0f;hb=2ab37d1cdf6caa543510f370cbeb3749d0d61fe0;hp=4a2824ffeabf3c37991c6b1db235a7bd967636b5;hpb=bde04020170bb0a7e49d433b10098db7becbac5f;p=ctsim.git diff --git a/cgi-bin/ctsim.cgi.in b/cgi-bin/ctsim.cgi.in index 4a2824f..6b0da48 100755 --- a/cgi-bin/ctsim.cgi.in +++ b/cgi-bin/ctsim.cgi.in @@ -78,11 +78,11 @@ 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 $phantom_fname = "$::datadir/phantom-$tmpid.if"; 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 $ir_fname = "$::datadir/ir-$tmpid.if"; +my $rs_if_fname = "$::datadir/rs-$tmpid.if"; +my $diff_fname = "$::datadir/diff-$tmpid.if"; my $phantom_png = "$::datadir/phantom-$tmpid.png"; my $ir_png = "$::datadir/ir-$tmpid.png"; my $rs_png = "$::datadir/rs-$tmpid.png"; @@ -96,15 +96,15 @@ 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"; +my $phm2if_ver = "$::bindir/phm2if"; +my $diff_ver = "$::bindir/if-2"; $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; +$phm2if_ver = "/opt/lam/bin/mpirun N N $::lamrundir/phm2if-lam" if $MPI; -my $gp_cmd = "$phm2sdf_ver $phantom_fname $Phantom_Nx $Phantom_Ny --phantom $Phantom_Name --nsample $Phantom_NSample"; +my $gp_cmd = "$phm2if_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 $rs_if_cmd = "$::bindir/rs2if $rs_fname $rs_if_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"; @@ -116,10 +116,10 @@ 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 $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 $rs_if_fname $rs_png --auto $auto_window_rs --stats --format png"; +my $png4_cmd = "$::bindir/if2img $diff_fname $diff_png --auto $auto_window_diff --stats --format png"; my $title = "CT Simulation Results"; @@ -130,7 +130,7 @@ $out .= "

$title


\n"; if ($opt_d) { $out .= "

Commands

\n"; - $out .= "$gp_cmd
\n$rs_cmd
\n$rs_sdf_cmd
\n$ir_cmd
\n$diff_cmd
\n$png1_cmd
\n$png2_cmd
\n" . + $out .= "$gp_cmd
\n$rs_cmd
\n$rs_if_cmd
\n$ir_cmd
\n$diff_cmd
\n$png1_cmd
\n$png2_cmd
\n" . "$png3_cmd
\n$png4_cmd
\n"; } @@ -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_if_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_if_out .= `$rs_if_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 .= "

Command Output

$cmdout
\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/
/gms; - $png_ir_out_html =~ s/\n/
/gms; - $png_rs_out_html =~ s/\n/
/gms; - $png_diff_out_html =~ s/\n/
/gms; - $out .= "\n"; - $out .= "\n"; - $out .= "\n"; - $out .= "\n"; - $out .= "\n"; - $out .= "\n"; - $out .= "
Phantom ImageReconstructed Image

$png_gp_out

$png_ir_out
Raysum SinusoidPhantom/Reconst Error

$png_rs_out

$diff_out
$png_diff_out
"; - $out .= "Execution time: $execution_time seconds\n"; + } + + $cmdout = "$gp_cmd\n $gp_out $rs_cmd\n $rs_out $rs_if_cmd\n $rs_if_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 .= "

Command Output

$cmdout
\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/
/gms; + $png_ir_out_html =~ s/\n/
/gms; + $png_rs_out_html =~ s/\n/
/gms; + $png_diff_out_html =~ s/\n/
/gms; + $out .= "\n"; + $out .= "\n"; + $out .= "\n"; + $out .= "\n"; + $out .= "\n"; + $out .= "\n"; + $out .= "
Phantom ImageReconstructed Image

$png_gp_out

$png_ir_out
Raysum SinusoidPhantom/Reconst Error

$png_rs_out

$diff_out
$png_diff_out
"; + $out .= "Execution time: $execution_time seconds\n"; } $out .= "
\n"; @@ -246,7 +240,7 @@ if (open(JOBFILES,"> $::jobdir/$tmpid")) 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 ""); + print JOBFILES "Files=$result_fname,$phantom_fname,$rs_fname,$ir_fname,$phantom_png,$ir_png,$rs_if_fname,$rs_png\n" if ($error eq ""); printf JOBFILES "cmdout=$cmdout\n"; flock(JOBFILES,LOCK_UN); close JOBFILES;