[vtkusers] Transparent values of vtkImageData
Najzero
adrian.gabriel at 4plus.de
Tue Jul 10 01:56:45 EDT 2012
Hi Alex,
you might wanna have a look into vtkLookupTable
We use it for example to have "black" values to be transparent.
First build the lookuptable, then apply to the texture.
<snippet we use>
body->_volume.reset( new dicom::modDicomVolume );
body->_lookupTable = vtkSmartPointer<vtkLookupTable>::New();
body->_bmpPixelData = vtkSmartPointer<modImage>::New(); // Pixeldaten
body->_bmpPolyData = vtkSmartPointer<vtkPolyData>::New(); //
Polygondaten
body->_texture = vtkSmartPointer<vtkTexture>::New(); // Textur
//=== set lookup table so it shows black values transparent
body->_lookupTable->SetNumberOfColors( 255 );
body->_lookupTable->SetTableRange( 0.0, 256 * 256 - 1 );
body->_lookupTable->SetHueRange( 0.0, 0.0 );
body->_lookupTable->SetSaturationRange( 0.0, 0.0 );
body->_lookupTable->SetAlphaRange( 0.0, 1.0 );
body->_lookupTable->Build();
body->_texture->SetInput( body->_bmpPixelData ); // Der Textur die
Pixeldaten zuweisen
body->_texture->MapColorScalarsThroughLookupTableOn();
body->_texture->SetLookupTable( body->_lookupTable ); // Der Textur die
Lookup-Table zuweisen
body->_texture->InterpolateOn();
KR Adrian
--
View this message in context: http://vtk.1045678.n5.nabble.com/Transparent-values-of-vtkImageData-tp5714562p5714583.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list