[vtkusers] using vtkVolumeRayCastMapper to render vtkSampleFunction

Bill Lorensen wlorens1 at nycap.rr.com
Sat Jan 13 17:22:37 EST 2001


You can use
vtkImageCast
http://public.kitware.com/vtk/quality/Doc/html/class_vtkImageCast.html

to convert from 10 (float) to unsigned char or unsigned short. If your data range is not
0< > 255 or 0 < > 65535 you will have to precede the Cast with
vtkImageShiftScale
http://public.kitware.com/vtk/quality/Doc/html/class_vtkImageShiftScale.html

Bill

At 07:29 PM 1/11/01 -0600, Wolfram H Volpi wrote:
>Hi, everybody!
>I'm trying to rayCast-render a volume generated by vtkSampleFunction.
>It doesn't work because,
>
>vtkVolumeRayCastMapper (0x80c9ef8): The scalar data type: 10 is not
>supported when volume rendering. Please convert the  data to unsigned
>char or unsigned short.
>
>How do I do that?
>
>The problem code is listed below.  It makes my PC go into virtual
>memeory.  My PC has 250 MB of RAM.
>
>Thank you,
>Woflv. 
>-------------------------------------------------------------------------------
>source $VTK_TCL/vtkInt.tcl
>
># goes into virtual memeory!
>vtkSphere sphere
>     sphere SetRadius 1
>
>vtkSampleFunction sample
>     sample SetImplicitFunction sphere
>
>vtkVolumeProperty volumeProperty
>     volumeProperty SetInterpolationTypeToNearest
>
>vtkVolumeRayCastMIPFunction  MIPFunction
>
>vtkVolumeRayCastMapper volumeMapper
>     volumeMapper SetInput [sample GetOutput]
>     volumeMapper SetVolumeRayCastFunction MIPFunction
>     volumeMapper SetSampleDistance 0.25
>
>vtkVolume volume
>     volume SetMapper volumeMapper
>     volume SetProperty volumeProperty
>
># graphics stuff
>vtkRenderer ren1
>     ren1 SetBackground 0.1 0.2 0.4
>vtkRenderWindow renWin
>     renWin AddRenderer ren1
>     renWin SetSize 256 256
>vtkRenderWindowInteractor iren
>     iren SetRenderWindow renWin
>
>ren1 SetBackground 0 0 0 
>
>ren1 AddVolume volume
>renWin SetSize 200 200
>renWin Render
>
>iren SetUserMethod {wm deiconify .vtkInteract}
>iren SetDesiredUpdateRate 1
>iren Initialize
>
>wm withdraw .
>
>
>_______________________________________________
>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