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

Home » Public Forums » archive » Re: Merging Bytarr
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: Merging Bytarr [message #23311] Wed, 17 January 2001 09:01
Stein Vidar Hagfors H[1] is currently offline  Stein Vidar Hagfors H[1]
Messages: 56
Registered: February 2000
Member
"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> writes:
> Craig Markwardt wrote:
>
>> Voila. To be honest with you, I never understand how many nested []'s
>> I need in order to make it work. I just go for trial and error until
>> it does.
>
> Thanks Craig. I feel so much better that I am not the only one doing
> this all the time :-(

Me too!

By the way, it seems RSI cannot make sense of it themselves, try this:

help,[[[1]],[[1]]]
help,[[[[1]]],[[[1]]]]

Doesn't seem to have been fixed in 5.4 either! (This really surprises me!)

--
------------------------------------------------------------ --------------
Stein Vidar Hagfors Haugan
ESA SOHO SOC/European Space Agency Science Operations Coordinator for SOHO

NASA Goddard Space Flight Center, Email: shaugan@esa.nascom.nasa.gov
Mail Code 682.3, Bld. 26, Room G-1, Tel.: 1-301-286-9028/240-354-6066
Greenbelt, Maryland 20771, USA. Fax: 1-301-286-0264
------------------------------------------------------------ --------------
Re: Merging Bytarr [message #23317 is a reply to message #23311] Wed, 17 January 2001 07:03 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Hi Mark--

"Mark Chan" <chanm@cadvision.com> writes:
> Thanks Craig.
>
> I used this clumsy way:
> d=bytarr(3,40,700)
> d(0,0,0)=a & d(0,0,200)=b & d(0,0,300)=c
>
> You way is better.

Actually, your way is *faster*, and with the use of TEMPORARY can
potentially use less memory. However the disadvantage is that you
have to know ahead of time the dimensions of your array. I definitely
use above technique alot. The technique I suggested,
[[[a]],[[b]],[[c]]], is very elegant syntactically, and works with any
3x40xN arrays. Since you are a relative newcomer to the group
(right?), I went with simple over efficient.

> What throws me off in the first place was that the image, when shown on
> screen, was 40 wide and 100 high, the next one 200 high, and the last one
> 400 high. To be pasted into 40 wide x 700 wide. The sequence of the
> (3,40,etc) was not the same as my experience with other array indices (may
> be I am missing something).

I am assuming the "3" in 3x40xN are the three elements of an RGB
triple? In that case, you really have a 40xN image, where 40 will be
along the X axis and N will be along the Y axis. I *think* so at
least. So this seems to jive with what you were describing. You can
always use the TRANSPOSE function to flip X and Y.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Merging Bytarr [message #23322 is a reply to message #23317] Tue, 16 January 2001 20:19 Go to previous message
Mark Chan is currently offline  Mark Chan
Messages: 24
Registered: November 2000
Junior Member
Thanks Craig.

I used this clumsy way:
d=bytarr(3,40,700)
d(0,0,0)=a & d(0,0,200)=b & d(0,0,300)=c

You way is better.

What throws me off in the first place was that the image, when shown on
screen, was 40 wide and 100 high, the next one 200 high, and the last one
400 high. To be pasted into 40 wide x 700 wide. The sequence of the
(3,40,etc) was not the same as my experience with other array indices (may
be I am missing something).

Thanks,
Mark Chan

"Craig Markwardt" <craigmnet@cow.physics.wisc.edu> wrote in message
news:on8zoct3qv.fsf@cow.physics.wisc.edu...
>
> "Mark Chan" <chanm@cadvision.com> writes:
>
>> I am new to bytarr operation.
>>
>> I have 3 separate color images in the following format:
>>
>> bytarr(3,40,15500)=a
>> bytarr(3,40,15500)=b
>> bytarr(3,40,4000)=c
>>
>> Each representing a portion of a large image. They were read from 3
separate
>> files.
>>
>> What is the easiest way to combine these 3 files into one file and
output it
>> to a single file for later operation.
>
> I am assuming you want to concatenate the three arrays into a
> 3x40x35000 array. If that's the case then the following code shold
> show you the way, here using three arrays BB1, BB2 and BB3 as a
> example
>
> IDL> bb1 = bytarr(3,40,100)
> IDL> bb2 = bytarr(3,40,200)
> IDL> bb3 = bytarr(3,40,400)
>
> IDL> help, [[[bb1]],[[bb2]],[[bb3]]]
> <Expression> BYTE = Array[3, 40, 700]
>
> Voila. To be honest with you, I never understand how many nested []'s
> I need in order to make it work. I just go for trial and error until
> it does.
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------
Re: Merging Bytarr [message #23333 is a reply to message #23322] Tue, 16 January 2001 10:52 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
Craig Markwardt wrote:

> Voila. To be honest with you, I never understand how many nested []'s
> I need in order to make it work. I just go for trial and error until
> it does.

Thanks Craig. I feel so much better that I am not the only one doing
this all the time :-(

Cheers,
Pavel
Re: Merging Bytarr [message #23344 is a reply to message #23333] Mon, 15 January 2001 22:23 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Mark Chan" <chanm@cadvision.com> writes:

> I am new to bytarr operation.
>
> I have 3 separate color images in the following format:
>
> bytarr(3,40,15500)
> bytarr(3,40,15500)
> bytarr(3,40,4000)
>
> Each representing a portion of a large image. They were read from 3 separate
> files.
>
> What is the easiest way to combine these 3 files into one file and output it
> to a single file for later operation.

I am assuming you want to concatenate the three arrays into a
3x40x35000 array. If that's the case then the following code shold
show you the way, here using three arrays BB1, BB2 and BB3 as a
example

IDL> bb1 = bytarr(3,40,100)
IDL> bb2 = bytarr(3,40,200)
IDL> bb3 = bytarr(3,40,400)

IDL> help, [[[bb1]],[[bb2]],[[bb3]]]
<Expression> BYTE = Array[3, 40, 700]

Voila. To be honest with you, I never understand how many nested []'s
I need in order to make it work. I just go for trial and error until
it does.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: An IDL STRTOK??? Was: TextoIDL Broken and Gone?
Next Topic: axis and titles

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

Current Time: Sun Oct 12 07:06:06 PDT 2025

Total time taken to generate the page: 0.40199 seconds