Hello All,
I'm currently an intern working at SETI Institute using IDL/ENVI and
have ran into a few problems that my mentor is having trouble helping
me with. Any help would be greatly appreciated.
I'm currently trying to create a program that prints out statistics
from ROI's created by a geologist. I keep having an error message
come up.
************************************************************ *************
class_stats_doit: An error has occurred during processing
Error: "Array dimensions must be greater than 0." The result may be
invalid.
************************************************************ *************
I have read most of the posts that contain this error message and
haven't been able to find anything that will help me solve my
problem.
My mentor and I came to the conclusion that the ROI was not being tied
to the image. We tried using some sample code from ENVI help that
simply created and defined an ROI, but when we opened the image the
ROI was not present. It seemed like there were some discrepancies in
the ENVI about exactly how the image and the ROI are tied together. I
have included the code for the program I wrote, as well as the code
from the book that didn't seem to do anything.
Thanks,
Lauren Hunkins
lauren.hunkins@gmail.com
University of South Florida
SETI Institute
------------------------------------------------------------ ---------------------------
pro clean_version
;Open file containing image
ENVI_OPEN_FILE, '/Volumes/SETI/PSP_006676_2045/
PSP_006676_2045_COLOR_SUBSET2_3.jp2',R_FID=fid1
envi_file_query, fid1, dims=dims, ns=ns, nl=nl
;Restore ROIs created by geologist
ENVI_RESTORE_ROIS, '/Users/Saphira/Desktop/ROI_TEXTURE_SUBSET2_3.roi'
ROI_ID = ENVI_GET_ROI_IDS(FID = fid1, NL=nl , NS=ns,
ROI_NAMES=roi_names, ROI_COLORS=roi_colors)
;Create a classification image from the ROIs
ENVI_DOIT, 'ENVI_ROI_TO_IMAGE_DOIT', CLASS_VALUES=class_values,
FID=fid1, $
ROI_IDS=ROI_ID, OUT_NAME='ROI_IMAGE_4', R_fid= cfid
envi_file_query, cfid, dims=cdims, nb=nb
;Calculate the Statistics from the Class image containing the ROI's
ENVI_DOIT, 'CLASS_STATS_DOIT',class_DIMS=cdims, CLASS_FID=cfid,
CLASS_PTR=class_ptr, COMP_FLAG=2,$
COV=cov, DMAX=dmax, DMIN=dmin, $
FID=fid1, MEAN=mean, POS=pos, REP_NAME='ROI_STATS', $
REPORT_FLAG=1, STA_NAME=sta_name, STDV=stdv
;Print the statistics for the ROIs
print, 'Minimum', dmin
print, 'Maximum', dmax
print, 'Standard Deviation', stdv
print, 'Mean', mean
print, 'Covariance', cov
;Delete all ROIs
ENVI_DELETE_ROIS, /all
end
------------------------------------------------------------ ------------------------------------------------------
pro envi_help_file
ENVI_SELECT, fid=fid
;
; Get the dimensions for this
; file and create an ROI
;
ENVI_FILE_QUERY, fid, dims=dims
roi_id = ENVI_CREATE_ROI(ns=ns, nl=nl, $
color=4, name='Square')
;
; Define the square and add
; the polygon object to the ROI
;
xpts = [100, 200, 200, 100, 100]
ypts = [100, 100, 200, 200, 100]
ENVI_DEFINE_ROI, roi_id, /polygon, $
xpts=xpts, ypts=ypts
end
|