Re: Alpha blending with object graphics - different color palettes do not work [message #75780] |
Wed, 04 May 2011 09:43  |
djh
Messages: 1 Registered: May 2011
|
Junior Member |
|
|
On May 4, 4:11 am, LNpellen <lnpel...@gmail.com> wrote:
> This is how I create the alphaDose:
> alphaDose = BYTARR(2, size[0], size[1], /NOZERO)
> alphaDose[0,*,*]=dose
> alphaDose[1,*,*]=255*alpha ; where alpha is a factor between 0 and 1
I ran into this last year.
Try converting alphaDose into a [4,n,m] array to use in the overlay
image:
alphaDose = Reform( alphaDose, [1, size[0], size[1] ], /overwrite )
oPaletteDose->GetProperty, red_values = r, green_values = g,
blue_values = b
alphaDose4 = [ r[alphaDose], g[alphaDose], b[alphaDose], alphaDose ]
alphaDose4[3,*,*] = 255*alpha
The background image can still use the palette.
Don
|
|
|
|
Re: Alpha blending with object graphics - different color palettes do not work [message #75784 is a reply to message #75782] |
Wed, 04 May 2011 09:17   |
Karl[1]
Messages: 79 Registered: October 2005
|
Member |
|
|
On May 4, 6:30 am, David Fanning <n...@idlcoyote.com> wrote:
> LNpellen writes:
>> Why isn't the rainbow (LoadCT, 13) working for me?
>
> I would guess because you are using indexed color mode.
> You do not EVER want to use indexed color when you are
> working with object graphics.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
The IDL docs for IDLgrImage say this for the image data parm:
"An n x m greyscale image, or a 2 x n x m, n x 2 x m, or n x m x 2
greyscale image with an alpha channel. (The alpha channel is ignored
if the destination device uses indexed color mode.)"
So this is considered a Luminance-Alpha image. The first channel is a
luminance (greyscale) channel. Greyscale images do not perform color
lookup through a palette. That is why setting the palette to rainbow
had no effect.
Is the dose map going to be displayed with a constant alpha, or a per-
pixel alpha, where the alpha value could be different for each pixel?
It *looks* like you want a constant alpha because you are filling the
alpha channel of the dose image with a constant (alpha * 255). You
don't need alpha data in the image if you want to apply constant alpha
with the ALPHA_CHANNEL property.
If the alpha is constant, you should just go back to a single channel
image and use that as an "indexed image" in conjunction with the
palette and use the ALPHA_CHANNEL property to set the global constant
alpha to 0.5 or whatever.
That should display your dose image with the color palette and half-
transparent.
As far as being in indexed mode goes, I don't think that the
DECOMPOSED setting affects the way IDLgrWindows are created. (not
sure). But you don't need to have an Indexed destination to use
palettes in images.
|
|
|
|
|