[vtkusers] Volume rendering a dataset of only 2 scalars values,
Paul McGuinness
mcguinpg at maths.tcd.ie
Thu Mar 25 21:04:24 EST 2004
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.
More information about the vtkusers
mailing list