[vtkusers] Eliminate black pixels in vtkvolume

Doug Hoppes dhoppes at mbfbioscience.com
Tue Feb 21 11:28:35 EST 2017


Hi all,

                Got a question.  I have a vtkvolume actor that is mostly a black cube with some data inside of it.  I would like to remove all of the black pixels from the display and leave any non-black pixels.  To do this, I am adjusting Scalar Opacity using:

       vtkSmartPointer<vtkPiecewiseFunction> pScalarToOpacityMapping = vtkSmartPointer<vtkPiecewiseFunction>::New();
       pScalarToOpacityMapping->AddPoint(50, 1.0);
       pScalarToOpacityMapping->AddPoint(200, 1.0);
       pScalarToOpacityMapping->ClampingOff();
       pProperty->SetScalarOpacity(pScalarToOpacityMapping);

                However, I've noticed that the black pixels are still present in the display. The volume is being displayed using the vtksmartvolumemapper.

With the clamping off, I can get some of the pixels to disappear but only on the edges of the cube. There are no changes, if I turn the clamping on and using the following settings:

       vtkSmartPointer<vtkPiecewiseFunction> pScalarToOpacityMapping = vtkSmartPointer<vtkPiecewiseFunction>::New();
       pScalarToOpacityMapping->AddPoint(0, 0.0);
       pScalarToOpacityMapping->AddPoint(255, 1.0);
       pProperty->SetScalarOpacity(pScalarToOpacityMapping);

Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170221/89b6c999/attachment.html>


More information about the vtkusers mailing list