#* Demonstration Script #* TNTmips / SML V5.3 #* Display functions: interactive Boxcar classification #* Keith Ghormley, MicroImages, Inc. clear() beep() print("Select three processing bands for boxcar classification: ") GetInputRaster(A) GetInputRaster(B,NumLins(A),NumCols(A),RastType(A)) GetInputRaster(C,NumLins(A),NumCols(A),RastType(A)) clear() beep() print ("Select reference raster for display:") GetInputRaster(Ref,NumLins(A),NumCols(A)) GetOutputRaster(OUT,NumLins(A),NumCols(A),RastType(Ref)) print("creating output raster...") OUT=Ref CopySubobjects(Ref,OUT) CloseRaster(OUT) disp = DispOpen() #DispSetTitle(disp, title$) DispQuickAddRasterVar(disp, OUT) DispAddButtons(disp,"New A's","New B's","New C's","Clear","Process","Done") gmA = int(GlobalMean(A)) maxA=GlobalMax(A) minA=GlobalMin(A) gmB = int(GlobalMean(B)) maxB=GlobalMax(B) minB=GlobalMin(B) gmC = int(GlobalMean(C)) maxC=GlobalMax(C) minC=GlobalMin(C) aLO = gmA-3 aHI = gmA+3 bLO = gmB-3 bHI = gmB+3 cLO = gmC-3 cHI = gmC+3 done=0 ############################## while (done == 0) { DispRedraw(disp) clear() beep() print ("A lo/hi:", aLO, aHI) print ("B lo/hi:", bLO, bHI) print ("C lo/hi:", cLO, cHI) print ("Press option buttons in display window") DispSetMessage (disp,"Press an option button") button$=DispWaitForButtonPress(disp) #### if (button$=="New A's") { DispSetMessage (disp, "Enter new Low value in Console Window") print("Enter new value for aLO between",minA," and",maxA) aLO = input(aLO) DispSetMessage (disp, "Enter new High value in Console Window") print ("Enter new value for aHI between",minA," and",maxA) aHI = input(aHI) print ("New low value: ", aLO, "New high value:", aHI) print (aLO, aHI, bLO, bHI, cLO, cHI) } #### if (button$=="New B's") { DispSetMessage (disp, "Enter new Low value in Console Window") print("Enter new value for bLO between",minB," and",maxB) bLO = input(bLO) DispSetMessage (disp, "Enter new High value in Console Window") print ("Enter new value for bHI between",minB," and",maxB) bHI = input(bHI) print ("New low value: ", bLO, "New high value:", bHI) print (aLO, aHI, bLO, bHI, cLO, cHI) } #### if (button$=="New C's") { DispSetMessage (disp, "Enter new Low value in Console Window") print("Enter new value for cLO between",minC," and",maxC) cLO = input(cLO) DispSetMessage (disp, "Enter new High value in Console Window") print ("Enter new value for cHI between",minC," and",maxC) cHI = input(cHI) print ("New low value: ", cLO, "New high value:", cHI) print (aLO, aHI, bLO, bHI, cLO, cHI) } #### if (button$=="Clear") { OUT=Ref CloseRaster(OUT) } #### if (button$=="Process") { clear() print("working...") for each A if ((A<=aHI) and (A>=aLO) and (B<=bHI) and (B>=bLO) and (C<=cHI) and (C>=cLO)) then OUT = 255 CloseRaster(OUT) print("finished.") } #### if (button$=="Done") { done=1 print("Done") } } #### DONE beep() DispClose(disp) CloseRaster(OUT) clear() print ("Program complete") beep()