[vtkusers] Re: about volume rendering on color images

Dan White dan at chalkie.org.uk
Thu Aug 3 06:59:00 EDT 2006


Hi,

you need to use the UnstrucrtedGridRayCastMapper

not the old ray cast mapper

the unstructured grid one handles colour image data

Dan

On 1 Aug 2006, at 19:01, vtkusers-request at vtk.org wrote:

> Hi,
>
> 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.
>
>
> //mapper
>  vtkVolumeRayCastCompositeFunction *compositeFunction =  
> vtkVolumeRayCastCompositeFunction::New();
>  vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
>  volumeMapper->SetInput(finalImg);
>  volumeMapper->SetVolumeRayCastFunction(compositeFunction);
>  volumeMapper->IndependentComponentsOff();
>
> //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);
>
> //property
>  vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
>  volumeProperty->SetScalarOpacity(3, tfun);
>
>
> //volume
>  vtkVolume *newvol = vtkVolume::New();
>  newvol->SetMapper(volumeMapper);
>  newvol->SetProperty(volumeProperty);
>
> However, I cannot get a color volume.
>
> Hope your help!
>
> Regards,
>
> Yixun Liu

Dr. Daniel James White BSc. (Hons.) PhD
Bioimaging Coordinator
Nanoscience Centre and Department of Biological and Environmental  
Sciences
Division of Molecular Recognition
Ambiotica C242
PO Box 35
University of Jyväskylä
Jyväskylä
FIN 40014
Finland

+358 14 260 4183 (work)
+358 468102840 (mobile)
http://www.bioimagexd.org
http://www.chalkie.org.uk
dan at chalkie.org.uk
white at cc.jyu.fi





More information about the vtkusers mailing list