[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Merging Bytarr

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 B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response