[vtkusers] Transparency of a vtkImageActor in scene

chasank chasank at gmail.com
Wed Jan 18 07:00:05 EST 2012


Hi all, 

I want to crop a volume and show the cropping planes with vtkImageActor. I
use lookup table for visualization of my image data which its scalar data
type is float. Alpha values of table values are linearly changing from 0 to
1 which meaning smaller scalar values are more transparent than the bigger
scalar values. The problem is the area which has minimum scalar value is
completely black in scene even it's alpha value is 0. Sample image data's
scalar range is (0.0, 130.0). When I set every table value's alpha value to
0 volume of image data is completely disappears while the image actor stays
same! Source code I use is below; 

lut = vtkLookupTable()
lut.SetNumberOfTableValues(256)
lut.SetTableRange(minIntensity, maxIntensity)
lut.SetRampToLinear()
lut.SetScaleToLinear()
lut.Build()

red, green, blue = constructLut('actc')
        
for x in range(256):     
  lut.SetTableValue(x, float(red[x]/255.0), float(green[x]/255.0),
float(blue[x]/255.0), float(x/255.0))            
  
level = 0.5 * (minIntensity + maxIntensity)
window = maxIntensity - minIntensity
 
imageMap = vtkImageMapToWindowLevelColors()
imageMap.SetInputConnection(image.GetOutputPort())
imageMap.SetOutputFormatToRGBA()
imageMap.SetLookupTable(lut)
imageMap.SetLevel(level)
imageMap.SetWindow(window)
imageMap.Update()   

ext = image.GetWholeExtent()

actorMinX = vtkImageActor()
actorMinX.SetInput(imageMap.GetOutput())
actorMinX.SetDisplayExtent(ext[0], ext[0], ext[2], ext[3], ext[4], ext[5])

renderer.AddViewProp(actorMinX)

http://vtk.1045678.n5.nabble.com/file/n5154639/actor.png 
        


            
      

--
View this message in context: http://vtk.1045678.n5.nabble.com/Transparency-of-a-vtkImageActor-in-scene-tp5154639p5154639.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list