[vtkusers] Volume rendering a dataset of only 2 scalars values,

Lisa Avila lisa.avila at kitware.com
Fri Mar 26 00:05:25 EST 2004


Hello Paul,

Your example will perform volume rendering of your data but there are some 
issues with it. First, you set only one point in each of your functions - 
this makes them constant. So you have a constant opacity of 0.5 everywhere 
(regardless of scalar value) and a constant color of white. Doing a MIP 
projection you should get a cube-shaped object of constant RGBA 
(1,1,1,0.5).  Instead, you should add another point to your opacity 
function making scalar 0.0 have an opacity of 0.0 - now you should see a 
white circle (sphere - but constant color so looks like a circle) instead 
of a cube. Next, you may wish to use compositing (the 
vtkVolumeRayCastCompositeFunction, or switch to the faster 
vtkVolumeTextureMapper2D) instead of maximum intensity so that the 
ShadeOn() method will actually result in shading (it is ignored for MIP).

Lisa


At 09:04 PM 3/25/2004, Paul McGuinness wrote:

>Hi vtk users,
>
>I have created a sphere in vtkImagedata format, it is built consisting of
>two scalar values, 0 and 1. Scalar value 0 is set to all points inside and
>outside the sphere and scalar value 1 is used for the boundary of the
>sphere.
>
>I can create a isosurface (contour surface) of my sphere simply by using:
>contour->SetValue(0,1);
>
>Now I need to create a volume rendering of this data. I am using the
>following:
>
>vtkPiecewiseFunction *opacityTransferFunction1 = vtkPiecewiseFunction::New();
>    opacityTransferFunction1->AddPoint(1,   0.5);
>
>vtkColorTransferFunction *colorTransferFunction1 = 
>vtkColorTransferFunction::New();
>     colorTransferFunction1->AddRGBPoint(1, 1.0, 1.0, 1.0);
>
>vtkVolumeProperty *volumeProperty1 = vtkVolumeProperty::New();
>     volumeProperty1->SetColor(colorTransferFunction1);
>     volumeProperty1->SetScalarOpacity(opacityTransferFunction1);
>     volumeProperty1->ShadeOn();
>     volumeProperty1->SetInterpolationTypeToLinear();
>
>vtkVolumeRayCastMIPFunction  *MIPFunction= vtkVolumeRayCastMIPFunction::New();
>vtkVolumeRayCastMapper *volumeMapper1 = vtkVolumeRayCastMapper::New();
>    volumeMapper1->SetVolumeRayCastFunction(MIPFunction);
>    volumeMapper1->SetInput(img->GetOutput());
>
>BUT I am getting nothing! Am I using this correctly? Can someone please
>help to get this to work? I appreciate any suggestions.
>
>Many Thanks,
>Paul.
>_______________________________________________
>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://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list