[vtkusers] Applying opacity to volume

Preeti Bindu preetibindu at gmail.com
Thu Jul 1 11:33:45 EDT 2010


Hi All,

I am stuck in a problem where in I have a volume rendered by using
vtkVolumeRayCastCompositeFunction and vtkRayCastMapper. The volume is
obtained from a series of DICOM images. I need to form an opaque volume such
that I should be able to view the inside of the volume through the cavities.
I am using the vtkPiecewiseFunction to do so. The snippet is as follows:


      colorTransferFunction->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );
      colorTransferFunction->AddRGBPoint( -16, 0.73, 0.25, 0.30, 0.49, .61
);
      colorTransferFunction->AddRGBPoint( 641, .90, .82, .56, .5, 0.0 );
      colorTransferFunction->AddRGBPoint( 3071, 1, 1, 1, .5, 0.0 );
      colorTransferFunction->AddRGBPoint( -155, .55, .25, .15, 0.5, .92 );
      colorTransferFunction->AddRGBPoint( 217, .88, .60, .29, 0.33, 0.45 );

      opacityTransferFunction->AddPoint(-3024, 0, 0.5, 0.0 );
      opacityTransferFunction->AddPoint(-16, 0, .49, .61 );
      opacityTransferFunction->AddPoint(641, .72, .5, 0.0 );
      opacityTransferFunction->AddPoint(3071, .71, 0.5, 0.0);

      volumeMapper->SetBlendModeToComposite();
      volumeProperty->ShadeOn();
      volumeProperty->SetAmbient(1.0);
      volumeProperty->SetDiffuse(0.9);
      volumeProperty->SetSpecular(0.2);
      volumeProperty->SetSpecularPower(10.0);
      volumeProperty->SetScalarOpacityUnitDistance(0.8919);

I have attached the output for the above inputs. Can anyone please tell me a
way by which I will be able to obtain a completely opaque volume? How to
specify the opacity values for the opacityTransferFunction? What is the
difference between scalar opacity and gradient opacity?

Thanks,

-Preeti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100701/b2f99f0e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2010-07-01 at 11.30.47 AM.png
Type: image/png
Size: 78466 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100701/b2f99f0e/attachment.png>


More information about the vtkusers mailing list