[vtkusers] Reading a raw RGB volume in VTK

Lisa S. Avila lisa.avila at kitware.com
Fri Nov 15 00:05:52 EST 2002


Hello Jason,

VTK cannot volume render multiple component data. You'll need to use 
something like vtkImageLuminance to convert to a single component before 
using volume rendering. Also, be sure your data is unsigned char or 
unsigned short.

Lisa


At 10:19 AM 11/14/2002, Jason Ruiter wrote:
>Greetings,
>
>I want to read a raw RGB volume into VTK and render it as a point
>cloud.  I'm using the following to read the data:
>
>reader=vtkImageReader2()
>reader.SetFileName("vhhead.optic.vol")
>reader.SetDataScalarTypeToUnsignedChar()
>reader.SetDataExtent( (0,255,0,255,0,255) )
>reader.SetNumberOfScalarComponents(3)
>reader.SetFileDimensionality(3)
>reader.Update()
>
>It reads without errors, but when I try to render it with:
>
>MapperVol = vtkVolumeRayCastMapper()
>MapperVol.SetInput(image)
>
>ActorVol = vtkVolume()
>ActorVol.SetMapper(MapperVol)
>ActorVol.SetProperty(volprop)
>RenderVol = vtkRenderer()
>RenderVol.AddActor(ActorVol)
>
>renVol = vtkRenderWindow()
>renVol.AddRenderer(RenderVol)
>irenVol = vtkRenderWindowInteractor()
>irenVol.SetRenderWindow(renVol)
>
>irenVol.Start()
>
>I get a segfault.  (I've posted that to the list earlier).
>
>My question:
>
>How does one read raw RGB Data and create a color table for it?  Is the
>code above the Right Way(tm) to go about it?
>
>Thanks
>Jason
>
>
>_______________________________________________
>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






More information about the vtkusers mailing list