X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 17 Nov 2010 09:11 AM by  anon
Extracting individual pixels from an ROI
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
17 Nov 2010 09:11 AM
    Hi, I need to extract the individual pixels from an ROI to an ASCII file for further processing. It would also need to loop through multiple files and print their pixel values too. This is my current code but I can't seem to get ENVI_GET_ROI_DATA to work. Any help would be much appreciated. Thanks ;restore the base ENVI save files envi,/restore_base_save_files ;initialize batch mode envi_batch_init, log_file='batch.txt' ; create a string tiles="/home/zcfaec4/MODIS/Daily/" + '*.hdf' print,'Im looking for files ',tiles ; get an array of strings with all of these names in files= findfile(tiles) ; check number of files number= n_elements(files) print,'I Found ',number,' files' ;Restore ROI ROI="/home/zcfaec4/MODIS/Rio_Grande.roi" envi_restore_rois,ROI ;get the ROI ids roi_ids=envi_get_roi_ids() ;get the ROI pointer to pass to the DIMS array ;and in this case only ROI in my ROI file roi_dims=ENVI_GET_ROI_DIMS_PTR(roi_ids[0]) ;set up my DIMS array using the ROI pointer dims= [roi_dims,0,0,0,0] ; loop for i=0,number-1 do begin print,'file',i,files[i] envi_open_data_file,files[i],/HDF_SD,r_fid=fid,HDFSD_DATASET=0,NO_REALISE=1 ENVI_FILE_QUERY,fid,ns=ns,nl=nl,nb=nb pos = lindgen(nb) ; Create unique file names for each loop ENVI_FILE_QUERY,fid,sname=sname envi_doit,'envi_stats_doit',fid=fid,pos=pos,dims=dims, comp_flag=3, dmin=dmin, dmax=dmax,mean=mean, hist=hist, rep_name= sname+".txt" ENVI_FILE_MNG,id=fid,/remove endfor envi_batch_exit end
    You are not authorized to post a reply.