[vtkusers] 3D visualisation of 3-dimensionnal data

Andaharoo Andx_roo at live.com
Mon Jan 8 22:40:27 EST 2018


What you are describing sounds like volume rendering. VTK has a long history
of volume rendering. You can feed a vtkImageData to a vtkSmartVolumeMapper,
then give the mapper to the vtkVolume, and give the volume to the viewer.

Then you use the transfer functions to define what intensities you do and do
not want to see. vtkVolume has a vtkVolumeProperty which has a rgb transfer
function and scalar opacity function. So I can assign an opacity of 0 to
intensity 0 (black pixels) and opacity 1 to everything else. Or assign the
color red to pixels of intensities 0 and so on... Here are some nice default
settings. Very similar to Paraviews:

vtkVolumeProperty* prop = volume->GetProperty();
prop->GetRGBTransferFunction()->SetColorSpaceToDiverging();
prop->SetInterpolationTypeToLinear();
prop->SetAmbient(0.5);
prop->SetDiffuse(0.5);
prop->SetSpecular(0.2);
// Set the default transfer function
double maxIntensity = resource->getVTKImageData()->GetScalarRange()[1]; //
Max value in the image
prop->GetRGBTransferFunction()->RemoveAllPoints();
prop->GetScalarOpacity()->RemoveAllPoints();
prop->GetRGBTransferFunction()->AddRGBPoint(0.0, 0.23, 0.3, 0.75);
prop->GetRGBTransferFunction()->AddRGBPoint(maxIntensity, 0.7, 0.0, 0.15);
prop->GetScalarOpacity()->AddPoint(0.0, 0.0);
prop->GetScalarOpacity()->AddPoint(maxIntensity, 1.0);



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list