[vtkusers] problem in mapping colors
freshy flo
snrf at no-log.org
Mon Oct 25 14:20:08 EDT 2004
Hello all vtk users,
I have a simple code to open a STL file that works fine. This file
contains only one structure (bone tissue) and i'm able to give a color
to it ((1,0.5,0);). But what I can't set so far is the a color of the
rest of the information in the stl file (the bone marrow). I have to
precise that the STL file are created from Binarised images.
vtkSTLReader *sr = vtkSTLReader::New();
sr->SetFileName ("porous.stl");
vtkPolyDataNormals *pNormals = vtkPolyDataNormals::New();
pNormals->SetFeatureAngle (80);
pNormals->SetInput(sr->GetOutput());
vtkPolyDataMapper *stlMapper = vtkPolyDataMapper::New();
stlMapper->SetInput(pNormals->GetOutput());
stlMapper->SetColorModeToMapScalars();
stlMapper->ScalarVisibilityOff();
vtkActor *stlActor = vtkActor::New();
stlActor->SetMapper(stlMapper);
stlActor->GetProperty()->SetColor(1,0.5,0); // bone color ???? how
to give a color to the marrow ?????
stlActor->GetProperty()->SetInterpolationToGouraud();
ren->AddActor(stlActor);
ren->SetBackground(0,0,0);
// draw the resulting scene
renWindow->SetSize( 300, 300 );
renWindow->Render();
//Start the interactor
iren->Start();
If anyone could point me to some suggestions .....
Jean
More information about the vtkusers
mailing list