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

Home » Public Forums » archive » envi_get_data
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: envi_get_data [message #58273 is a reply to message #58173] Fri, 25 January 2008 06:03 Go to previous messageGo to previous message
lbusett@yahoo.it is currently offline  lbusett@yahoo.it
Messages: 30
Registered: February 2006
Member
Hi,

I don't know if it will solve all your problems, but I believe that
you should replace the instruction:

> image2=fltarr((nb,nl,ns)

with:

image2 = fltarr (nb, ns, nl)

because ENVI_GET_DATA returns an array in samples by lines order (see
the help). (Obviously, if you have a square image nothing will change)

You can also remove the instruction

> image=fltarr((nb,nl,ns)

since the "image" variable is overwritten by the "envi_get_data"
instruction.

Hope this helps,

Lorenzo

On 23 Gen, 22:57, yychon...@gmail.com wrote:
> Thank you Jean. I did correct the error you pointed out, and I found
> something werid for the output image. I used a 2bands input file and
> the output image seems twist and even does not have the correct
> boundary shape, and the data was wrong.
>
> Then I tested it with a one band input image, when I tried to multiply
> the input image by a constant to get a new image(my output) it did not
> work (it did not get the image that supposed to). If I just add the
> input image with a small number, it works fine. But if I add the image
> with a large number, like 35000(the min. data on the input image is
> -32768), then it went wrong again.
>
> I thought it might be due to the format of the image, then I changed
> fltarr to dblarr, it still wont give the right output image.
>
> Many thanks.
>
> Now my code looks like this:
>
> pro cal
> envi, /restore_base_save_files
> envi_init, /batch_mode
> envi_open_file,'F:\testinput.img',r_fid=fid
> if (fid eq -1) then return
> envi_file_query, fid, ns=ns, nl=nl, nb=nb, data_type=data_type
> map_info = envi_get_map_info(fid = fid)
> dims = [-1L, 0, ns - 1, 0, nl - 1]
> pos=lindgen(nb)
> image=fltarr((nb,nl,ns)
> image2=fltarr((nb,nl,ns)
> For i=0, nb-1 Do Begin
> image = envi_get_data (fid=fid,dims=dims,pos=i)
> image2[i,*,*]=image
> Endfor
> ENVI_WRITE_ENVI_FILE,image2,data_type=data_type,nb=nb,nl=nl, ns=ns,map_info
> = map_info, $
> out_name='F:\testoutput.img'
> END
>
> On Jan 21, 3:00 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
> wrote:
>
>>> envi_file_query, fid, ns=ns, nl=nl, nb=nb, pos=pos ,dims=dims
>
>> ... in the help file, there is no POS keyword in this function... so
>> later on, when you try to use it, pos is undefined.
>
>> Jean
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Beginner: Oplot line t^(-5/3)
Next Topic: Curve Fitting Question

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

Current Time: Wed Oct 08 19:33:08 PDT 2025

Total time taken to generate the page: 0.00403 seconds