4337 ENVI 5: How to incorporate the 'CLASS_DOIT' procedure The following example code demonstrates how to incorporate the ENVI Classic 'CLASS_DOIT' procedure into the new ENVI 5 programming environment. pro class_doit_envi5 ; Launch ENVI 5 e = ENVI() ;Test file located in the ENVI default data directory fname='C:\Program Files\ITT\IDL\IDL80\products\envi48\data\bhtmref.img' ; Make sure the file is valid... envi_open_file, fname, r_fid=fid if (fid eq -1) then return ;Get some required information from the file for the DOIT routine envi_file_query, fid, dims=dims, nb=nb, ns=ns, nl=ns ;Band numbers on which to perform the operation pos=indgen(nb) ; Output file name out_name='C:\Temp\kmeans_bhtmref.dat' ; Now do the K_Means (method 7) classification using the Class_Doit envi_doit,'class_doit', dims=dims, fid=fid, method=7, $ change_thresh= 0.5, num_classes=5, iterations=5, $ pos=pos, out_name=out_name ; **** Set the Display Views **** ;Display the original image in the first View image = e.OpenRaster(fname) view1 = e.GetView() layer1 = view1.CreateLayer(image) ;Set up some properties for this View ;...stretch 'property to 2% layer1.quick_stretch='linear 2%' ;Create the second View which will contain the K-Means output view2 = e.CreateView() ;Create the variable for the output kmeans=e.OpenRaster(out_name) ;Now create the ENVIRasterLayer layer2=view2.Createlayer(kmeans) ; Need to put final views here to have them at the resized ; to full extent view1.Zoom, /full_extent view2.Zoom, /full_extent END Technical Support Engineer (Germany) 2012 ENVI User Group: COSI-Corr User Presentations