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

Home » Public Forums » archive » Re: Help with code for hyperspectral image analysis
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Help with code for hyperspectral image analysis [message #80372] Mon, 11 June 2012 09:43 Go to next message
Brian Daniel is currently offline  Brian Daniel
Messages: 80
Registered: July 2009
Member
Your problem is your call to ENVI_GET_DATA. POS has to be a scalar, so ENVI_GET_DATA returns only a single band at a time. You should loop through all the bands, apply your filter, then write the band to the output file using writeu. Then, call ENVI_SETUP_HEAD to write the header file.

-B

On Monday, June 11, 2012 10:59:55 AM UTC-4, Kel wrote:

> ;get data from the image, pos seems to indicate which band to get data from
> f = ENVI_GET_DATA(fid=fid, dims=dims, pos=140)
>
> lcmask = f LT 40
>
>
> ;apply the mask to the image array
>
> masked_image=convol(data_holder, lcmask)
>
> ;write out the result as an envi file
> envi_write_envi_file, masked_image, out_name='masktest'
>
>
> end
Re: Help with code for hyperspectral image analysis [message #80532 is a reply to message #80372] Wed, 20 June 2012 10:26 Go to previous message
Kel is currently offline  Kel
Messages: 7
Registered: June 2012
Junior Member
Thanks for your reply! I'm sorry to say that I still don't understand, though.

Calling up a single band with ENVI_GET_DATA was intentional, because I wanted to make a single-band file showing ones for locations where that band was less than 40, and zeros for where it's greater than 40.

The part that I'm stuck on is how I apply that information to all pixels in my image. At each pixel, if the band value at 140 is greater than 40, I want all 156 bands zeroed out. If it's less than 40 at that one band, then it should be left alone.

Any further explanation you can give would be very appreciated!



On Monday, June 11, 2012 12:43:00 PM UTC-4, Brian J. Daniel wrote:
> Your problem is your call to ENVI_GET_DATA. POS has to be a scalar, so ENVI_GET_DATA returns only a single band at a time. You should loop through all the bands, apply your filter, then write the band to the output file using writeu. Then, call ENVI_SETUP_HEAD to write the header file.
>
> -B
>
> On Monday, June 11, 2012 10:59:55 AM UTC-4, Kel wrote:
>
>> ;get data from the image, pos seems to indicate which band to get data from
>> f = ENVI_GET_DATA(fid=fid, dims=dims, pos=140)
>>
>> lcmask = f LT 40
>>
>>
>> ;apply the mask to the image array
>>
>> masked_image=convol(data_holder, lcmask)
>>
>> ;write out the result as an envi file
>> envi_write_envi_file, masked_image, out_name='masktest'
>>
>>
>> end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Always Something to Worry About
Next Topic: Strange UserSym Color Bug

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

Current Time: Wed Oct 08 15:11:47 PDT 2025

Total time taken to generate the page: 0.00494 seconds