[vtkusers] about volume rendering on color images

Yixun Liu yxliu at fudan.edu.cn
Tue Aug 1 10:18:26 EDT 2006


I have 256x256x200 color tiff image. I want to render it using raycasting. I did it as below,

Firstly, compute 4th component (averageIntensity) based on the R,G and B components.
averageIntensity = R*0.30 + G*0.59 + B]*0.11;

Then generate a vtkImageData (finalImg), which includes 4 components: R, G, B and  averageIntensity. The first three will directly represent RGB (no lookup table). The fourth component will be passed through the first scalar opacity transfer function for opacity.

 vtkVolumeRayCastCompositeFunction *compositeFunction = vtkVolumeRayCastCompositeFunction::New();
 vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();

//opacity intepolation function
 vtkPiecewiseFunction *tfun = vtkPiecewiseFunction::New();
 tfun->AddPoint(0.0, 0.0);
 tfun->AddPoint(128.0, 0.1);
 tfun->AddPoint(255.0, 0.0);

 vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
 volumeProperty->SetScalarOpacity(3, tfun);

 vtkVolume *newvol = vtkVolume::New();

However, I cannot get a color volume.

Hope your help!


Yixun Liu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060801/9f7c08c3/attachment.htm>

More information about the vtkusers mailing list