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

Home » Public Forums » archive » Re: subset an image by coordinates
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: subset an image by coordinates [message #68044] Tue, 22 September 2009 08:40 Go to previous message
Alvaro Paredes L. is currently offline  Alvaro Paredes L.
Messages: 5
Registered: September 2009
Junior Member
On 21 sep, 17:58, pp <pp.pente...@gmail.com> wrote:
> On Sep 20, 2:00 pm, "Alvaro Paredes L." <alvaropared...@gmail.com>
> wrote:
>
>> ; define theimageto be opened
>> img_file='F:\IMAGE\NDVI-HDF\try\NDVI_2008_03_02.img'
> ...
>> image=img_file[XF,YF]
>
> Are you trying to subscript the file name? Trying to have a
> conversation with an address (http://groups.google.com/group/
> comp.lang.idl-pvwave/msg/b0859e67a0ff6d51)?

Well, thank you very much... I finally found my mother and talked to
her :-)
As I say before, sometimes it's hard to understand how a program
works, specially if you aren't a progammer (this was a nooby
mistake...). There is only one problem with the output coordinates
data (0.0 on the subset, has the same coordinates that 0.0 in the
original image), but i hope i can fix it soon. Anyway, any help is
welcome.

The finally routine is this:

forward_function ENVI_CONVERT_FILE_COORDINATES
pro SUBSET
envi, /restore_base_save_files
envi_batch_init,log_file='batch.txt'

; define the image to be opened
img_file='F:\IMAGE\NDVI-HDF\try\NDVI_2008_03_02.img'
envi_open_file,img_file,r_fid=fid
if (fid eq -1) then begin
envi_batch_exit
return
endif

XMap=[-71.0580916, -70.5006694]
YMap=[-32.6030694, -32.9797194]

ENVI_CONVERT_FILE_COORDINATES, FID, XF, YF, XMap, YMap

XF=ROUND(XF)
YF=ROUND(YF)

envi_file_query, fid, DIMS=DIMS, NB=NB, NL=NL, NS=NS
pos = lindgen(nb)

image=fltarr(NS, NL, NB)
FOR i=0, NB-1 DO BEGIN
image[*,*,i]= envi_get_data(fid=fid, dims=dims, pos=pos[i])
endfor

imagen= image[XF[0]:XF[1],YF[0]:YF[1]]

nl2=YF[1]-YF[0]
ns2=XF[1]-XF[0]

map_info=envi_get_map_info(fid=fid)

envi_write_envi_file, imagen, data_type=4, $
descrip = 'testing', $
map_info = map_info, $
nl=nl2, ns=ns2, nb=nb, r_fid=r_fid, $
OUT_NAME = 'F:\IMAGE\NDVI-HDF\try\trying.hdf'

; Exit Envi
envi_batch_exit
end


Thanks again to everyone who helped me! :)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Structure
Next Topic: structure

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

Current Time: Sat Oct 11 11:01:31 PDT 2025

Total time taken to generate the page: 0.44231 seconds