Re: envi_get_data [message #58166] |
Mon, 21 January 2008 14:00  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
> 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
|
|
|
Re: envi_get_data [message #58319 is a reply to message #58166] |
Wed, 23 January 2008 13:57  |
yychongzi
Messages: 6 Registered: September 2007
|
Junior Member |
|
|
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
|
|
|