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

Home » Public Forums » archive » Help with code for hyperspectral image analysis
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: Help with code for hyperspectral image analysis [message #80531 is a reply to message #80374] Wed, 20 June 2012 10:57 Go to previous message
Klemen is currently offline  Klemen
Messages: 80
Registered: July 2009
Member
Try this, I didn't test it...
Cheers, Klemen

pro envi_masking_image

;select your image file

;Get your file
image=dialog_pickfile()

;check to see if valid for ENVI
envi_open_file, image, r_fid=fid

;learn about the image
ENVI_FILE_QUERY, fid, ns=ns, nl=nl, nb=nb, data_type=data_type
help, data_type

;build array based on data type
data_holder=intarr(ns, nb, nl)

;make a mask
f = ENVI_GET_DATA(fid=fid, dims=dims, pos=140)
indx = where(f LT 40, count)

;applay the mask to all bands
if count gt 0 then begin
for i=0,nb-1 do begin
f = ENVI_GET_DATA(fid=fid, dims=dims, pos=i
f[indx] = 0
data_holder[*,i,*] = f
endfor
endif

;write out the result as an envi file
envi_write_envi_file, data_holder, out_name='masktest'


end
[Message index]
 
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: read irregular data
Next Topic: sun symbol

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

Current Time: Wed Oct 08 20:03:56 PDT 2025

Total time taken to generate the page: 0.00735 seconds