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

Home » Public Forums » archive » Re: Array Subscripting Puzzle
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: Array Subscripting Puzzle [message #30902 is a reply to message #30779] Wed, 22 May 2002 14:12 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 17 May 2002 14:18:15 -0700, Richard Younger wrote:

> I came up with an answer for a [3,800,600] image, but couldn't quite
> wrap my head around the [800,600,3], so I swapped:
>
> image = TRANSPOSE(image, [2,0,1])
>
> color_vec = [255,255,0]
> mask = [[3*indices], [(3*indices + 1)],[(3*indices + 2)]] image[mask] =
> $
> REBIN(TRANSPOSE(color_vec), N_ELEMENTS(indices), 3)
>
> It certainly would be uglier if you made it all one line (well, two with
> TRANSPOSE). Someone clever could probably swap around the index order
> on the image to eliminate that transpose and pretty up the mask
> construction, too.

Ahh yes, you point out a simplification in my index computation for
3x800x600.

3*(y*s[0]+x)==3*inds

So that I could have written:

image[rebin(1#(3*inds),3,n)+rebin(indgen(3),3,n)]= $
rebin([255,255,0],3,n)

Notice that Richard's example proves the point that you can use any
convenient intermediary format: he chose nx3, in contrast to 3xn for this
problem.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ActiveX
Next Topic: sec : U Re: Carriage Return / LineFeed in Text Widget

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

Current Time: Wed Oct 08 20:06:17 PDT 2025

Total time taken to generate the page: 0.02368 seconds