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

Home » Public Forums » archive » Re: Transparency for IDLgrVolume in IDL 6.1
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: Transparency for IDLgrVolume in IDL 6.1 [message #44820 is a reply to message #44818] Tue, 19 July 2005 14:10 Go to previous messageGo to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
On Tue, 19 Jul 2005 11:46:18 -0700, Mary wrote:

> Hello Karl,
>
> thank you very much for your prompt response and the information you
> gave me! I have a better understanding now of how the volumes are
> rendered in IDL.
>
> I ran your program a couple of times using different settings for rgb0,
> rgb1, opacity0, and opacity1 to understand how they affect the display
> of the image. I think I understand it now. I tried doing something
> similar with the IDLgrVolume by setting data0 & data1 to each of my
> volumes. However, I haven't been successful at seeing both volumes
> within each other at the same time.
>
> I noticed that the VOLUME_SELECT property is very important when the
> volume object has different data. If VOLUME_SELECT = 0 then only data0
> is shown. When VOLUME_SELECT = 1 then it is supposed to combine the
> data0 & data1 using the rgb and opacity settings for each. I've been
> playing with different settings (for rgb and opacity) all last night
> and today. But it actually seems that IDL is only using the larger
> volume with the rgb/opacity settings to mask the smaller volume, no
> matter which one I set as data0 or data1. Does this make sense? It's
> sort of what happens with the the sample code you sent, where vol1 is a
> mask to vol0; you can't actually see both vol0 and vol1 at the same
> time. (Did I understand your code correctly?)

I took a short-cut by using iVolume, which does its best to deal with
VOLUME_SELECT on its own.

Read on.

>
> However, that's not what I want: I actually need to see both volumes, so
> that I can see the position of the smaller volume within the larger
> volume. Can this be achieved with the data0/data1 properties of
> IDLgrVolume? Is there any other property I need to set? (I also played
> with ZERO_OPACITY_SKIP but it didn't help).

ok, this is simpler and is probably what I should have posted
in the first place.

vol0 = BYTARR(10,10,10)
vol1 = BYTARR(10,10,10)
vol0[1:3,1:3,1:3] = 1 ; red
vol1[6:8,6:8,6:8] = 2 ; green
ct = BYTARR(256,3) + 255
ct[1,*] = [255,100,100]
ct[2,*] = [100,255,100]
opac = BYTARR(256) + 100
opac[1] = 255
opac[2] = 255
oVol = OBJ_NEW('IDLgrVolume', vol0, vol1, VOLUME_SELECT=1, $
RGB_TABLE0=ct, RGB_TABLE1=ct, OPACITY_TABLE0=opac, OPACITY_TABLE1=opac)
xobjview, oVol


I may have been slightly incorrect when implying that you can simply
combine two volume datasets in dual volume mode.

What is important is how they are combined. Here are part of the docs for
VOLUME_SELECT:

+++

Render dual volume from DATA0 and DATA1.
The value at voxel [i,j,k] is modulated between the two data sets as
follows:

srcRed[i,j,k] = (RGB_TABLE0[DATA0[i,j,k],0] *
RGB_TABLE1[DATA1[i,j,k],0]) / 255
srcGreen[i,j,k] = (RGB_TABLE0[DATA0[i,j,k],1] *
RGB_TABLE1[DATA1[i,j,k],1]) / 255
srcBlue[i,j,k] = (RGB_TABLE0[DATA0[i,j,k],2] *
RGB_TABLE1[DATA1[i,j,k],2]) / 255
srcAlpha[i,j,k] = (OPACITY_TABLE0[DATA0[i,j,k]] *
OPACITY_TABLE1[DATA1[i,j,k]]) / 255

+++

It is important to understand these equations.

Note that if you try to combine volume data that is non-zero in one
dataset with volume data that is zero in the other dataset (in the same
volume location), you will end up with zero. Note that this
multiplication happens after color table lookup.

That's why I filled both of my color tables with white as a "default"
value and put red at index 1 and green at index 2. This keeps the results
of the modulation from getting wiped out.

The downside is that you'll probably get unwanted background opacity where
you don't want it, as illustrated by the grey in the above example.

You might be better off combining your volumes yourself and then giving
IDLgrVolume a single combined volume. You'll have control over the
combining process. I think that the two-channel mode in grVolume is
really for using one volume to modulate the other and not for combining
unrelated volumes.

Karl
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: XROI problem
Next Topic: Re: Overlaying gridded winds on satellite data

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

Current Time: Sun Oct 12 22:19:11 PDT 2025

Total time taken to generate the page: 0.24175 seconds