I create a polygon ROI from the shapefile vertices and want to do 'raster to vector' with spatial subseting by 'envi_get_roi_dims_ptr' routine.I have get the DIMS,but it is failed to do 'rtv_doit' ,why?
program as follows:
envi_open_file,'i:\test.tif',r_fid=ofid
envi_file_query, ofid, ns=ns, nl=nl,dims=dims
myshape=OBJ_NEW('IDLffShape', 'I:\basin\basin.shp')
myshape->GetProperty, N_ENTITIES=num_ent
FOR i=0,0 DO BEGIN
ent = myshape->GetEntity(i)
xmap=(*ent.vertices)[0, *]
ymap =(*ent.vertices)[1, *]
envi_convert_file_coordinates, ofid, xf, yf, xmap, ymap
myshape->DestroyEntity, ent
ENDFOR
OBJ_DESTROY, myshape
filled_poly = polyfillv(xf, yf, ns, nl)
ind = array_indices([ns, nl], filled_poly, /dimensions)
roi_id = envi_create_roi(color=4, name = 'test roi', ns=ns, nl=nl)
envi_define_roi, roi_id, /point, xpts=ind[0, *], ypts=ind[1, *]
envi_save_rois, 'i:\test.roi', roi_id
envi_doit,'rtv_doit',dims=dims,fid=ofid,values=1,pos=0,l_name='water',out_name='i:\test.evf',in_memory=0
|