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

Home » Public Forums » archive » Re: Image structure
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: Image structure [message #38797] Mon, 29 March 2004 09:21
julio is currently offline  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
Re: Image structure [message #38813 is a reply to message #38797] Sat, 27 March 2004 09:07 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Image structure [message #38814 is a reply to message #38813] Sat, 27 March 2004 08:21 Go to previous message
julio is currently offline  julio
Messages: 31
Registered: December 2003
Member
David Fanning <david@dfanning.com> wrote in message news:<MPG.1acec3001b9506e498971f@news.frii.com>...
> Julio writes:
>
>> Hi! I have a question, any comments will be welcome?
>>
>> I have to create an image with 1, 2, 3, 4 or 5 bands. When I have all
>> the 5 bands, I can write:
>>
>> Image=[(Band1),(Band2),(Band3),(Band4),(Band5)]
>>
>> However, in the case I don't have all the bands, like only 2, 3 and 5,
>> I should put:
>>
>> Image=[(Band2),(Band3),(Band5)]
>>
>> Then, I would have to write several combinations to make that
>> automatically. That's the problem! Isn't there anything easier? How
>> can I modify the initial script in the case I don't have all the
>> bands??
>
> I think you are looking for a CASE statement. :-)
>
> Cheers,
>
> David


Hi Dr Fanning, thanks for answering...

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?

Thanks in advance!

Regards,
Julio
Re: Image structure [message #38815 is a reply to message #38814] Fri, 26 March 2004 21:45 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Julio writes:

> Hi! I have a question, any comments will be welcome�
>
> I have to create an image with 1, 2, 3, 4 or 5 bands. When I have all
> the 5 bands, I can write:
>
> Image=[(Band1),(Band2),(Band3),(Band4),(Band5)]
>
> However, in the case I don't have all the bands, like only 2, 3 and 5,
> I should put:
>
> Image=[(Band2),(Band3),(Band5)]
>
> Then, I would have to write several combinations to make that
> automatically. That's the problem! Isn't there anything easier? How
> can I modify the initial script in the case I don't have all the
> bands??

I think you are looking for a CASE statement. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Read XML and Base64 format
Next Topic: need the dimensions of an array

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

Current Time: Wed Oct 08 12:48:48 PDT 2025

Total time taken to generate the page: 0.00633 seconds