X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 30 Mar 2008 01:32 PM by  anon
ENVI_get_roi_data
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
30 Mar 2008 01:32 PM
    Dear all, I want obtain the image data within a region(saved as evf file ,only 1 polygon) ,such as pixel values,so I writed the program like this: ;open a file and get info label_file = envi_pickfile(title='Please select a Label file') envi_open_file,label_file, r_fid=label_fid envi_file_query, label_fid, ns=ns, nl=nl ;open evf fine evf_fname = 'a1.evf' evf_id = envi_evf_open(evf_fname) envi_evf_info, evf_id, num_recs=num_recs for i=0L, num_recs-1 do begin rec = envi_evf_read_record(evf_id, i) envi_convert_file_coordinates,label_fid,X_rec,Y_rec,rec[0,*],rec[1,*] endfor roi_id=envi_create_roi(name=evf_fname,ns=ns,nl=nl) envi_define_roi, roi_id, /polygon, xpts=X_rec, ypts=Y_rec data = envi_get_roi_data(roi_id(0) ,fid=label_fid,pos=0) envi_enter_data,data,map_info=map_info envi_evf_close, evf_id but there will be an alert that said"POLYFILLV: Not enough valid and unique points specified. Execution halted at: ENVI_POLYFILLV ENVI_ROI_GET_ADDR ENVI_GET_ROI_DATA " can u kindly tell that what's wrong in my program? thanks a lot

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    30 Mar 2008 01:32 PM
    If you do a HELP on your X_rec/Y_rec, you will find that they are 2d arrays. ENVI_DEFINE_ROI needs xpts and ypts to be a 1d array, so instead use: envi_define_roi, roi_id, /polygon, xpts=X_rec[*], ypts=Y_rec[*]
    You are not authorized to post a reply.