#!/bin/csh -f -e # ################################################### # # SGI script to create rgb files from a Metafile # # ################################################### # set WORKDIR=/net/$user/tmpdir/ncarmovie/rgb if ($#argv != 1 || $1 == "-h" || $1 == "-help") then echo '\n------------------------------------------------------------------------------' echo "USAGE: meta2rgb \ ----- Function: Creates rgb frame sequence from a multi-frame CGM \ Output: 512x512 rgb frames will go to  $WORKDIR/  \n \ To animate (on an SGI only), enter: \  cd $WORKDIR  \ then: \ Option 1:  movie frame.rgb.*  \ Option 2:  makemovie -o tmp_mvc2.mv -c mvc2 -r 5 frame.rgb.*; movieplayer tmp_mvc2.mv\ Option 3:  ( setenv PATH "'$'"{PATH}:/home/hnv/pub/mpeg ; rgbtompg -q 10 -o tmp.mpg frame.rgb.* ; \mpeg_play -dither color tmp.mpg ) \ Option 4:  ( setenv PATH "'$'"{PATH}:/home/hnv/pub/mpeg ; rgbtompg -q 10 -o tmp.mpg frame.rgb.* ; /net/hnv/anim/glmpeg_play -buffer memory -maxmemory 10000000 tmp.mpg ) \ (Note: to get controls for glmpeg_play, press H in the window." echo '------------------------------------------------------------------------------' echo "" exit 1 endif if (! -e $1) then echo $1 does not exist. exit 2 else set AA=`echo $1|cut -c1` if ("$AA" != "/") then echo "ERROR: Metafile name must be an absolute pathname." exit 3 end endif echo "----------------------" echo "Starting meta2rgb..." echo " Output will go to $WORKDIR/" echo " This will wipe out any old stuff in $WORKDIR/ ... " echo -n " OK (Y/N)? " set ANS=$< set ANS=`echo $ANS|cut -c1` if ($ANS != "Y" && $ANS != "y") then echo "meta2movie aborted." exit 0 endif if (! -e $WORKDIR) mkdir -p $WORKDIR cd $WORKDIR touch junk #\rm * #..the following will get rid of all old files without choking on any subdirectories... \rm `find ./* -prune -type f -print` #...create a file of commands for 'med'... if (-e med.cmds) \rm med.cmds echo '1,$ split $' > med.cmds echo 'quit' >> med.cmds #...Use 'med' to split the metafile into individual files... echo "MED splitting metafile  $1  " echo " in $WORKDIR/..." nice med $1 < med.cmds set MEDFILES=(`ls med*.ncgm`) echo "ncgm2rgb converting individual CGMs to rgb format..." set FN=0 foreach i ($MEDFILES) @ FN ++ set FN1="$FN" if ($FN < 100) set FN1="0$FN" if ($FN < 10) set FN1="00$FN" echo " ...frame number $FN..." nice ncgm2rgb $i mv frame001.rgb frame.rgb.$FN1 end echo "--------------------" echo "meta2rgb complete." echo echo "You may want to save the output to a different directory." echo echo "To animate (on an SGI only), enter:" echo " cd $WORKDIR ; movie frame.rgb.\* &" echo echo "--------------------"