procedure tregions (imgName,frm,boxSize,skyFile) string imgName {prompt="Image to define regions from (full name)"} int frm {1, prompt="Ximtool frame for display image"} int boxSize {70, prompt="Side-length of region for statistics?"} string skyFile {"--", prompt="Output file of sky regions"} struct *flist1 struct *flist2 # list-directed structures begin # Variable Declarations: int x1, x2 int y1, y2 # dimensions of imstat region int xc, yc # central coordinates of current region string reg # string containing image stat region int Nreg # counter of the number of regions if (! defpac ("images")) { print("Package IMAGES needs to be loaded.") bye } if (! defpac ("lists")) { print("Package LISTS needs to be loaded.") bye } if (! defpac ("proto")) { print("Package PROTO needs to be loaded.") bye } if (skyFile=="--") { print (" ** NEED TO SPECIFY AN INPUT FILE **") print (" ") print (" Please try again.") print (" ") bye } # Cleaning up any files to be used: delete (files=skyFile,go_ahea+,ver-) delete (files="temp_tnse*",go_ahea+,ver-) delete (files="temp_junk",go_ahea+,ver-) # Obtaining regions: ----------------------------------------------- display (image=imgName,frame=frm,erase+,bord-, sele+,repe-,fill-,zscal+,ztrans="linear", >> "temp_junk") print (" ") print (" *** "//imgName//" displayed in Ximtool frame "//frm//" ***") print (" ") print (" --> Press any key at each region and ctrl+ when done.") rimcursor(image=imgName,wcs="logical",wxformat="",wyformat="", cursor="",mode="ql", >> "temp_tnse1") print (" ") print (" Please wait ...") !awk '{print int($1)" "int($2)}' temp_tnse1 > temp_tnse2 flist2 = "temp_tnse2" Nreg=0 while ( fscan(flist2, xc, yc) != EOF) { Nreg=Nreg+1 x1=xc-int(boxSize/2) x2=xc+int(boxSize/2)-1 y1=yc-int(boxSize/2) y2=yc+int(boxSize/2)-1 reg = "["//x1//":"//x2//","//y1//":"//y2//"]" # print (reg) print (reg, >> skyFile) } print (" ") flist2 = skyFile Nreg=0 while ( fscan(flist2, reg) != EOF) { Nreg=Nreg+1 } print (" ") type(input_fi=skyFile,map_cc+,device="terminal",flpar-) print (" ") print (" There are "//Nreg//" regions...") print (" ") # =================================================================== # Cleaning up any files used: # delete (files="temp_tnse*",go_ahea+,ver-) print(" ") print(" ") print(" All done.") print(" ") end