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

Home » Public Forums » archive » Re: 3D array imaging with different colors
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: 3D array imaging with different colors [message #83365 is a reply to message #83364] Thu, 28 February 2013 08:49 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
tackmeister@gmail.com writes:

> The past few months I've been breaking my head on a particular problem. I try to create RGB images using the image function. My array to plot is three dimensional, an example image would be:
>
> a=fltarr(500,500,3)
> for i=0,499 do if i lt 300 and i gt 200 then a(i,*,0)=i
> for i=0,499 do if i lt 300 and i gt 200 then a(*,i,0)=i
> for i=0,499 do if i lt 100 and i gt 0 then a(i,*,1)=i
> for i=0,499 do if i lt 100 and i gt 0 then a(*,i,1)=i
> for i=0,499 do if i lt 500 and i gt 400 then a(i,*,2)=i
> for i=0,499 do if i lt 500 and i gt 400 then a(*,i,2)=i
>
> I plot this array using:
> graph = image(a)
>
> The problem now is that every pixel with value (0,0,0) as (R,G,B) will be plotted black. Personally, I'd prefer it if the scaling would occur from white to black instead of the other way around (by default).
>
> I tried to change the color table used, yet this doesn't work. The only thing that does help is by inverting the bytscled array, yet this inverts the entire color table and gives strange looking color. Using the tv procedure instead of the image function also doesn't help.
>
> In any case, does anyone of you have an idea how I can image my 3D array as an RGB image, scaled from white (lowest intensity) to black (highest intensity)?

Huh!? There is no color table here. You are specifying the colors
directly. If you want a pixel with a RGB value [0,0,0] to be plotted
white, then you have no choice but to change its value to [255,255,255].
A color table, ANY color table, is useless to you!

Actually, your colors are worthless to you too, since the values in the
array are ranging from 0 to 400, and color values in an RGB triple can
only range from 0 to 255.

You seem to know what colors you want. Just find the RGB value for that
color and assign those values to the pixels you want to be that color.
Simple as that.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDLgrPolygon unexpected result
Next Topic: 3D array imaging with different colors

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

Current Time: Fri Oct 10 05:44:52 PDT 2025

Total time taken to generate the page: 6.72036 seconds