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

Home » Public Forums » archive » Re: color pixel by index
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: color pixel by index [message #55950] Mon, 24 September 2007 15:02
rpertaub@gmail.com is currently offline  rpertaub@gmail.com
Messages: 43
Registered: January 2007
Member
On Sep 24, 5:18 pm, David Fanning <da...@dfanning.com> wrote:
> David Fanning writes:
>> image4[mask2] = 0B
>> image4[mask2 + nelem] = 255B
>> image4[mask2 + (nelem*2)] = 255B
>> TV, image4, True=3
>
> Whoops! Of course this should be:
>
> image4[mask2] = 0B
> image4[mask2 + nelem] = 0B
> image4[mask2 + (nelem*2)] = 255B
> TV, image4, True=3
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/

Thanks! I actually just started with: image4 = [[[image4]],[[image4]],
[[image4]]]
and did the rest as you mentioned initially and have exactly what I
want...thanks so much for the help and deciphering my cry for help!!
RP
Re: color pixel by index [message #55951 is a reply to message #55950] Mon, 24 September 2007 14:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> image4[mask2] = 0B
> image4[mask2 + nelem] = 255B
> image4[mask2 + (nelem*2)] = 255B
> TV, image4, True=3

Whoops! Of course this should be:

image4[mask2] = 0B
image4[mask2 + nelem] = 0B
image4[mask2 + (nelem*2)] = 255B
TV, image4, True=3

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: color pixel by index [message #55952 is a reply to message #55951] Mon, 24 September 2007 14:15 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Maybe you just want image 4 to start out as image 4, and then
> my example will work. Instead of this:
>
> image4 = Bytarr(s[0], s[1], 3)
>
> Try this:
>
> image4 = [[[image4]],[[image4]],[[image4]]]
>
> Then, the rest of it.

Oh, that won't work. How about this:

s = Size(image, /Dimensions)
nelem = N_Elements(image)
image4 = [[[image4]],[[image4]],[[image4]]]

image4[mask1] = 255B
image4[mask1 + nelem] = 0B
image4[mask1 + (nelem*2)] = 0B

image4[mask3] = 0B
image4[mask3 + nelem] = 255B
image4[mask3 + (nelem*2)] = 0B

image4[mask2] = 0B
image4[mask2 + nelem] = 255B
image4[mask2 + (nelem*2)] = 255B
TV, image4, True=3

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: color pixel by index [message #55953 is a reply to message #55952] Mon, 24 September 2007 14:04 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rpertaub@gmail.com writes:

> However, this seems to combine the 3 masks onto one. I am trying to
> use the 3 masks combined onto a 4th image which ...
> i am essentially taking monochromator images at R,G,B and then color
> image, and want to false color my image using the 3 masks...not sure
> if I am making sense

Maybe you just want image 4 to start out as image 4, and then
my example will work. Instead of this:

image4 = Bytarr(s[0], s[1], 3)

Try this:

image4 = [[[image4]],[[image4]],[[image4]]]

Then, the rest of it.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: color pixel by index [message #55954 is a reply to message #55953] Mon, 24 September 2007 14:00 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rpertaub@gmail.com writes:

> However, this seems to combine the 3 masks onto one. I am trying to
> use the 3 masks combined onto a 4th image which ...
> i am essentially taking monochromator images at R,G,B and then color
> image, and want to false color my image using the 3 masks...not sure
> if I am making sense

Not to me, you aren't. Perhaps someone else can translate. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: color pixel by index [message #55955 is a reply to message #55954] Mon, 24 September 2007 13:41 Go to previous message
rpertaub@gmail.com is currently offline  rpertaub@gmail.com
Messages: 43
Registered: January 2007
Member
On Sep 24, 4:09 pm, David Fanning <da...@dfanning.com> wrote:
> rpert...@gmail.com writes:
>> i think this is a fairly easy problem to which i dunno the answer.
>> Here goes:
>
>> I have 3 images, and used where function 3 times to find 3 specific
>> characterizations.
>> mask1=where(image ge thresh1)
>> mask2=where(image2 ge thresh2)
>> mask 3=where(image3 ge thresh3)
>
>> Now I have 3 sets of indices of pixels of my interest.
>
>> I want to use image 4 and color pixels indices 1 red, indices 2= blue,
>> indices 3=green.
>
>> image[indices1]=red
>> image[indices2]=blue
>> image[indices3]=green
>
>> How do I do that?
>
> I would do it like this, since you may want to
> see the overlap in the indices:
>
> s = Size(image, /Dimensions)
> nelem = N_Elements(image)
> image4 = BytArr(s[0], s[1], 3]
> image4[mask1] = 255B
> image4[mask3 + nelem] = 255B
> image4[mask2 + (nelem*2)] = 255B
> TV, image4, True=3
>
> This presumes all three image used to construct the masks
> are the same size.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/

Thanks so much!
However, this seems to combine the 3 masks onto one. I am trying to
use the 3 masks combined onto a 4th image which ...
i am essentially taking monochromator images at R,G,B and then color
image, and want to false color my image using the 3 masks...not sure
if I am making sense
Re: color pixel by index [message #55957 is a reply to message #55955] Mon, 24 September 2007 13:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rpertaub@gmail.com writes:

> i think this is a fairly easy problem to which i dunno the answer.
> Here goes:
>
> I have 3 images, and used where function 3 times to find 3 specific
> characterizations.
> mask1=where(image ge thresh1)
> mask2=where(image2 ge thresh2)
> mask 3=where(image3 ge thresh3)
>
> Now I have 3 sets of indices of pixels of my interest.
>
> I want to use image 4 and color pixels indices 1 red, indices 2= blue,
> indices 3=green.
>
> image[indices1]=red
> image[indices2]=blue
> image[indices3]=green
>
> How do I do that?

I would do it like this, since you may want to
see the overlap in the indices:


s = Size(image, /Dimensions)
nelem = N_Elements(image)
image4 = BytArr(s[0], s[1], 3]
image4[mask1] = 255B
image4[mask3 + nelem] = 255B
image4[mask2 + (nelem*2)] = 255B
TV, image4, True=3

This presumes all three image used to construct the masks
are the same size.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ITK and IDL interface
Next Topic: Mosaic_doit

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

Current Time: Fri Oct 10 16:46:20 PDT 2025

Total time taken to generate the page: 0.01009 seconds