I ran a test in ENVI 5.1 using the sample code from CLASS_DOIT with the /in_memory keyword and it returned a classification result without error. Do you want to try the following code?
;Start ENVI
e = ENVI()
; Open a data file
File = Filepath('qb_boulder_msi', Root_Dir = e.Root_Dir, $
Subdir = ['data'])
Raster = e.OpenRaster(File)
; Determine an output file
OutFile = e.GetTemporaryFilename()
; Return a file ID
fid = ENVIRasterToFID(Raster)
; Perform K-Means unsupervised classification.
ENVI_File_Query, fid, DIMS=dims, NB=nb
ENVI_Doit,'Class_Doit', $
FID = fid, $
DIMS = dims, $
POS = Lindgen(nb), $
METHOD = 7, $
NUM_CLASSES = 5, $
ITERATIONS = 3, $
CHANGE_THRESH = 0.9, $
/in_memory, $
R_FID = r_fid
; Pass the R_FID to an ENVIRaster object.
OutRaster = ENVIFIDToRaster(r_fid)
; Display the original data and the result
View = e.GetView()
Layer = View.CreateLayer(Raster)
Portal = View.CreatePortal()
|