procedure displayset(inputimages) char inputimages {"",prompt="Input images to display"} int framenumber {1,prompt="Frame in which to display the images"} real sleeptime {0.0,prompt="Time to pause between images (seconds)"} bool meffile {yes,prompt="Flag for MEF files"} int mefext {1,prompt="MEF extension"} char imsect {"",prompt="MEF image section to display"} bool examine {no,prompt="Execute imexam after each frame?"} struct* scanfile {"",prompt="Internal use only"} begin char l_inputimages,l_filename real l_sleeptime int l_framenumber,l_mefext int i,j,nimages,maximages char in[300] char tmpfile,l_imsect char l_imsection bool l_meffile,l_examine l_inputimages=inputimages l_sleeptime=sleeptime l_framenumber=framenumber l_meffile=meffile l_mefext=mefext l_imsect=imsect l_examine=examine nimages=0 maximages=300 if (l_framenumber < 1 || l_framenumber > 4) { print("Error -- DISPLAYSET: frame number is entered as "//str(l_framenumber)//". It should be in the range 1 to 4.") goto exit } if (l_meffile && l_mefext < 0) { print("Error -- DISPLAYSET: extension number is entered as "//str(l_mefext)//". It should be 0 or higher (and 1 or higher for Gemini data).") goto exit } # Count the number of input images # First, generate the file list if needed if (stridx("*",l_inputimages) > 0) { tmpfile=mktemp("tmpfile") files(l_inputimages, > tmpfile) l_inputimages="@"//tmpfile } if (substr(l_inputimages,1,1)=="@") { scanfile=substr(l_inputimages,2,strlen(l_inputimages)) } else { if(stridx(",",l_inputimages)==0) { tmpfile=mktemp("tmpfile") files(l_inputimages, > tmpfile) } else { tmpfile=mktemp("tmpfile") j=9999 while(j!=0) { j=stridx(",",l_inputimages) if(j>0) files(substr(l_inputimages,1,j-1), >> tmpfile) else files(l_inputimages, >> tmpfile) l_inputimages=substr(l_inputimages,j+1,strlen(l_inputimages)) } } scanfile=tmpfile } i=0 while (fscan(scanfile,l_filename) != EOF) { i=i+1 if (substr(l_filename,strlen(l_filename)-4,strlen(l_filename)) == ".fits") l_filename=substr(l_filename,1,strlen(l_filename)-5) if (meffile) l_filename=l_filename//"["//str(mefext)//"]" if (!imaccess(l_filename)) { print("ERROR - DISPLAYSET: Input image "//l_filename//" was not found.") } else { nimages=nimages+1 if (nimages > maximages) { print("ERROR - DISPLAYSET: Maximum number of input images ["//str(maximages)//"] has been exceeded.") goto exit } in[nimages]=l_filename if (meffile) in[nimages]=l_filename//l_imsect } } scanfile="" delete("tmpfile*",ver-,>>& "/dev/null") if (nimages == 0) { print("ERROR - DISPLAYSET: no input images were defined.") goto exit } else { print("DISPLAYSET: Processing "//str(nimages)//" image(s).") } for (i=1; i <= nimages; i+=1) { display(in[i],frame=l_framenumber,zs-,zr+,erase-, >>&"/dev/null") if (l_examine) { imexam sleep(l_sleeptime) } else { sleep(l_sleeptime) } } sleep(2.0) exit: nimages=0 end