[vtkusers] Trouble with Volume and a Plane

jon n elwo73 at hotmail.com
Fri Mar 15 13:31:25 EST 2002


the following Python script demonstrates the behaviour using
the iron protein example file. btw, I'm using Mandrake Linux 8.1 and
an ATI Rage 128 (i think) graphics card.

from vtkpython import *
from Tkinter import *
from vtkTkRenderWidget import vtkTkRenderWidget

inStuff = vtkStructuredPointsReader()
inStuff.SetFileName('/home/datatmp/VTKData/Data/ironProt.vtk')

opacity = vtkPiecewiseFunction()
opacity.AddSegment(0, 0, 255, 1.0)
grey = vtkPiecewiseFunction()
grey.AddSegment(0, 0.7, 255, 1.0)

volProperty = vtkVolumeProperty()
volProperty.SetColor(grey)
volProperty.SetScalarOpacity(opacity)
volProperty.SetInterpolationTypeToLinear()
compositeFunction = vtkVolumeRayCastCompositeFunction()

volMapper = vtkVolumeRayCastMapper()
volMapper.SetInput(inStuff.GetOutput())
volMapper.SetVolumeRayCastFunction(compositeFunction)

volume = vtkVolume()
volume.SetMapper(volMapper)
volume.SetProperty(volProperty)

theReader = vtkStructuredPointsReader()
theReader.SetFileName('/home/datatmp/VTKData/Data/ironProt.vtk')
myVOI = vtkExtractVOI()
myVOI.SetVOI(50, 50, 30, 50, 30, 50)
myVOI.SetInput(theReader.GetOutput())

theLUT = vtkLookupTable()
theLUT.SetTableRange(0, 255)
theLUT.SetHueRange(1, 1)
theLUT.SetSaturationRange(1, 1)
theLUT.SetValueRange(0.1, 0.9)
theLUT.Build()

rayTexture = vtkTexture()
rayTexture.SetInput( myVOI.GetOutput() )
rayTexture.InterpolateOn()
rayTexture.SetLookupTable( theLUT )
rayTexture.MapColorScalarsThroughLookupTableOn()

RayPlane = vtkPlaneSource()
RayPlane.SetXResolution(1)
RayPlane.SetYResolution(1)
RayPlane.SetOrigin(0,0, -0.1)
RayPlane.SetPoint1(50, 0, -0.1)
RayPlane.SetPoint2(0, -50, -0.1)

rayMapper = vtkPolyDataMapper()
rayMapper.SetInput(RayPlane.GetOutput())
rayMapper.ImmediateModeRenderingOn()

RayActor = vtkActor()
RayActor.SetMapper(rayMapper)
RayActor.SetTexture(rayTexture)

f = vtkRenderer()
f.SetBackground(0.0, 0.4, 0.4)
f.AddVolume(volume)
f.AddActor(RayActor)

win=vtkRenderWindow()
win.AddRenderer(f)
iren=vtkRenderWindowInteractor()
iren.SetRenderWindow(win)
iren.Initialize()
iren.Start()


>From: "Lisa S. Avila" <lisa.avila at kitware.com>
>To: "jon n" <elwo73 at hotmail.com>, <vtkusers at public.kitware.com>
>Subject: Re: [vtkusers] Trouble with Volume and a Plane
>Date: Thu, 14 Mar 2002 21:13:32 -0500
>
>Hello Jon,
>
>I don't think you mention what version of VTK you are using. A while ago
>(maybe in 3.2?) there was a bug where texture mapping (in OpenGL) would be
>disabled by some of the volume mappers, which would mess up the rendering 
>of
>texture mapped polygons. This bug has been fixed in VTK 4.0. Are you 
>certain
>the plane is not being rendered, or is it just being rendered in black?
>Finally, can you demonstrate this problem in a simple tcl script relying
>only on data available in VTKData / on the VTK CDROM?
>
>Thanks,
>
>Lisa
>
>----- Original Message -----
>From: "jon n" <elwo73 at hotmail.com>
>To: <vtkusers at public.kitware.com>
>Sent: Thursday, March 14, 2002 7:21 PM
>Subject: Re: [vtkusers] Trouble with Volume and a Plane
>
>
> > actually, when I first display the actor using SetVisibilityOn() it 
>shows
>up
> > fine. but as soon as I move the center of the plane, even if I move it 
>to
> > where it originally was set, it disappears.
> >
> > i've compared what I get from printing out the actor after it shows up 
>and
> > after it disappears and the results are strange. right after it shows up
>it
> > lists the lookup table as none and property as none, even though the
>texture
> > of the plane has a lookup table associated with it. after it disappears 
>it
> > gets a lookup table and property. here is a comparison of what these
> > sections:
> >
> > ...
> >     Lookup Table: (none)
> > ...
> >   Property: (none)
> >
> > and after it disappears:
> >
> >     Lookup Table:
> >       Debug: Off
> >       Modified Time: 1607
> >       Reference Count: 1
> >       Registered Events: (none)
> >       Alpha: 1
> >       TableRange: (0, 1)
> >       Scale: Linear
> >       HueRange: (0, 0.66667)
> >       SaturationRange: (1, 1)
> >       ValueRange: (1, 1)
> >       AlphaRange: (1, 1)
> >       NumberOfTableValues: 256
> >       NumberOfColors: 256
> >       Ramp: SCurve
> >       InsertTime: 0
> >       BuildTime: 0
> > ...
> >   Property:
> >     Debug: Off
> >     Modified Time: 1591
> >     Reference Count: 1
> >     Registered Events: (none)
> >     Ambient: 0
> >     Ambient Color: (1, 1, 1)
> >     Diffuse: 1
> >     Diffuse Color: (1, 1, 1)
> >     Edge Color: (1, 1, 1)
> >     Edge Visibility: Off
> >     Interpolation: VTK_GOURAUD
> >     Opacity: 1
> >     Representation: VTK_SURFACE
> >     Specular: 0
> >     Specular Color: (1, 1, 1)
> >     Specular Power: 1
> >     Backface Culling: Off
> >     Frontface Culling: Off
> >     Point size: 1
> >     Line width: 1
> >     Line stipple pattern: 65535
> >     Line stipple repeat factor: 1
> >
> > >From: "jon n" <elwo73 at hotmail.com>
> > >To: vtkusers at public.kitware.com
> > >Subject: [vtkusers] Trouble with Volume and a Plane
> > >Date: Thu, 14 Mar 2002 15:14:21 -0800
> > >
> > >hi,
> > >
> > >I have a render window which gets switched between a Volume render and 
>an
> > >isocontour Actor. If I have the isocontour Actor showing and then show
>this
> > >other plane actor, it works fine. But if I have the Volume showing and
>then
> > >show the plane, the plane flashes on and then disappears and even if I
> > >switch to viewing the isocontour the plane still will not show. The 
>plane
> > >is
> > >at z=-0.1 to prevent it from interfering with the Volume and 
>isocontour.
>is
> > >there something strange about planes and volumes being together?
> > >
> > >thanks
> > >
> > >
> > >_________________________________________________________________
> > >Get your FREE download of MSN Explorer at
>http://explorer.msn.com/intl.asp.
> > >
> > >_______________________________________________
> > >This is the private VTK discussion list.
> > >Please keep messages on-topic. Check the FAQ at:
> > ><http://public.kitware.com/cgi-bin/vtkfaq>
> > >Follow this link to subscribe/unsubscribe:
> > >http://public.kitware.com/mailman/listinfo/vtkusers
> >
> >
> >
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at
>http://explorer.msn.com/intl.asp.
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com




More information about the vtkusers mailing list