Problem reading multiband-ENVI file [message #54582] |
Fri, 22 June 2007 18:53 |
aleks.franca@gmail.co
Messages: 33 Registered: March 2007
|
Member |
|
|
I have an Envi file with 6 bands and I need to take the bands apart in
separate variables so that I can display them in my GUI routine.
That's what I have:
:: Starts here
envi_select, title="WAVECHANGE: Select 'Initial State' Image",$
fid=fid1, dims=dims1, pos=pos1
if (fid1 eq -1) then return
envi_file_query, fid1, fname=fname1, bname=bname1,$
data_type=data_type1,$
ns=ns1, nl=nl1, nb=nb1,$
sname=sname1, xstart=xstart1, ystart=ystart1
;get number of slices
n_slices = nb1
img = BYTARR((dims1(2)+1),(dims1(4)+1),n_slices)
;for each slice in the selection
for i = 0, n_slices-1 do begin
;get filename
file = fname1
;create empty slice
image = bytarr((dims1(2)+1),(dims1(4)+1))
;open file and fill in slice
OpenR, lun, file, /Get_lun
ReadU, lun, image
Free_lun, lun
;store slice in volume
img[*,*,i]=image
endfor
;image = CONGRID(image, dims1(2)+1, dims1(4)+1)
WINDOW, 3, XSIZE = dims1(2)+1 , YSIZE = dims1(4)+1
image = bytscl(image)
TV, image
;;Ends here
This is not working with my envi file. I don't know if this is the
right way to do it. I have no experience with envi files.
Any help would be appreciated..
thank you
Aleksander
|
|
|