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 #30789 is a reply to message #30788] Fri, 17 May 2002 11:15 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
David Fanning wrote:

> Folks,
>
> I have a 24-bit image. You can interleave it anyway
> you like that will make the problem described below
> trackable. At the moment it is 800 by 600 by 3.
>
> I have the indices of something I want to draw on
> the image. Say they are the indices of the outlines
> of some continents. For example, like this:
>
> window, xsize=800, ysize=600
> map_set, /Cylindrical, position=[0,0,1,1]
> map_continents, /fill
> a = tvrd()
> indices = where(a GT 0)
>
> I want to make all the outline pixels yellow.
> I *could* do this:
>

> r = Reform((image[*,*,0]))
> g = Reform((image[*,*,1]))
> b = Reform((image[*,*,2]))
> r[indices] = 255
> g[indices] = 255
> b[indices] = 0
> image[*,*,0] = r
> image[*,*,1] = g
> image[*,*,2] = b
>
> That seems wasteful and inelegant. There must be
> a way to do this in one go. I'm sure it uses REBIN
> and REFORM, but I'm not sure in which order. :-(
>
> Can anyone help?

How about this:

m = a GT 0
image = image*(1-m)+[[[255*m]],[[255*m]],[[0*m]]]
[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 17:53:28 PDT 2025

Total time taken to generate the page: 0.00452 seconds