#!/bin/csh # if ($#argv < 1) then set prgm = $0 # program name set vn = 1.0 # version number set rd = "5/8/2000" # last revision date echo " " echo " $prgm:t $vn ($rd)" echo " " echo " This program converts ECAT image files (.img) to Dicom (.dcm)" echo " and pushes them to the Radiology AGFA PACS server. Multiple images" echo " files can be sent on the same patient. The Study Accession # " echo " (enter Case # 1234 on Jan 28, 2000 as 012800-1234) and the" echo " patient's Social Security # (enter SSN 123-45-6789 as 123456789)" echo " are needed to use this program." echo " " echo " PET images can be searched/viewed on the Radiology PACS WEB 1000" echo " viewer using PT as the modality. The images are best viewed with" echo " a magnification of 100%." echo " " echo " usage: $prgm:t " echo " " echo " i.e. $prgm:t p01000em1.img" echo " $prgm:t p01000*.img" echo " $prgm:t p01*.img" echo " " exit -1 endif # initialize a few variable set NumberOfFiles = 0 set PID = "" set SID = "" set AN = "" set SN = "1" set IN = "1" set Mo = "PT" # Modality equal PET ############################################### # Start of mainloop to process each file ############################################### foreach filename ( $* ) ############################################### # # only process img files set ext = $filename:e if ! ( $ext == "img" ) then goto end_of_main_loop endif if ! ( -e $filename) then echo " " echo " $filename not found \!\!\!" echo " " goto end_of_main_loop endif # set img = $filename set mdcm = m00-$filename:r.dcm set dcm = $filename:r.dcm # start_of_input: # echo " " echo " ********** Current file - $filename **********" echo " " echo " Patient ID : enter SSN 123-45-6789 as 123456789" echo -n " (default - $PID) --> " set resp = $< if !( $resp == "" ) then set PID = $resp endif # echo " " echo " Accession # : enter case # 1234 on 03/28/2000 as 032800-1234" echo -n " (default - $AN) --> " set resp = $< if !( $resp == "" ) then set AN = $resp endif set SID = `echo $img:r | awk '{print substr($1,2,5)}'` set SID = `echo $SID | sed 's/^[a-zA-Z]*//g'` #echo " " #echo " Study # : enter Study p01000em1.img as p01000" #echo -n " (default - $SID) --> " #set resp = $< #if !( $resp == "" ) then # set SID = $resp #endif echo " " echo " Processing $filename ... Please Wait\!\!\! " sleep 1 echo " " echo " Creating DICOM image : $img ---> $dcm" medcon -qs -nf -fb-ecat -c dicom -f $img dccp -ra PatientID "$PID" -ra StudyID "$SID" -ra ImageNumber "$IN" \ -ra SeriesNumber "$SN" -ra Modality "$Mo" -ra AccessionNumber "$AN" \ -ra MediaStorageSOPInstanceUID "0.0.0.0.1.0.0.0.$SID" \ -ra InstanceCreatorUID "0.0.0.0.1.0.0.0.$SID" \ -ra SOPInstanceUID "0.0.0.0.1.0.0.0.$SID" \ -ra StudyInstanceUID "0.0.0.0.2.0.$SID" \ -ra SeriesInstanceUID "0.0.0.0.3.0.$SID" \ -ra FrameOfReferenceUID "0.0.0.0.4.0.$SID" \ $mdcm $dcm if ($status != "0") then echo " " sleep 1 echo " Errors in data input value(s) above ... try again\!\!\!" sleep 1 goto start_of_input endif echo " " echo -n " Send DICOM Image to Radiology? (Y/n) " set resp = $< if ($resp == "y" || $resp == "Y" || $resp == "yes" || $resp == "YES" || $resp == "") then echo " " echo " Sending DICOM Image to Radiology PACS - AGFA IMPAX" echo " " send_image -q -a DICOM_TEST -c ARCHIVE radsun1 104 $dcm @ NumberOfFiles++ else # 2nd chance to send data echo " " echo -n " Last chance ... send DICOM Image to Radiology? (Y/n) " set resp = $< if ($resp == "y" || $resp == "Y" || $resp == "yes" || $resp == "YES" || $resp =="") then echo " " echo " Sending DICOM Image to Radiology PACS - AGFA IMPAX" echo " " send_image -q -a DICOM_TEST -c ARCHIVE radsun1 104 $dcm @ NumberOfFiles++ endif endif # remove dicom files unalias rm rm -r $mdcm $dcm alias 'rm -i' # end_of_main_loop: # ############################################### # End of mainloop to process each file ############################################### end ############################################### echo " " echo " Done ... $NumberOfFiles file(s) processed." echo " " exit 0 Author: Charles V. Brown, Jr., MD Email : charles@charlesbrown.com Vmail : 818-221-3142 Web : http://www.charlesbrown.com