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 
Return to the default flat view Create a new topic Submit Reply
Re: Image structure [message #38813 is a reply to message #38797] Sat, 27 March 2004 09:07 Go to previous messageGo 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/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
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: Fri Oct 10 01:29:40 PDT 2025

Total time taken to generate the page: 0.88057 seconds