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

Home » Public Forums » archive » Request for help using IDL in ENVI
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Request for help using IDL in ENVI [message #35342] Mon, 09 June 2003 11:35
lmartinez is currently offline  lmartinez
Messages: 2
Registered: June 2003
Junior Member
I am wondering if anyone can help me out with this problem I am
having. What I am doing is (or trying to do) trying to allow the user
to select a file to perform a certain math process on, then just
simply output the resulting image file to either memory or a file.
However, I get the following error..."String expression required in
this context. PROC_NAME. The result may be invalid." An image pops up
afterwards, but is not quite what i expected. I dont know if I am
calling the bands wrong because it is a 250(x) by 250(y) by 256(z)
image. I took an IDL Intro programming class, but didnt quite learn
how to tie it in with ENVI, so PLEASE HELP!!! Below is my code for you
to look over.

Thanks, Luis

;----------------------------------------------------------- --------------
pro test_8, ev
;
;----------------------------------------------------------- --------------
; The user will be able to modify these band values depending on
binning

redband = 119
greenband = 74
blueband = 27
band_1 = 179 ;*nm
band_2 = 199 ;*nm
c1 = 816 ; Absorption coefficient for Hbo2 at *nm
c2 = 586 ; Absorption coefficient for HbO2 at *nm
c3 = 1548.52 ; Absorption coefficient for Hb at *nm

widget_control, ev.id, get_uvalue=uvalue
if (uvalue eq 'user ratio') then begin

envi_select, title='Select Input File', fid=fid, dims=dims, pos=pos
print, 'dims ', dims
if (fid eq -1) then return

envi_file_query, fid, ns=ns, nl=nl, nb=nb, bnames=bnames
print, 'ns= ', ns, ' nl =', nl, ' nb =', nb
;
;----------------------------------------------------------- --------------
; The user will be able to modify the value for 'nb' depending on
binning

if (nb ne 256) then return

envi_display_bands, [fid,fid,fid], [redband,greenband,blueband], /new
;
;----------------------------------------------------------- --------------
; Create a widget for the input parameters

base = widget_auto_base(title='Ratio Parameters', /xbig, /ybig)
a0 = widget_base(base, /column, /frame, /ALIGN_CENTER)
label1 = widget_label(a0, value = 'NOTE:Changing these bands would
result in invalid ouput')
a1 = widget_param(a0, /auto_manage, dt=4, field=2, prompt = 'Band 1
= (760nm)', $
uvalue = 'band_1', default = band_1)
a2 = widget_param(a0, /auto_manage, dt=4, field=2, prompt = 'Band 2
= (800nm)', $
uvalue = 'band_2', default = band_2)
;
;----------------------------------------------------------- --------------
; Create a widget for the output parameters

a3 = widget_outfm(base, uvalue='Outf', default=file_output,
prompt=prompt, /auto_manage)

result = auto_wid_mng(base)
if (result.accept eq 0) then return
if ((result.outf.in_memory) eq 1) then begin
band_1 = result.band_1
band_2 = result.band_2

print, '760nm = ', band_1, '800nm = ', band_2
endif else return

;----------------------------------------------------------- --------------
; Calculate the ratio

a = alog10(1/(band_1/100))
b= alog10(1/(band_2/100))
results = ((c1/(c2-c3)) * (a/b)) - (c3/(c2-c3))

envi_enter_data, results, r_fid = results
;print, 'file name = ', results
;
;----------------------------------------------------------- --------------
; Output the file

envi_check_save, /utility

envi_output_to_external_format, dims = dims, pos =spos, fid = results

envi_display_bands, [fid], [results], /new

endif
end
[Message index]
 
Read Message
Previous Topic: rs_test.pro
Next Topic: rs_test.pro

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

Current Time: Fri Oct 10 15:19:20 PDT 2025

Total time taken to generate the page: 0.16270 seconds