Re: Image structure [message #38797] |
Mon, 29 March 2004 09:21  |
julio
Messages: 31 Registered: December 2003
|
Member |
|
|
Ok David, I'll try it. Thanks for the answer!
Julio
David Fanning <david@dfanning.com> wrote in message news:<MPG.1acf62d1180ba741989720@news.frii.com>...
> Julio writes:
>
>> Let me explain what I'm thinking. Please tell me if it is possible.
>> The image is constructed through:
>>
>> Image = [(Band1), (Band2), (Band3), (Band4), (Band5)]
>>
>> However, sometimes I don't have all the bands. Supposing I have only
>> Bands 1 and 3, what value I must put in place of Band2, Band4 and
>> Band5, once I won't use them? The idea is to take these bands out from
>> the equation.
>>
>> I tried to put 0 in these places, but it doesn't work, once Bands 1
>> and 3 are two-dimensional matrices and 0 is not.
>>
>> Case statement may help, but I have too combinations. Could you please
>> explain what you mean?
>
> I can't tell exactly what you are trying to do here,
> but you have two choices, I think. If the "image" is
> *always* to have five bands, then if you don't have
> a particular band, you have to fake it.
>
> Suppose these bands were 400 by 500 integer arrays,
> and that band1 is absent:
>
> IF N_Elements(band1) EQ 0 THEN band1 = BytArr(400,500)
> ...
> Image = [(Band1), (Band2), (Band3), (Band4), (Band5)]
>
> Now, band1 contains all zeros. (Or whatever value you
> assign it that makes sense to you.)
>
> If the image is composed of any band that happens to
> be available, you have to be more inventive. How about
> something like this:
>
> image = IntArr(400,500,5]
> good = IntArr(5)
>
> IF N_Elements(band1) NE 0 THEN BEGIN
> image[*,*,0] = band1
> good[0] = 1
> ENDIF
> ...
> IF N_Elements(band5) NE 0 THEN BEGIN
> image[*,*,4] = band5
> good[4] = 1
> ENDIF
>
> bands_exist = Where(good GT 0, count)
> IF count GT 0 THEN image = image[*,*,bands_exist] ELSE $
> Print, "No bands available"
>
> Now image is a 400 by 500 by however-many-bands-
> actually-exist array.
>
> Cheers,
>
> David
|
|
|