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

Home » Public Forums » archive » IDLgrWindow, IDLgrVolume and alpha channel
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
IDLgrWindow, IDLgrVolume and alpha channel [message #33816] Fri, 24 January 2003 04:37
s[1] is currently offline  s[1]
Messages: 21
Registered: December 2002
Junior Member
Hi all,

I am rendering an IDLgrVolume into a IDLgrWindow. When I get the image
data from the Window, the image has only 3 channels. How can I get the
alpha channel of this image? The alpha channel information surely must be
somewhere, because volume rendering needs it.

I include a small test program that generates a volume, renders it into a
window and gets the buffer.

Does anybody have an idea how to get the alpha channel? Are there any
settings I forgot?

Thanks for all tips,

Sebastian

FUNCTION CREATE_SIMPLE_VOLUME
;; create a simple volume containing one big red object and two small
cubes
voldim = 128
vol = OBJ_NEW('IDLgrVolume')
;; create a volume data array of size dim^3
volData = BYTARR(voldim,voldim,voldim)
FOR i=0,(voldim-1) DO volData[*,i,0:i] = 64
volData[15:45, 15:45, 65:95] = 128 ;; small cube #1
volData[85:115, 85:115, 65:95] = 255 ;; small cube #2

;; set opacity for vol
opac = BYTARR(256)
opac[0:127] = BINDGEN(128)/8
opac[255] = 120
opac[128] = 255

;; set colors
rgb = bytarr(256, 3)
rgb[0:127,0] = 255 ; main cube is red
rgb[128, *] = [0, 255, 0] ; small green cube
rgb[255, *] = [0, 0, 255] ; small blue cube

vol->SETPROPERTY, data0=volData, RGB_TABLE0=rgb, OPACITY_TABLE0=opac, $
ZBUFFER=1, ZERO_OPACITY_SKIP=1

;; center volume at 0,0,0 and fit it into a unit cube
cc = [-0.5, 1.0/float(voldim)]
vol->SETPROPERTY, XCOORD_CONV=cc, YCOORD_CONV=cc, ZCOORD_CONV=cc
RETURN, vol
END ;; of: CREATE_SIMPLE_VOLUME

PRO CHECK_VOLUME_TRANSPARENCY
;; create a simple volume
vol = CREATE_SIMPLE_VOLUME()

;; create the view for the volume
volView = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[-1,-1,2,2], $
ZCLIP=[2.0, -2.0], COLOR=[150,150,150])
volModel = OBJ_NEW('IDLgrModel')
volModel->ADD, vol
volView->ADD, volModel

;; create the window and draw
volWin = OBJ_NEW('IDLgrWindow', RETAIN=2, DIMENSIONS=[300,300])
volWin->DRAW, volView

;; get the rendered image and check for alpha
volWin->GETPROPERTY, IMAGE_DATA=image
help, image
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Gradient of an Image
Next Topic: Re: Gradient of an Image

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

Current Time: Wed Oct 08 13:47:14 PDT 2025

Total time taken to generate the page: 0.00595 seconds