I have a couple hundred .sta files generated using ROI's, and I would like to convert all of them to text files. I know I can create text files of stats based on individual ROI's in the GUI but it is rather time consuming. I also know you can save all stats from individual ROI's into just 1 text file, but the way ENVI outputs it is incredibly messy and the individual files are easier to work with. Is there a way to convert .sta to .txt or .csv in IDL?
EDIT:
I am trying to use something like this code, but I know there are probably numerous errors in it. I am pretty new to IDL but I have put comments in for what I am attempting to do with the lines of code:
pro stats_to_text
;image to calculate stats on for each roi which is a stacked image of 80 bands. I want stats for all 80 bands
envi_open_file, 'F:\Sheyenne\Atmospherically Corrected Landsat\Indices\Main\SATVI\SATVI_stacked'
;folder containing all rois to calculate stats on
cd,'F:\Sheyenne\ROI\Allotments'
files=file_search('*roi',count=count,/fold_case)
envi_restore_rois,name
roi_ids=envi_get_roi_ids(fid=fid,roi_names=roi_names)
npts=1100
pts=fltarr(5,npts)
roi_dims=envi_get_roi_dims_ptr(roi_ids[0])
dims=[roi_dims,0,0,0,0]
;output filename is same as input but add .txt to end
out_name=file_basename(filename, '.dat') + '.txt'
;calculate the stats
envi_doit, 'envi_stats_doit', fid=fid, pos=pos, $
dims=dims, comp_flag=1, mean=mean, dmin=dmin, dmax=dmax, STDV=STDV, REP_Name=out_name
end
the the program compiles but doesn't seem to do anything
|