[vtkusers] DRR using vtkFixedPointVolumeRayCastMapper
Shun Miao
shwinmiao at gmail.com
Tue Sep 25 15:14:39 EDT 2012
Hi,
I tried to do DRR rendering using vtkFixedPointVolumeRayCastMapper additive blend mode. The documentation says "Additive blend mode adds scalars along the ray and multiply them by their opacity mapping value", which is DRR rendering.
However, the rendering I got still looks like composite mode. The pixels nearby block the pixels far way.
Can anyone let me know how to do DRR rendering with VTK? Thanks!
My code:
vtkVolume *volume = vtkVolume::New();
vtkFixedPointVolumeRayCastMapper *mapper = vtkFixedPointVolumeRayCastMapper::New();
mapper->SetInputConnection( reader->GetOutputPort() );
vtkColorTransferFunction *colorFun = vtkColorTransferFunction::New();
vtkPiecewiseFunction *opacityFun = vtkPiecewiseFunction::New();
vtkVolumeProperty *property = vtkVolumeProperty::New();
property->SetIndependentComponents(independentComponents);
property->SetColor( colorFun );
property->SetScalarOpacity( opacityFun );
property->SetInterpolationTypeToLinear();
volume->SetProperty( property );
volume->SetMapper( mapper );
colorFun->AddRGBSegment(opacityLevel - 0.5*opacityWindow, 0.0, 0.0, 0.0,
opacityLevel + 0.5*opacityWindow, 1.0, 1.0, 1.0 );
opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 1.0,
opacityLevel + 0.5*opacityWindow, 1.0 );
mapper->SetBlendModeToAdditive();
property->ShadeOff();
--
Shun Miao
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120925/9d7d0571/attachment.htm>
More information about the vtkusers
mailing list