MYSHELL XCOMM imselect -- get an image section from one frame and display in another XCOMM XCOMM Eric Mandel 6/22/98 XCOMM XCOMM initialize SAORD variables if ( $?SAORD_ROOT == 0 ) then setenv SAORD_ROOT HERE endif if ( -e ${SAORD_ROOT}/xpa1 ) then setenv XPA_VERSION 1 else setenv XPA_VERSION 2 endif if ( $?SAORD_BIN == 0 ) then setenv SAORD_BIN ${SAORD_ROOT}/bin.`${SAORD_ROOT}/getarch` endif if ( $?SAORD_TMPDIR == 0 ) then setenv SAORD_TMPDIR /tmp endif setenv SAORD_VERSION "`cat ${SAORD_ROOT}/VERSION`" XCOMM end of SAORD initialization XCOMM init variables set iframe=1 set oframe=2 set block=1 set x=-1 set y=-1 set title="SAOtng" XCOMM look for command line switches set n = 1 while ("$n" <= "$#argv") if ( "$argv[$n]" == "-echo" ) then set echo else if ( "$argv[$n]" == "-block" ) then @ n++ set block="$argv[$n]" else if ( "$argv[$n]" == "-help" ) then echo " " echo "imselect switches: -block -iframe -oframe -title -x -y" echo "The default is to extract the image from iframe 1 into oframe 2 at block 1," echo "using the x,y selected point of frame 1 for the new image center" echo " " exit(1) else if ( "$argv[$n]" == "-iframe" ) then @ n++ set iframe="$argv[$n]" else if ( "$argv[$n]" == "-oframe" ) then @ n++ set oframe="$argv[$n]" else if ( "$argv[$n]" == "-title" ) then @ n++ set title="$argv[$n]" else if ( "$argv[$n]" == "-x" ) then @ n++ set x="$argv[$n]" else if ( "$argv[$n]" == "-y" ) then @ n++ set y="$argv[$n]" else echo "ERROR: bad command-line option: $argv[$n]" exit(1) endif @ n++ end XCOMM probably best to have the title running if ( "`${SAORD_BIN}/xpaaccess $title`" != "yes" ) then echo "ERROR: cannot locate $title ... exiting ..." exit(1) endif XCOMM change to input auto frame echo "frame $iframe" | ${SAORD_BIN}/xpaset $title XCOMM get filename for that frame set autofile=`${SAORD_BIN}/xpaget $title image` XCOMM get x and y selection values (unless already set) if ( $x == -1 ) then set x=`${SAORD_BIN}/xpaget $title file '$x'` endif if ( $y == -1 ) then set y=`${SAORD_BIN}/xpaget $title file '$y'` endif XCOMM say what we are doing if ( ($x != 0) || ($y != 0) ) then echo "Extracting $autofile at $x $y using block $block in frame $oframe" else echo "Extracting $autofile at image center using block $block in frame $oframe" endif XCOMM now do it XCOMM change to title frame echo "frame $oframe" | ${SAORD_BIN}/xpaset $title XCOMM set block factor for extraction echo "blocking $block" | ${SAORD_BIN}/xpaset $title XCOMM set select point for next image echo "select next $x $y" | ${SAORD_BIN}/xpaset $title XCOMM look for existing image set curfile=`${SAORD_BIN}/xpaget $title image` XCOMM if this image is not loaded, do so now if ( "$curfile" != "$autofile" ) then echo "file $autofile" | ${SAORD_BIN}/xpaset $title XCOMM else redisplay around selected point else echo "redisplay" | ${SAORD_BIN}/xpaset $title endif XCOMM reset zoom center echo "zoom reset" | ${SAORD_BIN}/xpaset $title