comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » subset an image programatically
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
subset an image programatically [message #46832] Sat, 31 December 2005 06:34
Javier Martinez is currently offline  Javier Martinez
Messages: 2
Registered: January 2006
Junior Member
Hi everyone,

this is my first post, I'm not a programmer and I'm trying to subset a
series of images with vector files in evf format. Looking the envi and
IDL help files and some code that I found in this group, I write the
code below, and it works properly but not completely. In the final part
where I write the envi file I obtain an image with all the roi data in
a single line (more than 14000 samples) and I need the data in the
original geographical shape (obviously).

Thanks in advance for any help that you can give me

happy new year for all you guys

Javier Martinez Pincheira
Instituto del Medio Ambiente
Universidad de La Frontera

pro batch_roi
envi,/restore_base_save_files
envi_batch_init, log_file='log.txt'

envi_open_file, 'image', r_fid=fid
envi_file_query, fid, ns=ns, nl=nl, nb=nb

map_info = envi_get_map_info(fid=fid)

evf_fname = 'vector.evf'
evf_id = envi_evf_open(evf_fname)

envi_evf_info, evf_id, num_recs=num_recs, $
data_type=data_type, projection=projection, $
layer_name=layer_name



FOR i=0,num_recs-1 DO BEGIN
; read the record
;
vec = ENVI_EVF_READ_RECORD(evf_id, i)
xmap= vec(0,*)
ymap= vec(1,*)

;just to verify
print, 'Number of Records ' + ': ', num_recs
print, 'Number of nodes in Record ' + $
strtrim(i+1,2) + ': ', n_elements(vec[0,*])

envi_convert_file_coordinates, fid1, xf, yf, xmap, ymap


roi_id = ENVI_CREATE_ROI(ns=ns, nl=nl, color=4, name='shape')


ENVI_DEFINE_ROI, roi_id, xpts=REFORM(xf, /over), $
ypts=REFORM(yf, /over), /polygon

FOR j=0,0 DO BEGIN
;print, roi_id
roi_data = ENVI_GET_ROI_DATA( roi_id, fid=fid, pos = [j])
ENVI_GET_ROI_INFORMATION, roi_id, ns=ns, nl=nl

ENVI_WRITE_ENVI_FILE, roi_data, ns=ns, nl=nl,
out_name='out_name', map_info=map_info

ENDFOR
ENDFOR
print, roi_id
ENVI_BATCH_EXIT
end
[Message index]
 
Read Message
Previous Topic: IDL HDF5 compound type and dataspace
Next Topic: IDL AND CORBA

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:07:37 PDT 2025

Total time taken to generate the page: 0.39860 seconds