[vtkusers] Re: about volume rendering on color images

Amy Squillacote amy.squillacote at kitware.com
Thu Aug 3 08:48:59 EDT 2006


Actually, you should use vtkFixedPointVolumeRayCastMapper. Since your 
data is vtkImageData, there is no reason to convert it to 
vtkUnstructuredGrid. The vtkUnstructuredGridVolumeRayCastMapper works 
well for vtkUnstructuredGrid datasets, but converting a vtkImageData to 
vtkUnstructuredGrid and then using the 
vtkUnstructuredGridVolumeRayCastMapper will be slower than using 
vtkFixedPointVolumeRayCastMapper on the vtkImageData directly.

- Amy

Dan White wrote:
> 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
>
>
> _______________________________________________
> This is the private VTK discussion list.Please keep messages on-topic. 
> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>




More information about the vtkusers mailing list