"); echo ("PET Web Image Conversion Tool ... imgsearch.php3 v1.1"); echo (""); echo ("
"); echo ("
"); echo ("

PET Web Image Conversion Results
$sPN   ($sLN)   $sSD

"); echo ("
"); // check for a valid selections for file and conversion type if (file_exists($image) && $ctype) { // valid selections message echo ("

Conversion Operation Complete ... Check Status Below.

"); } else { // invalid selections message echo ("

"); echo ("
"); echo ("A file and/or a conversion format were NOT
"); echo ("selected on the previous page ... you should
"); echo ("use your browser's BACK button to return
"); echo ("and select a file and a conversion format."); echo ("
"); echo (""); echo ("
"); echo ("
"); echo ("

"); exit; } echo (""); // end of headline 3 // initialize reslicing options (opt0) switch ($reslice) { case "coronal": $opt0 = "-cor"; break; case "sagittal": $opt0 = "-sag"; break; case "transverse": $opt0 = "-tra"; break; default: $opt0 = ""; break; } // initialize medcon conversion options (ifmt,opt1,opt2,opt3,opt4) // and print description to screen echo ("
"); switch ($ctype) { case "gifp": echo ("

Gif/PNG converison produces .gif and .png files

"); $ifmt = "gif"; switch ($gpjoption) { case "grayscale": $opt1 = ""; $opt2 = "black"; $opt3 = "white"; $opt4 = "-gray"; break; case "inverse": $opt1 = "-mi"; $opt2 = "white"; $opt3 = "black"; $opt4 = "-inv"; break; case "rainbow": $opt1 = "-mr"; $opt2 = "black"; $opt3 = "white"; $opt4 = "-rainbow"; break; case "gray/rainbow": $opt1 = "-mc"; $opt2 = "black"; $opt3 = "white"; $opt4 = "-combo"; break; case "hotmetal": $opt1 = "-mh"; $opt2 = "black"; $opt3 = "white"; $opt4 = "-hotmetal"; break; } break; case "gifj": echo ("

Gif/Jpeg converison produces .gif and .jpg files

"); $ifmt = "gif"; switch ($gpjoption) { case "grayscale": $opt1 = ""; $opt2 = "black"; $opt3 = "white"; $opt4 = "-gray"; break; case "inverse": $opt1 = "-mi"; $opt2 = "white"; $opt3 = "black"; $opt4 = "-inv"; break; case "rainbow": $opt1 = "-mr"; $opt2 = "black"; $opt3 = "white"; $opt4 = "-rainbow"; break; case "gray/rainbow": $opt1 = "-mc"; $opt2 = "black"; $opt3 = "white"; $opt4 = "-combo"; break; case "hotmetal": $opt1 = "-mh"; $opt2 = "black"; $opt3 = "white"; $opt4 = "-hotmetal"; break; } break; case "dicom": echo ("

Conversion to Dicom produces a .dcm file

"); $ifmt = "dicom"; $opt1 = ""; $opt2 = ""; $opt3 = ""; $opt4 = ""; break; case "anlz": echo ("

Conversion to Analyze produces .hdr and .img files

"); $ifmt = "anlz"; $opt1 = ""; $opt2 = ""; $opt3 = ""; $opt4 = ""; break; case "anlzspm": echo ("

Conversion to Analyze (SPM) produces a .hdr and .img files

"); $ifmt = "anlz"; $opt1 = "-ar"; $opt2 = ""; $opt3 = ""; $opt4 = ""; break; } // setup a few variables $imgDir = sprintf("%s/",dirname($image)); $imgFile = basename($image); $imgExt = strrchr($imgFile,'.'); // get file extension (.img or .wbp) $imgTExt = str_replace('.','',$imgExt); // chop of . from extension $imgRoot = str_replace($imgExt,'',$imgFile); // turn off reslicing if projection file or resliced with hearttool if (strrchr($imgFile,'wbp') || strrchr($imgFile,'_sa') || strrchr($imgFile,'_hla') || strrchr($imgFile,'_vla')) $opt0 = ""; $imgDRoot = sprintf("%s-%s",$imgRoot,$imgTExt); // setup Display root $imgNRoot = sprintf("%s-%s%s%s-%d",$imgRoot,$imgTExt,$opt0,$opt4,time()); $imgType = ("$ctype"); // change to the directory and use medcon for the conversion chdir("$imgDir"); echo ("

"); // execute medcon as console command as user "nobody" passthru("medcon -qc -nf -big -noprefix -g -o $imgNRoot $opt0 $opt1 -c $ifmt -f $imgFile"); // if gifp, process it with convert & create png montage if ($ctype == "gifp") { $imgNFile = sprintf("%s.gif",$imgNRoot); //new gif file name $imgPFile = sprintf("%s.png",$imgNRoot); //new png file name $imgTFile = sprintf("%d.gif",time()); //tmp gif file name if (file_exists($imgNFile)) { // create a temporary copy of gif animation file passthru("mv $imgNFile $imgTFile"); // create new zoomed cine gif file passthru("convert -geometry 172x344 $imgTFile $imgNFile"); // create png montage file passthru("montage -quality 100 +frame +shadow -label \"%s\" -geometry +0+5 -tile 5x512 -background $opt2 -pen $opt3 -title \"$sPN \($sLN\) $sSD\" -pointsize 16 $imgNFile $imgPFile; rm -f $imgTFile"); } } // if gifj, process it with convert & create jpeg montage if ($ctype == "gifj") { $imgNFile = sprintf("%s.gif",$imgNRoot); //new gif file name $imgJFile = sprintf("%s.jpg",$imgNRoot); //new jpg file name $imgTFile = sprintf("%d.gif",time()); //tmp gif file name if (file_exists($imgNFile)) { // create a temporary copy of gif animation file passthru("mv $imgNFile $imgTFile"); // create new zoomed cine gif file passthru("convert -geometry 172x344 $imgTFile $imgNFile"); // create jpeg montage file passthru("montage -quality 100 +frame +shadow -label \"%s\" -geometry +0+5 -tile 5x512 -background $opt2 -pen $opt3 -title \"$sPN \($sLN\) $sSD\" -pointsize 16 $imgNFile $imgJFile; rm -f $imgTFile"); } } echo ("

"); echo ("
"); // start form and link to next script (imgdelete.php3) echo ("
"); $dir = opendir("."); echo (""); while ($file=readdir($dir)) { // limit display to medcon files " if (eregi("$imgDRoot",$file)) { // create full path name $imgfullpath = sprintf("%s%s",$imgDir,$file); echo (""); echo (""); } } echo ("
"); // store full path name in deletelist array echo (""); echo (""); // create hyperlink for downloading of this new file echo ("$file"); echo (""); // print size of file in bytes printf("%s%d%s","................(",filesize($imgfullpath)," Bytes)"); echo ("
"); closedir($dir); // calculate and display approximate processing time echo ("
"); printf ("Approximate conversion time : %d seconds",(time() - $startTime)); echo ("
"); // complete form options echo ("
"); echo (""); echo ("   "); echo (""); echo ("
"); echo ("
"); // store patient name and last 4 as hidden variables for next script echo (""); echo (""); echo (""); echo ("
"); // end of form echo ("
"); // end of php3 script ?>