procedure tstrip (imageFile, outImage, genformat, coordFile, nSlices, hl, verb) string imageFile {prompt="File listing scan images (full names)"} string outImage {prompt="Mosaic image file name"} bool genformat {yes, prompt="Are coords from a spectext output file?"} string coordFile {prompt="Object coordinate file"} int nSlices {prompt="Number of image slices"} int hl {prompt="Half-length of box (in pix)"} bool verb {yes,prompt="Verbose output?"} # struct *flist # list-directed structure to go thru imageFile struct *clist # list-directed structure to go thru coordFile # Suggestions for a better script: # 1. Have it work out number of images in a scan from the # no. of lines in images.lis # 4. Have it label each row by its image coordinates, and hori- # zontally by wavelength (from zoffset in image header?). begin # Variable Declarations: struct image # image currently being added to mosaic int x,y # coords of each box centre int i string imgFile # file containing images to be mosaiced string subImage string box # flist = imageFile clist = coordFile # putting the contents of the list contained in imageFile # to the list-directed structure *flist # Make sure the NOAO.NPROTO package is loaded: if (! defpac ("nproto")) { print("Package NPROTO needs to be loaded.") bye } # Cleaning-up any stray images: imdelete (images="ftemp*") delete (files="fdata.lis",go_ahea+,ver-) delete (files="mostemp.out",go_ahea+,ver-) print (" ") imgFile = "@"//imageFile i=0 # while ( fscan(flist, image) != EOF) { while ( fscan(clist,x,y) != EOF) { i=i+1 subImage="ftemp"//i # output filename for temporary sub-mosaic if (verb==yes) { print(subImage) # print(x,y) print("---------") } else { printf(".") } print(subImage, >> "fdata.lis") box="["//(x-hl)//":"//(x+hl)//","//(y-hl)//":"//(y+hl)//"]" irmosaic (input=imgFile,output=subImage, database="mostemp.out",nxsub=nSlices,nysub=1,trim_section=box, corner="ul",direct="row",raster-,nxoverl=-2,nyoverl=0,verbose=no) } clist = coordFile # equivalent to rewinding place in coordinate file back to the top # } # Forming temporary file list of sub-mosaic images: # sections (images="ftemp*",option="fullname", > "fdata.lis") # Forming final full mosaic (of strips): fstrip irmosaic (input="@fdata.lis",output=outImage, database="mostemp.out",nxsub=1,nysub=i,trim_section="[*,*]", corner="ul", direct="row",raster-,nxoverl=0,nyoverl=-5,verb-) if (verb==yes) { print (outImage) } else { printf (" - Done\n") } # Retrieving general format spectext file: if (genformat==yes) { delete (files=coordFile,go_ahea+,ver-) rename (files="temp_orig", newnam=coordFile) } # Clean-up: imdelete (images="ftemp*") delete (files="fdata.lis",go_ahea+,ver-) delete (files="mostemp.out",go_ahea+,ver-) delete (files="temp_*",go_ahea+,ver-) end